linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
To: fangxiaozhi 00110321 <fangxiaozhi@huawei.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	zihan@huawei.com, Lin.Lei@huawei.com, greg@kroah.com,
	neil.yi@huawei.com, wangyuhua@huawei.com, huqiao36@huawei.com,
	balbi@ti.com
Subject: Re: [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
Date: Tue, 18 Dec 2012 15:10:14 +0100	[thread overview]
Message-ID: <20121218141013.GB4939@breakpoint.cc> (raw)
In-Reply-To: <fdcdb3e12b55.2b55fdcdb3e1@huawei.com>

On Tue, Dec 18, 2012 at 10:44:19AM +0800, fangxiaozhi 00110321 wrote:
> diff -uprN linux-3.7_bak/drivers/usb/storage/initializers.c linux-3.7/drivers/usb/storage/initializers.c
> --- linux-3.7_bak/drivers/usb/storage/initializers.c	2012-12-11 09:56:11.000000000 +0800
> +++ linux-3.7/drivers/usb/storage/initializers.c	2012-12-17 11:12:12.000000000 +0800
>  	US_DEBUGP("Huawei mode set result is %d\n", result);
>  	return 0;
>  }
> +
> +/* Find the supported Huawei USB dongles */
> +static int usb_stor_huawei_dongles_pid(struct us_data *us)
> +{
> +	struct usb_interface_descriptor *idesc;
> +	int idProduct;
> +	
> +	idesc = &us->pusb_intf->cur_altsetting->desc;
> +	idProduct = us->pusb_dev->descriptor.idProduct;
> +	if (idesc && idesc->bInterfaceNumber == 0) {
> +		if ((idProduct == 0x1001)
> +			|| (idProduct == 0x1003)
> +			|| (idProduct == 0x1004)
> +			|| (idProduct >= 0x1401 && idProduct < 0x1501)
> +			|| (idProduct > 0x1504 && idProduct <= 0x1600)
> +			|| (idProduct >= 0x1c02 && idProduct <= 0x2202)) {
> +			return 1;
> +		}
> +	}
> +	return 0;
> +}
> +
> +static int usb_stor_huawei_scsi_init(struct us_data *us)
> +{
> +	int result = 0;
> +	int act_len = 0;
> +	char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
> +			0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

Has this something to do with the SPACE command as defined in SSC-2? I don't
see the code (0x6 here) to be defined. But then you name is rewind.

> +	struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
> +	
> +	memset(bcbw, 0, sizeof(struct bulk_cb_wrap));
> +	bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN);
> +	bcbw->Tag = 0;
> +	bcbw->DataTransferLength = 0;
> +	bcbw->Flags = bcbw->Lun = 0;

A memset() followed by an init of each member of the struct. Could please
chose one side?

> +	bcbw->Length = sizeof(rewind_cmd);
> +	memcpy(bcbw->CDB, rewind_cmd, sizeof(rewind_cmd));
> +
> +	result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, &bcbw,
> +					US_BULK_CS_WRAP_LEN, &act_len);

I am a little confused here. Shouldn't this be bcbw aka us->iobuf and not
&bcbw ?

And shouldn't you read something from the us->recv_bulk_pipe after that?

> +	US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result);
> +	return result;
> +}
> +

Sebastian

  reply	other threads:[~2012-12-18 14:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-18  2:42 [PATCH 1/2]linux-usb:Define a new macro for USB storage match rules fangxiaozhi 00110321
2012-12-18  2:44 ` [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command fangxiaozhi 00110321
2012-12-18 14:10   ` Sebastian Andrzej Siewior [this message]
2012-12-19  3:13     ` Fangxiaozhi (Franko)
2012-12-19  8:34       ` Sebastian Andrzej Siewior
2012-12-19 15:40         ` Matthew Dharm
2013-01-04  7:30           ` Fangxiaozhi (Franko)
  -- strict thread matches above, loose matches on Subject: below --
2013-01-11  9:57 fangxiaozhi 00110321
2013-01-12  0:22 ` Greg KH
2013-01-14  2:29   ` Fangxiaozhi (Franko)
2013-01-13 22:05 ` Sebastian Andrzej Siewior
2013-01-25  2:46 fangxiaozhi 00110321
2013-01-27 18:48 ` Sebastian Andrzej Siewior
2013-02-04  7:16 fangxiaozhi 00110321

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121218141013.GB4939@breakpoint.cc \
    --to=sebastian@breakpoint.cc \
    --cc=Lin.Lei@huawei.com \
    --cc=balbi@ti.com \
    --cc=fangxiaozhi@huawei.com \
    --cc=greg@kroah.com \
    --cc=huqiao36@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=neil.yi@huawei.com \
    --cc=wangyuhua@huawei.com \
    --cc=zihan@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).