lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <910F9D9E13B84F4C8FA771DC9BDE99F326FCB006@szxeml546-mbs.china.huawei.com>
Date:	Wed, 19 Dec 2012 03:13:32 +0000
From:	"Fangxiaozhi (Franko)" <fangxiaozhi@...wei.com>
To:	Sebastian Andrzej Siewior <sebastian@...akpoint.cc>
CC:	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"Xueguiying (Zihan)" <zihan.xue@...wei.com>,
	"Linlei (Lei Lin)" <lei.lin@...wei.com>,
	"greg@...ah.com" <greg@...ah.com>,
	"Yili (Neil)" <neil.yi@...wei.com>,
	"Wangyuhua (Roger, Credit)" <wangyuhua@...wei.com>,
	Huqiao <huqiao36@...wei.com>, "balbi@...com" <balbi@...com>
Subject: RE: [PATCH 2/2]linux-usb:optimize to match the Huawei USB storage
 devices and support new switch command

Dear Sebastian:
	Please see the comments follows yours.
	
	By the way, I found the kernel is updated to 3.7.1 today. So I have to update my patch based on 3.7.1, and resubmit it?
	Right?

Best Regards,
Franko Fang

> -----Original Message-----
> From: Sebastian Andrzej Siewior [mailto:sebastian@...akpoint.cc]
> Sent: Tuesday, December 18, 2012 10:10 PM
> To: Fangxiaozhi (Franko)
> Cc: linux-usb@...r.kernel.org; linux-kernel@...r.kernel.org; Xueguiying
> (Zihan); Linlei (Lei Lin); greg@...ah.com; Yili (Neil); Wangyuhua (Roger,
> Credit); Huqiao; balbi@...com
> Subject: Re: [PATCH 2/2]linux-usb:optimize to match the Huawei USB
> storage devices and support new switch command
> 
> 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.

	Yes, we redefine the SPACE based on our need, and named it "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 ?
	Yes, you are right.
> 
> And shouldn't you read something from the us->recv_bulk_pipe after
> that?
	Well, because our device will re-connect to switch the ports if it receives the command.
	So it is not necessary to read the response of the command.
> 
> > +	US_DEBUGP("transfer actual length=%d, result=%d\n", act_len,
> result);
> > +	return result;
> > +}
> > +
> 
> Sebastian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