2008-03-10 18:51:08

by Constantin Baranov

[permalink] [raw]
Subject: [PATCH 2.6.25-rc4] usb: add support for Motorola ROKR Z6 cellphone in mass storage mode

From: Constantin Baranov <[email protected]>

Motorola ROKR Z6 cellphone has bugs in its USB, so it is impossible to use
it as mass storage. Patch describes new "unusual" USB device for it with
FIX_INQUIRY and FIX_CAPACITY flags and new BULK_IGNORE_TAG flag.
Last flag relaxes check for equality of bcs->Tag and us->tag in
usb_stor_Bulk_transport routine.

Signed-off-by: Constantin Baranov <[email protected]>
---
drivers/usb/storage/transport.c | 3 ++-
drivers/usb/storage/unusual_devs.h | 10 ++++++++++
include/linux/usb_usual.h | 4 +++-
3 files changed, 15 insertions(+), 2 deletions(-)

diff -upr linux-2.6.25-rc4/drivers/usb/storage/transport.c
linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
--- linux-2.6.25-rc4/drivers/usb/storage/transport.c 2008-03-10
22:09:11.000000000 +0400
+++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
2008-03-10 22:11:24.000000000 +0400
@@ -1009,7 +1009,8 @@ int usb_stor_Bulk_transport(struct scsi_
US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",
le32_to_cpu(bcs->Signature), bcs->Tag,
residue, bcs->Status);
- if (bcs->Tag != us->tag || bcs->Status > US_BULK_STAT_PHASE) {
+ if (!(bcs->Tag == us->tag || (us->flags & US_FL_BULK_IGNORE_TAG)) ||
+ bcs->Status > US_BULK_STAT_PHASE) {
US_DEBUGP("Bulk logical error\n");
return USB_STOR_TRANSPORT_ERROR;
}
diff -upr linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h
linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
--- linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h 2008-03-10
22:09:11.000000000 +0400
+++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
2008-03-10 22:10:40.000000000 +0400
@@ -1589,6 +1589,16 @@ UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),

+/*
+ * Patch by Constantin Baranov <[email protected]>
+ * Report by Andreas Koenecke
+ */
+UNUSUAL_DEV( 0x22b8, 0x6426, 0x0101, 0x0101,
+ "Motorola",
+ "MSnc.",
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
+ US_FL_FIX_INQUIRY | US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG),
+
/* Reported by Radovan Garabik <[email protected]> */
UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
"MPIO",
diff -upr linux-2.6.25-rc4/include/linux/usb_usual.h
linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h
--- linux-2.6.25-rc4/include/linux/usb_usual.h 2008-03-10
22:09:12.000000000 +0400
+++ linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h 2008-03-10
22:10:40.000000000 +0400
@@ -50,7 +50,9 @@
US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \
/* sometimes sizes is too big */ \
US_FLAG(MAX_SECTORS_MIN,0x00002000) \
- /* Sets max_sectors to arch min */
+ /* Sets max_sectors to arch min */ \
+ US_FLAG(BULK_IGNORE_TAG,0x00004000) \
+ /* Ignore tag mismatch in bulk operations */


#define US_FLAG(name, value) US_FL_##name = value ,


2008-03-10 19:02:24

by Matthew Dharm

[permalink] [raw]
Subject: Re: [PATCH 2.6.25-rc4] usb: add support for Motorola ROKR Z6 cellphone in mass storage mode

Are all 3 flags truly needed?

Matt

