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, mdharm-usb@one-eyed-alien.net,
sebastian@breakpoint.cc
Subject: Re: [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
Date: Sun, 27 Jan 2013 19:48:30 +0100 [thread overview]
Message-ID: <20130127184830.GB7163@breakpoint.cc> (raw)
In-Reply-To: <fdfec7483556.3556fdfec748@huawei.com>
On Fri, Jan 25, 2013 at 10:46:13AM +0800, fangxiaozhi 00110321 wrote:
> diff -uprN linux-3.8-rc4_orig/drivers/usb/storage/initializers.c linux-3.8-rc4/drivers/usb/storage/initializers.c
> --- linux-3.8-rc4_orig/drivers/usb/storage/initializers.c 2013-01-22 14:12:42.594238726 +0800
> +++ linux-3.8-rc4/drivers/usb/storage/initializers.c 2013-01-22 14:28:21.512294889 +0800
> @@ -104,3 +104,75 @@ int usb_stor_huawei_e220_init(struct us_
> US_DEBUGP("Huawei mode set result is %d\n", result);
> return 0;
> }
> +
> +/*
> + * It will send a scsi switch command called rewind' to huawei dongle.
> + * When the dongle receives this command at the first time,
> + * it will reboot immediately. After rebooted, it will ignore this command.
> + * So it is unnecessary to read its response.
> + */
> +static int usb_stor_huawei_scsi_init(struct us_data *us)
> +{
> + int result = 0;
> + int act_len = 0;
> + struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
> + char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
> + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
> +
> + bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN);
> + bcbw->Tag = 0;
> + bcbw->DataTransferLength = 0;
> + bcbw->Flags = bcbw->Lun = 0;
> + bcbw->Length = sizeof(rewind_cmd);
> + memset(bcbw->CDB, 0, sizeof(bcbw->CDB));
First you memset() 16 bytes of CDB to 0
> + memcpy(bcbw->CDB, rewind_cmd, sizeof(rewind_cmd));
And now you copy 16 bytes from rewind_cmd to CDB. So the memset is not really
required, is it?
> +
> + result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcbw,
> + US_BULK_CB_WRAP_LEN, &act_len);
> + US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result);
> + return result;
> +}
Sebastian
next prev parent reply other threads:[~2013-01-27 18:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 2:46 [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command fangxiaozhi 00110321
2013-01-27 18:48 ` Sebastian Andrzej Siewior [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-02-04 7:16 fangxiaozhi 00110321
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
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
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)
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=20130127184830.GB7163@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=mdharm-usb@one-eyed-alien.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.