Bug 121105

Summary: [patch] USB storage detected, but inaccessible
Product: [Fedora] Fedora Reporter: Aleksey Nogin <aleksey>
Component: kernelAssignee: Pete Zaitcev <zaitcev>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: wtogami, zaitcev
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://linux.bkbits.net:8080/linux-2.5/cset@4097a5f543zLiP03I-UHaBQxnuCsRQ
Whiteboard:
Fixed In Version: 2.6.6-1.427 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-06-13 06:33:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to scsi_scan that solves this problem none

Description Aleksey Nogin 2004-04-17 08:55:43 UTC
When I connect my FujiFilm FinePix 3800 and turn it on, logs get:

usb 1-1: new full speed USB device using address 8
SCSI subsystem initialized
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
USB Mass Storage device found at 8
drivers/usb/core/usb.c: registered new driver usb-storage
USB Mass Storage support registered.

and the usb_storage and scsi_mod modules get loaded. However, the
camera does not seem to get "attached" to any specific /dev/xyz (or
/udev/xyz for that matter) - e.g. when I try to access /dev/sda, I get
"No such device or address".

% cat /proc/scsi/scsi
Attached devices:

% cat /proc/scsi/usb-storage/0
   Host scsi0: usb-storage
       Vendor: Unknown
      Product: USB Mass Storage
Serial Number: Y-406^^^^^030528XFPX0007040092
     Protocol: 8070i
    Transport: Control/Bulk/Interrupt
       Quirks:

% cat /proc/bus/usb/devices

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.06
S:  Manufacturer=Linux 2.6.5-1.319custom uhci_hcd
S:  Product=UHCI Host Controller
S:  SerialNumber=0000:00:1d.0
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  8 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=04cb ProdID=011a Rev=10.00
S:  Product=USB Mass Storage
S:  SerialNumber=Y-406^^^^^030528XFPX0007040092
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=08(stor.) Sub=05 Prot=00 Driver=usb-storage
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=83(I) Atr=03(Int.) MxPS=   8 Ivl=1ms

I tried both 2.6.5-1.322 and 2.6.5-1.319custom (kernel-source
recompiled using stock config-i686 with 4G and 4G+4G disabled, APM
disabled, SOFTWARE_SUSPEND enabled).

Am I doing something wrong? Or is this a bug (and should be reported)?
Is there some way to make it work? Thanks a lot for any help.

P.S. Other USB devices (printer, mouse) work OK.

Comment 1 Warren Togami 2004-04-18 20:16:09 UTC
Has this worked with any previous kernel?

Comment 2 Aleksey Nogin 2004-04-19 00:09:39 UTC
I do not know as I have not used my camera for a few months.

Comment 3 Warren Togami 2004-04-19 00:24:57 UTC
Please search LKML and Google, and perhaps ask on USB or camera
oriented mailing lists to see if anybody else found a fix yet.  It is
unlikely Red Hat can look at this problem before FC2, but if you find
the fix it is more likely it can be included.


Comment 4 Aleksey Nogin 2004-04-19 09:14:45 UTC
I tried searching and I just emailed linux-usb-users list. Have not
found anything useful yet... 

How do I go about debugging this? I do not understand how it is
possible that (according to /proc/scsi/usb-storage/0) usb-storage
knows there is a USB storage device attached, does not propagate that
to the SCSI subsystem (at least it does not make it to
/proc/scsi/scsi) and still it does not print any error messages that
would explain why it failed to do so?

Comment 5 Aleksey Nogin 2004-04-20 05:23:27 UTC
I have compiled 2.6.5-1.327 with CONFIG_USB_STORAGE_DEBUG enambled.
Now when I plugged the camera I saw the following:

usb 1-1.3: new full speed USB device using address 5
Initializing USB Mass Storage driver...
usb-storage: USB Mass Storage device detected
usb-storage: altsetting is 0, id_index is 112
usb-storage: -- associate_dev
usb-storage: Transport: Control/Bulk/Interrupt
usb-storage: Protocol: 8070i
usb-storage: Endpoints: In: 0xdfc3c2c0 Out: 0xdfc3c2d4 Int: 0xdfc3c2e8
(Period 1)
usb-storage: *** thread sleeping.
scsi0 : SCSI emulation for USB Mass Storage devices
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Command INQUIRY (6 bytes)
usb-storage:  12 00 00 00 24 00
usb-storage: usb_stor_ctrl_transfer: rq=00 rqtype=21 value=0000
index=00 len=12
usb-storage: Status code 0; transferred 12/12
usb-storage: -- transfer complete
usb-storage: Call to usb_stor_ctrl_transfer() returned 0
usb-storage: usb_stor_bulk_transfer_buf: xfer 36 bytes
usb-storage: Status code 0; transferred 36/36
usb-storage: -- transfer complete
usb-storage: CBI data stage result is 0x0
usb-storage: usb_stor_intr_transfer: xfer 2 bytes
usb-storage: Status code 0; transferred 2/2
usb-storage: -- transfer complete
usb-storage: Got interrupt data (0x29, 0x0)
usb-storage: CBI IRQ data showed reserved bType 0x29
usb-storage: usb_stor_control_msg: rq=01 rqtype=02 value=0000 index=81
len=0
usb-storage: usb_stor_clear_halt: result = 0
usb-storage: -- transport indicates command failure
usb-storage: Issuing auto-REQUEST_SENSE
usb-storage: usb_stor_ctrl_transfer: rq=00 rqtype=21 value=0000
index=00 len=12
usb-storage: Status code 0; transferred 12/12
usb-storage: -- transfer complete
usb-storage: Call to usb_stor_ctrl_transfer() returned 0
usb-storage: usb_stor_bulk_transfer_buf: xfer 18 bytes
usb-storage: Status code 0; transferred 18/18
usb-storage: -- transfer complete
usb-storage: CBI data stage result is 0x0
usb-storage: usb_stor_intr_transfer: xfer 2 bytes
usb-storage: Status code 0; transferred 2/2
usb-storage: -- transfer complete
usb-storage: Got interrupt data (0x0, 0x0)
usb-storage: -- Result from auto-sense is 0
usb-storage: -- code: 0x70, key: 0x6, ASC: 0x29, ASCQ: 0x0
usb-storage: Unit Attention: Power on, reset, or bus device reset occurred
usb-storage: scsi cmd done, result=0x2
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (1:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (2:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (3:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (4:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (5:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (6:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (7:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
USB Mass Storage device found at 5
usbcore: registered new driver usb-storage
USB Mass Storage support registered.

Does this help? Any hints what to try next? Thanks a lot!

Comment 6 Aleksey Nogin 2004-04-20 07:26:13 UTC
*** Partial success ***

I have been successfull in making camera work, but _only_ when it is
connected directly to the computer, not via a hub with other devices
attached.

My setup (which used to work under FC1) is a follows: I have an
external hub connected to my laptop and I have a mouse, a printer and
the camera is question connected to the hub. 

I have tried the following:

0) Using it w/o any changes to the kernel - both via hub and
connecting directly. It did not work (see previous comments for details).

1) I added an entry to unusual_dev.h for the camera with the following:

US_SC_DEVICE, US_PR_CB, NULL, 0

and connecting the camera via the hub. After that the camera would be
recognized fine, but once I have coipied about 300KB of data off of
it, the whole USB hub would go "crazy", the copying would get stuck,
then it would think that _all_ the devices (mouse, etc) somehow
disappeared, then it would start crashing.

2) I tried using US_PR_BULK instead of CB - the device would not be
recognized by SCSI (with somewhat different messages than in 0).

3) I tried using

US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY

but still connecting via the hub. The results were pretty much the
same as in case 1.

4) I tried using the same line as in 3, but this time connection
directly (and not plugging any other USB devices). This time it worked
perfectly!

P.S. While it is still far from working correctly, I do have a
workaround that sort of works for me. I would be happy to participate
in debugging it further, but this is as far as I am willing to
experiment on my own without any help from somebody more knowledgeable
than I am.

Comment 7 Aleksey Nogin 2004-04-20 20:45:11 UTC
The relevant usb-linux-devel thread is at
http://marc.theaimsgroup.com/?t=108248734000003&r=1&w=2

Comment 8 Aleksey Nogin 2004-04-21 19:52:14 UTC
Created attachment 99611 [details]
Patch to scsi_scan that solves this problem

Alan Stern (stern at rowland.harvard.edu) figured out how to solve this problem
- patch attached. The camera still only works correctly when attached directly
and gets stuck when attached via a hub, but that appears to be a separate
problem.

Comment 9 Warren Togami 2004-04-21 21:29:55 UTC
okay, now convince upstream to include this patch in vanilla.

Comment 10 Pete Zaitcev 2004-04-21 22:04:27 UTC
Dharm is still the key person, even if Stern drops the ball
either Alexey or I should keep on it. Don't close the bug
until this recirculates through upstream and returns.



Comment 11 Aleksey Nogin 2004-05-12 07:23:10 UTC
The bitkeeper URL for this fix is
http://linux.bkbits.net:8080/linux-2.5/cset@4097a5f543zLiP03I-UHaBQxnuCsRQ

Comment 12 Aleksey Nogin 2004-06-13 06:33:59 UTC
This patch is included in 2.6.6-1.427.