On Mon, Mar 10, 2008 at 10:39:06PM +0400, Constantin Baranov wrote:
> From: Constantin Baranov <[email protected]>
>
> Motorola ROKR Z6 cellphone has bugs in its USB, so it is impossible to use
> it as mass storage. Patch describes new "unusual" USB device for it with
> FIX_INQUIRY and FIX_CAPACITY flags and new BULK_IGNORE_TAG flag.
> Last flag relaxes check for equality of bcs->Tag and us->tag in
> usb_stor_Bulk_transport routine.
>
> Signed-off-by: Constantin Baranov <[email protected]>
> ---
> drivers/usb/storage/transport.c | 3 ++-
> drivers/usb/storage/unusual_devs.h | 10 ++++++++++
> include/linux/usb_usual.h | 4 +++-
> 3 files changed, 15 insertions(+), 2 deletions(-)
>
> diff -upr linux-2.6.25-rc4/drivers/usb/storage/transport.c
> linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
> --- linux-2.6.25-rc4/drivers/usb/storage/transport.c 2008-03-10
> 22:09:11.000000000 +0400
> +++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
> 2008-03-10 22:11:24.000000000 +0400
> @@ -1009,7 +1009,8 @@ int usb_stor_Bulk_transport(struct scsi_
> US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",
> le32_to_cpu(bcs->Signature), bcs->Tag,
> residue, bcs->Status);
> - if (bcs->Tag != us->tag || bcs->Status > US_BULK_STAT_PHASE) {
> + if (!(bcs->Tag == us->tag || (us->flags & US_FL_BULK_IGNORE_TAG)) ||
> + bcs->Status > US_BULK_STAT_PHASE) {
> US_DEBUGP("Bulk logical error\n");
> return USB_STOR_TRANSPORT_ERROR;
> }
> diff -upr linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h
> linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
> --- linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h 2008-03-10
> 22:09:11.000000000 +0400
> +++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
> 2008-03-10 22:10:40.000000000 +0400
> @@ -1589,6 +1589,16 @@ UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x
> US_SC_DEVICE, US_PR_DEVICE, NULL,
> US_FL_FIX_CAPACITY),
>
> +/*
> + * Patch by Constantin Baranov <[email protected]>
> + * Report by Andreas Koenecke
> + */
> +UNUSUAL_DEV( 0x22b8, 0x6426, 0x0101, 0x0101,
> + "Motorola",
> + "MSnc.",
> + US_SC_DEVICE, US_PR_DEVICE, NULL,
> + US_FL_FIX_INQUIRY | US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG),
> +
> /* Reported by Radovan Garabik <[email protected]> */
> UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
> "MPIO",
> diff -upr linux-2.6.25-rc4/include/linux/usb_usual.h
> linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h
> --- linux-2.6.25-rc4/include/linux/usb_usual.h 2008-03-10
> 22:09:12.000000000 +0400
> +++ linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h 2008-03-10
> 22:10:40.000000000 +0400
> @@ -50,7 +50,9 @@
> US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \
> /* sometimes sizes is too big */ \
> US_FLAG(MAX_SECTORS_MIN,0x00002000) \
> - /* Sets max_sectors to arch min */
> + /* Sets max_sectors to arch min */ \
> + US_FLAG(BULK_IGNORE_TAG,0x00004000) \
> + /* Ignore tag mismatch in bulk operations */
>
>
> #define US_FLAG(name, value) US_FL_##name = value ,
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Matthew Dharm Home: [email protected]
Maintainer, Linux USB Mass Storage Driver

You were using cheat codes too. You guys suck.
-- Greg to General Studebaker
User Friendly, 12/16/1997


Attachments:
(No filename) (3.47 kB)
(No filename) (189.00 B)
Download all attachments

2008-03-10 20:01:01

by Constantin Baranov

[permalink] [raw]
Subject: Re: [PATCH 2.6.25-rc4] usb: add support for Motorola ROKR Z6 cellphone in mass storage mode

Yes. These three flags corresponds to three different bugs
discussed in [email protected]
(http://www.mail-archive.com/[email protected]/msg19167.html)

FIX_INQUIRY: Device always sends PQ=1 in inquiry data, so SCSI subsystem
stops to create sd device.
FIX_CAPACITY: Device tells wrong size of internal memory card
(real size + 1). If one would try to read/write "phantom" sector then
phone hang up and reboot.
BULK_IGNORE_TAG: Sometimes device sends wrong tags causing computer to
reset endpoint. This may corrupt phone's filesystem in particular.

Matthew Dharm wrote:
> Are all 3 flags truly needed?
>
> Matt
>
> On Mon, Mar 10, 2008 at 10:39:06PM +0400, Constantin Baranov wrote:
>> From: Constantin Baranov <[email protected]>
>>
>> Motorola ROKR Z6 cellphone has bugs in its USB, so it is impossible to use
>> it as mass storage. Patch describes new "unusual" USB device for it with
>> FIX_INQUIRY and FIX_CAPACITY flags and new BULK_IGNORE_TAG flag.
>> Last flag relaxes check for equality of bcs->Tag and us->tag in
>> usb_stor_Bulk_transport routine.
>>
>> Signed-off-by: Constantin Baranov <[email protected]>
>> ---
>> drivers/usb/storage/transport.c | 3 ++-
>> drivers/usb/storage/unusual_devs.h | 10 ++++++++++
>> include/linux/usb_usual.h | 4 +++-
>> 3 files changed, 15 insertions(+), 2 deletions(-)
>>
>> diff -upr linux-2.6.25-rc4/drivers/usb/storage/transport.c
>> linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
>> --- linux-2.6.25-rc4/drivers/usb/storage/transport.c 2008-03-10
>> 22:09:11.000000000 +0400
>> +++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
>> 2008-03-10 22:11:24.000000000 +0400
>> @@ -1009,7 +1009,8 @@ int usb_stor_Bulk_transport(struct scsi_
>> US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",
>> le32_to_cpu(bcs->Signature), bcs->Tag,
>> residue, bcs->Status);
>> - if (bcs->Tag != us->tag || bcs->Status > US_BULK_STAT_PHASE) {
>> + if (!(bcs->Tag == us->tag || (us->flags & US_FL_BULK_IGNORE_TAG)) ||
>> + bcs->Status > US_BULK_STAT_PHASE) {
>> US_DEBUGP("Bulk logical error\n");
>> return USB_STOR_TRANSPORT_ERROR;
>> }
>> diff -upr linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h
>> linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
>> --- linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h 2008-03-10
>> 22:09:11.000000000 +0400
>> +++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
>> 2008-03-10 22:10:40.000000000 +0400
>> @@ -1589,6 +1589,16 @@ UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x
>> US_SC_DEVICE, US_PR_DEVICE, NULL,
>> US_FL_FIX_CAPACITY),
>>
>> +/*
>> + * Patch by Constantin Baranov <[email protected]>
>> + * Report by Andreas Koenecke
>> + */
>> +UNUSUAL_DEV( 0x22b8, 0x6426, 0x0101, 0x0101,
>> + "Motorola",
>> + "MSnc.",
>> + US_SC_DEVICE, US_PR_DEVICE, NULL,
>> + US_FL_FIX_INQUIRY | US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG),
>> +
>> /* Reported by Radovan Garabik <[email protected]> */
>> UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
>> "MPIO",
>> diff -upr linux-2.6.25-rc4/include/linux/usb_usual.h
>> linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h
>> --- linux-2.6.25-rc4/include/linux/usb_usual.h 2008-03-10
>> 22:09:12.000000000 +0400
>> +++ linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h 2008-03-10
>> 22:10:40.000000000 +0400
>> @@ -50,7 +50,9 @@
>> US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \
>> /* sometimes sizes is too big */ \
>> US_FLAG(MAX_SECTORS_MIN,0x00002000) \
>> - /* Sets max_sectors to arch min */
>> + /* Sets max_sectors to arch min */ \
>> + US_FLAG(BULK_IGNORE_TAG,0x00004000) \
>> + /* Ignore tag mismatch in bulk operations */
>>
>>
>> #define US_FLAG(name, value) US_FL_##name = value ,
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2008-03-11 06:30:37

by Matthew Dharm

[permalink] [raw]
Subject: Re: [PATCH 2.6.25-rc4] usb: add support for Motorola ROKR Z6 cellphone in mass storage mode

One last question:

If it's a ROKR Z6, why does the string in unusual_devs.h say "MSnc."?

Matt

On Mon, Mar 10, 2008 at 11:52:19PM +0400, Constantin Baranov wrote:
> Yes. These three flags corresponds to three different bugs
> discussed in [email protected]
> (http://www.mail-archive.com/[email protected]/msg19167.html)
>
> FIX_INQUIRY: Device always sends PQ=1 in inquiry data, so SCSI subsystem
> stops to create sd device.
> FIX_CAPACITY: Device tells wrong size of internal memory card
> (real size + 1). If one would try to read/write "phantom" sector then
> phone hang up and reboot.
> BULK_IGNORE_TAG: Sometimes device sends wrong tags causing computer to
> reset endpoint. This may corrupt phone's filesystem in particular.
>
> Matthew Dharm wrote:
> > Are all 3 flags truly needed?
> >
> > Matt
> >
> > On Mon, Mar 10, 2008 at 10:39:06PM +0400, Constantin Baranov wrote:
> >> From: Constantin Baranov <[email protected]>
> >>
> >> Motorola ROKR Z6 cellphone has bugs in its USB, so it is impossible to use
> >> it as mass storage. Patch describes new "unusual" USB device for it with
> >> FIX_INQUIRY and FIX_CAPACITY flags and new BULK_IGNORE_TAG flag.
> >> Last flag relaxes check for equality of bcs->Tag and us->tag in
> >> usb_stor_Bulk_transport routine.
> >>
> >> Signed-off-by: Constantin Baranov <[email protected]>
> >> ---
> >> drivers/usb/storage/transport.c | 3 ++-
> >> drivers/usb/storage/unusual_devs.h | 10 ++++++++++
> >> include/linux/usb_usual.h | 4 +++-
> >> 3 files changed, 15 insertions(+), 2 deletions(-)
> >>
> >> diff -upr linux-2.6.25-rc4/drivers/usb/storage/transport.c
> >> linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
> >> --- linux-2.6.25-rc4/drivers/usb/storage/transport.c 2008-03-10
> >> 22:09:11.000000000 +0400
> >> +++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
> >> 2008-03-10 22:11:24.000000000 +0400
> >> @@ -1009,7 +1009,8 @@ int usb_stor_Bulk_transport(struct scsi_
> >> US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",
> >> le32_to_cpu(bcs->Signature), bcs->Tag,
> >> residue, bcs->Status);
> >> - if (bcs->Tag != us->tag || bcs->Status > US_BULK_STAT_PHASE) {
> >> + if (!(bcs->Tag == us->tag || (us->flags & US_FL_BULK_IGNORE_TAG)) ||
> >> + bcs->Status > US_BULK_STAT_PHASE) {
> >> US_DEBUGP("Bulk logical error\n");
> >> return USB_STOR_TRANSPORT_ERROR;
> >> }
> >> diff -upr linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h
> >> linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
> >> --- linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h 2008-03-10
> >> 22:09:11.000000000 +0400
> >> +++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
> >> 2008-03-10 22:10:40.000000000 +0400
> >> @@ -1589,6 +1589,16 @@ UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x
> >> US_SC_DEVICE, US_PR_DEVICE, NULL,
> >> US_FL_FIX_CAPACITY),
> >>
> >> +/*
> >> + * Patch by Constantin Baranov <[email protected]>
> >> + * Report by Andreas Koenecke
> >> + */
> >> +UNUSUAL_DEV( 0x22b8, 0x6426, 0x0101, 0x0101,
> >> + "Motorola",
> >> + "MSnc.",
> >> + US_SC_DEVICE, US_PR_DEVICE, NULL,
> >> + US_FL_FIX_INQUIRY | US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG),
> >> +
> >> /* Reported by Radovan Garabik <[email protected]> */
> >> UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
> >> "MPIO",
> >> diff -upr linux-2.6.25-rc4/include/linux/usb_usual.h
> >> linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h
> >> --- linux-2.6.25-rc4/include/linux/usb_usual.h 2008-03-10
> >> 22:09:12.000000000 +0400
> >> +++ linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h 2008-03-10
> >> 22:10:40.000000000 +0400
> >> @@ -50,7 +50,9 @@
> >> US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \
> >> /* sometimes sizes is too big */ \
> >> US_FLAG(MAX_SECTORS_MIN,0x00002000) \
> >> - /* Sets max_sectors to arch min */
> >> + /* Sets max_sectors to arch min */ \
> >> + US_FLAG(BULK_IGNORE_TAG,0x00004000) \
> >> + /* Ignore tag mismatch in bulk operations */
> >>
> >>
> >> #define US_FLAG(name, value) US_FL_##name = value ,
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> >> the body of a message to [email protected]
> >> More majordomo info at http://vger.kernel.org/majordomo-info.html
> >

--
Matthew Dharm Home: [email protected]
Maintainer, Linux USB Mass Storage Driver

G: Money isn't everything, A.J.
AJ: Who convinced you of that?
G: The Chief, at my last salary review.
-- Mike and Greg
User Friendly, 11/3/1998


Attachments:
(No filename) (4.54 kB)
(No filename) (189.00 B)
Download all attachments

2008-03-11 07:02:48

by Constantin Baranov

[permalink] [raw]
Subject: Re: [PATCH 2.6.25-rc4] usb: add support for Motorola ROKR Z6 cellphone in mass storage mode

I have just copied identification strings from the phone.
FIX_INQUIRY causes kernel to use vendor/product strings from
unusual_devs.h instead of from device's inquiry data.
And I'd like not to change the reality without any reason.

Matthew Dharm wrote:
> One last question:
>
> If it's a ROKR Z6, why does the string in unusual_devs.h say "MSnc."?
>
> Matt
>
> On Mon, Mar 10, 2008 at 11:52:19PM +0400, Constantin Baranov wrote:
>> Yes. These three flags corresponds to three different bugs
>> discussed in [email protected]
>> (http://www.mail-archive.com/[email protected]/msg19167.html)
>>
>> FIX_INQUIRY: Device always sends PQ=1 in inquiry data, so SCSI subsystem
>> stops to create sd device.
>> FIX_CAPACITY: Device tells wrong size of internal memory card
>> (real size + 1). If one would try to read/write "phantom" sector then
>> phone hang up and reboot.
>> BULK_IGNORE_TAG: Sometimes device sends wrong tags causing computer to
>> reset endpoint. This may corrupt phone's filesystem in particular.
>>
>> Matthew Dharm wrote:
>>> Are all 3 flags truly needed?
>>>
>>> Matt
>>>
>>> On Mon, Mar 10, 2008 at 10:39:06PM +0400, Constantin Baranov wrote:
>>>> From: Constantin Baranov <[email protected]>
>>>>
>>>> Motorola ROKR Z6 cellphone has bugs in its USB, so it is impossible to use
>>>> it as mass storage. Patch describes new "unusual" USB device for it with
>>>> FIX_INQUIRY and FIX_CAPACITY flags and new BULK_IGNORE_TAG flag.
>>>> Last flag relaxes check for equality of bcs->Tag and us->tag in
>>>> usb_stor_Bulk_transport routine.
>>>>
>>>> Signed-off-by: Constantin Baranov <[email protected]>
>>>> ---
>>>> drivers/usb/storage/transport.c | 3 ++-
>>>> drivers/usb/storage/unusual_devs.h | 10 ++++++++++
>>>> include/linux/usb_usual.h | 4 +++-
>>>> 3 files changed, 15 insertions(+), 2 deletions(-)
>>>>
>>>> diff -upr linux-2.6.25-rc4/drivers/usb/storage/transport.c
>>>> linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
>>>> --- linux-2.6.25-rc4/drivers/usb/storage/transport.c 2008-03-10
>>>> 22:09:11.000000000 +0400
>>>> +++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
>>>> 2008-03-10 22:11:24.000000000 +0400
>>>> @@ -1009,7 +1009,8 @@ int usb_stor_Bulk_transport(struct scsi_
>>>> US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",
>>>> le32_to_cpu(bcs->Signature), bcs->Tag,
>>>> residue, bcs->Status);
>>>> - if (bcs->Tag != us->tag || bcs->Status > US_BULK_STAT_PHASE) {
>>>> + if (!(bcs->Tag == us->tag || (us->flags & US_FL_BULK_IGNORE_TAG)) ||
>>>> + bcs->Status > US_BULK_STAT_PHASE) {
>>>> US_DEBUGP("Bulk logical error\n");
>>>> return USB_STOR_TRANSPORT_ERROR;
>>>> }
>>>> diff -upr linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h
>>>> linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
>>>> --- linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h 2008-03-10
>>>> 22:09:11.000000000 +0400
>>>> +++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
>>>> 2008-03-10 22:10:40.000000000 +0400
>>>> @@ -1589,6 +1589,16 @@ UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x
>>>> US_SC_DEVICE, US_PR_DEVICE, NULL,
>>>> US_FL_FIX_CAPACITY),
>>>>
>>>> +/*
>>>> + * Patch by Constantin Baranov <[email protected]>
>>>> + * Report by Andreas Koenecke
>>>> + */
>>>> +UNUSUAL_DEV( 0x22b8, 0x6426, 0x0101, 0x0101,
>>>> + "Motorola",
>>>> + "MSnc.",
>>>> + US_SC_DEVICE, US_PR_DEVICE, NULL,
>>>> + US_FL_FIX_INQUIRY | US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG),
>>>> +
>>>> /* Reported by Radovan Garabik <[email protected]> */
>>>> UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
>>>> "MPIO",
>>>> diff -upr linux-2.6.25-rc4/include/linux/usb_usual.h
>>>> linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h
>>>> --- linux-2.6.25-rc4/include/linux/usb_usual.h 2008-03-10
>>>> 22:09:12.000000000 +0400
>>>> +++ linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h 2008-03-10
>>>> 22:10:40.000000000 +0400
>>>> @@ -50,7 +50,9 @@
>>>> US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \
>>>> /* sometimes sizes is too big */ \
>>>> US_FLAG(MAX_SECTORS_MIN,0x00002000) \
>>>> - /* Sets max_sectors to arch min */
>>>> + /* Sets max_sectors to arch min */ \
>>>> + US_FLAG(BULK_IGNORE_TAG,0x00004000) \
>>>> + /* Ignore tag mismatch in bulk operations */
>>>>
>>>>
>>>> #define US_FLAG(name, value) US_FL_##name = value ,
>>>>
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
>>>> the body of a message to [email protected]
>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2008-03-11 15:00:58

by Matthew Dharm

[permalink] [raw]
Subject: Re: [PATCH 2.6.25-rc4] usb: add support for Motorola ROKR Z6 cellphone in mass storage mode

That's reasonable. But you should then update the comment in
unusual_devs.h so that people looking at the file know it's for the ROKR
Z6.

If you change that, I'll sign off on the patch.

Matt

On Tue, Mar 11, 2008 at 11:02:35AM +0400, Constantin Baranov wrote:
> I have just copied identification strings from the phone.
> FIX_INQUIRY causes kernel to use vendor/product strings from
> unusual_devs.h instead of from device's inquiry data.
> And I'd like not to change the reality without any reason.
>
> Matthew Dharm wrote:
> > One last question:
> >
> > If it's a ROKR Z6, why does the string in unusual_devs.h say "MSnc."?
> >
> > Matt
> >
> > On Mon, Mar 10, 2008 at 11:52:19PM +0400, Constantin Baranov wrote:
> >> Yes. These three flags corresponds to three different bugs
> >> discussed in [email protected]
> >> (http://www.mail-archive.com/[email protected]/msg19167.html)
> >>
> >> FIX_INQUIRY: Device always sends PQ=1 in inquiry data, so SCSI subsystem
> >> stops to create sd device.
> >> FIX_CAPACITY: Device tells wrong size of internal memory card
> >> (real size + 1). If one would try to read/write "phantom" sector then
> >> phone hang up and reboot.
> >> BULK_IGNORE_TAG: Sometimes device sends wrong tags causing computer to
> >> reset endpoint. This may corrupt phone's filesystem in particular.
> >>
> >> Matthew Dharm wrote:
> >>> Are all 3 flags truly needed?
> >>>
> >>> Matt
> >>>
> >>> On Mon, Mar 10, 2008 at 10:39:06PM +0400, Constantin Baranov wrote:
> >>>> From: Constantin Baranov <[email protected]>
> >>>>
> >>>> Motorola ROKR Z6 cellphone has bugs in its USB, so it is impossible to use
> >>>> it as mass storage. Patch describes new "unusual" USB device for it with
> >>>> FIX_INQUIRY and FIX_CAPACITY flags and new BULK_IGNORE_TAG flag.
> >>>> Last flag relaxes check for equality of bcs->Tag and us->tag in
> >>>> usb_stor_Bulk_transport routine.
> >>>>
> >>>> Signed-off-by: Constantin Baranov <[email protected]>
> >>>> ---
> >>>> drivers/usb/storage/transport.c | 3 ++-
> >>>> drivers/usb/storage/unusual_devs.h | 10 ++++++++++
> >>>> include/linux/usb_usual.h | 4 +++-
> >>>> 3 files changed, 15 insertions(+), 2 deletions(-)
> >>>>
> >>>> diff -upr linux-2.6.25-rc4/drivers/usb/storage/transport.c
> >>>> linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
> >>>> --- linux-2.6.25-rc4/drivers/usb/storage/transport.c 2008-03-10
> >>>> 22:09:11.000000000 +0400
> >>>> +++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
> >>>> 2008-03-10 22:11:24.000000000 +0400
> >>>> @@ -1009,7 +1009,8 @@ int usb_stor_Bulk_transport(struct scsi_
> >>>> US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",
> >>>> le32_to_cpu(bcs->Signature), bcs->Tag,
> >>>> residue, bcs->Status);
> >>>> - if (bcs->Tag != us->tag || bcs->Status > US_BULK_STAT_PHASE) {
> >>>> + if (!(bcs->Tag == us->tag || (us->flags & US_FL_BULK_IGNORE_TAG)) ||
> >>>> + bcs->Status > US_BULK_STAT_PHASE) {
> >>>> US_DEBUGP("Bulk logical error\n");
> >>>> return USB_STOR_TRANSPORT_ERROR;
> >>>> }
> >>>> diff -upr linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h
> >>>> linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
> >>>> --- linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h 2008-03-10
> >>>> 22:09:11.000000000 +0400
> >>>> +++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
> >>>> 2008-03-10 22:10:40.000000000 +0400
> >>>> @@ -1589,6 +1589,16 @@ UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x
> >>>> US_SC_DEVICE, US_PR_DEVICE, NULL,
> >>>> US_FL_FIX_CAPACITY),
> >>>>
> >>>> +/*
> >>>> + * Patch by Constantin Baranov <[email protected]>
> >>>> + * Report by Andreas Koenecke
> >>>> + */
> >>>> +UNUSUAL_DEV( 0x22b8, 0x6426, 0x0101, 0x0101,
> >>>> + "Motorola",
> >>>> + "MSnc.",
> >>>> + US_SC_DEVICE, US_PR_DEVICE, NULL,
> >>>> + US_FL_FIX_INQUIRY | US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG),
> >>>> +
> >>>> /* Reported by Radovan Garabik <[email protected]> */
> >>>> UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
> >>>> "MPIO",
> >>>> diff -upr linux-2.6.25-rc4/include/linux/usb_usual.h
> >>>> linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h
> >>>> --- linux-2.6.25-rc4/include/linux/usb_usual.h 2008-03-10
> >>>> 22:09:12.000000000 +0400
> >>>> +++ linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h 2008-03-10
> >>>> 22:10:40.000000000 +0400
> >>>> @@ -50,7 +50,9 @@
> >>>> US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \
> >>>> /* sometimes sizes is too big */ \
> >>>> US_FLAG(MAX_SECTORS_MIN,0x00002000) \
> >>>> - /* Sets max_sectors to arch min */
> >>>> + /* Sets max_sectors to arch min */ \
> >>>> + US_FLAG(BULK_IGNORE_TAG,0x00004000) \
> >>>> + /* Ignore tag mismatch in bulk operations */
> >>>>
> >>>>
> >>>> #define US_FLAG(name, value) US_FL_##name = value ,
> >>>>
> >>>> --
> >>>> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> >>>> the body of a message to [email protected]
> >>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
> >

--
Matthew Dharm Home: [email protected]
Maintainer, Linux USB Mass Storage Driver

What, are you one of those Microsoft-bashing Linux freaks?
-- Customer to Greg
User Friendly, 2/10/1999


Attachments:
(No filename) (5.23 kB)
(No filename) (189.00 B)
Download all attachments

2008-03-11 18:27:19

by Constantin Baranov

[permalink] [raw]
Subject: [PATCH 2.6.25-rc4] usb: add support for Motorola ROKR Z6 cellphone in mass storage mode

From: Constantin Baranov <[email protected]>

Motorola ROKR Z6 cellphone has bugs in its USB, so it is impossible to use
it as mass storage. Patch describes new "unusual" USB device for it with
FIX_INQUIRY and FIX_CAPACITY flags and new BULK_IGNORE_TAG flag.
Last flag relaxes check for equality of bcs->Tag and us->tag in
usb_stor_Bulk_transport routine.

Signed-off-by: Constantin Baranov <[email protected]>
---
drivers/usb/storage/transport.c | 3 ++-
drivers/usb/storage/unusual_devs.h | 11 +++++++++++
include/linux/usb_usual.h | 4 +++-
3 files changed, 16 insertions(+), 2 deletions(-)

diff -upr linux-2.6.25-rc4/drivers/usb/storage/transport.c
linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
--- linux-2.6.25-rc4/drivers/usb/storage/transport.c 2008-03-11
22:08:20.000000000 +0400
+++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
2008-03-11 22:09:42.000000000 +0400
@@ -1009,7 +1009,8 @@ int usb_stor_Bulk_transport(struct scsi_
US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",
le32_to_cpu(bcs->Signature), bcs->Tag,
residue, bcs->Status);
- if (bcs->Tag != us->tag || bcs->Status > US_BULK_STAT_PHASE) {
+ if (!(bcs->Tag == us->tag || (us->flags & US_FL_BULK_IGNORE_TAG)) ||
+ bcs->Status > US_BULK_STAT_PHASE) {
US_DEBUGP("Bulk logical error\n");
return USB_STOR_TRANSPORT_ERROR;
}
diff -upr linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h
linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
--- linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h 2008-03-11
22:08:20.000000000 +0400
+++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
2008-03-11 22:14:59.000000000 +0400
@@ -1589,6 +1589,17 @@ UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),

+/*
+ * Patch by Constantin Baranov <[email protected]>
+ * Report by Andreas Koenecke.
+ * Motorola ROKR Z6.
+ */
+UNUSUAL_DEV( 0x22b8, 0x6426, 0x0101, 0x0101,
+ "Motorola",
+ "MSnc.",
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
+ US_FL_FIX_INQUIRY | US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG),
+
/* Reported by Radovan Garabik <[email protected]> */
UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
"MPIO",
diff -upr linux-2.6.25-rc4/include/linux/usb_usual.h
linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h
--- linux-2.6.25-rc4/include/linux/usb_usual.h 2008-03-11
22:08:21.000000000 +0400
+++ linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h 2008-03-11
22:09:42.000000000 +0400
@@ -50,7 +50,9 @@
US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \
/* sometimes sizes is too big */ \
US_FLAG(MAX_SECTORS_MIN,0x00002000) \
- /* Sets max_sectors to arch min */
+ /* Sets max_sectors to arch min */ \
+ US_FLAG(BULK_IGNORE_TAG,0x00004000) \
+ /* Ignore tag mismatch in bulk operations */


#define US_FLAG(name, value) US_FL_##name = value ,

2008-03-11 18:29:50

by Matthew Dharm

[permalink] [raw]
Subject: Re: [PATCH 2.6.25-rc4] usb: add support for Motorola ROKR Z6 cellphone in mass storage mode

Signed-off-by: Matthew Dharm <[email protected]>

Greg, please apply.

Matt

On Tue, Mar 11, 2008 at 10:27:03PM +0400, Constantin Baranov wrote:
> From: Constantin Baranov <[email protected]>
>
> Motorola ROKR Z6 cellphone has bugs in its USB, so it is impossible to use
> it as mass storage. Patch describes new "unusual" USB device for it with
> FIX_INQUIRY and FIX_CAPACITY flags and new BULK_IGNORE_TAG flag.
> Last flag relaxes check for equality of bcs->Tag and us->tag in
> usb_stor_Bulk_transport routine.
>
> Signed-off-by: Constantin Baranov <[email protected]>
> ---
> drivers/usb/storage/transport.c | 3 ++-
> drivers/usb/storage/unusual_devs.h | 11 +++++++++++
> include/linux/usb_usual.h | 4 +++-
> 3 files changed, 16 insertions(+), 2 deletions(-)
>
> diff -upr linux-2.6.25-rc4/drivers/usb/storage/transport.c
> linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
> --- linux-2.6.25-rc4/drivers/usb/storage/transport.c 2008-03-11
> 22:08:20.000000000 +0400
> +++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/transport.c
> 2008-03-11 22:09:42.000000000 +0400
> @@ -1009,7 +1009,8 @@ int usb_stor_Bulk_transport(struct scsi_
> US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",
> le32_to_cpu(bcs->Signature), bcs->Tag,
> residue, bcs->Status);
> - if (bcs->Tag != us->tag || bcs->Status > US_BULK_STAT_PHASE) {
> + if (!(bcs->Tag == us->tag || (us->flags & US_FL_BULK_IGNORE_TAG)) ||
> + bcs->Status > US_BULK_STAT_PHASE) {
> US_DEBUGP("Bulk logical error\n");
> return USB_STOR_TRANSPORT_ERROR;
> }
> diff -upr linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h
> linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
> --- linux-2.6.25-rc4/drivers/usb/storage/unusual_devs.h 2008-03-11
> 22:08:20.000000000 +0400
> +++ linux-2.6.25-rc4-motorokr_z6/drivers/usb/storage/unusual_devs.h
> 2008-03-11 22:14:59.000000000 +0400
> @@ -1589,6 +1589,17 @@ UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x
> US_SC_DEVICE, US_PR_DEVICE, NULL,
> US_FL_FIX_CAPACITY),
>
> +/*
> + * Patch by Constantin Baranov <[email protected]>
> + * Report by Andreas Koenecke.
> + * Motorola ROKR Z6.
> + */
> +UNUSUAL_DEV( 0x22b8, 0x6426, 0x0101, 0x0101,
> + "Motorola",
> + "MSnc.",
> + US_SC_DEVICE, US_PR_DEVICE, NULL,
> + US_FL_FIX_INQUIRY | US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG),
> +
> /* Reported by Radovan Garabik <[email protected]> */
> UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
> "MPIO",
> diff -upr linux-2.6.25-rc4/include/linux/usb_usual.h
> linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h
> --- linux-2.6.25-rc4/include/linux/usb_usual.h 2008-03-11
> 22:08:21.000000000 +0400
> +++ linux-2.6.25-rc4-motorokr_z6/include/linux/usb_usual.h 2008-03-11
> 22:09:42.000000000 +0400
> @@ -50,7 +50,9 @@
> US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \
> /* sometimes sizes is too big */ \
> US_FLAG(MAX_SECTORS_MIN,0x00002000) \
> - /* Sets max_sectors to arch min */
> + /* Sets max_sectors to arch min */ \
> + US_FLAG(BULK_IGNORE_TAG,0x00004000) \
> + /* Ignore tag mismatch in bulk operations */
>
>
> #define US_FLAG(name, value) US_FL_##name = value ,
>

--
Matthew Dharm Home: [email protected]
Maintainer, Linux USB Mass Storage Driver

C: Like the Furby?
DP: He gives me the creeps. Think the SPCA will take him?
-- Cobb and Dust Puppy
User Friendly, 1/2/1999


Attachments:
(No filename) (3.37 kB)
(No filename) (189.00 B)
Download all attachments