Alan Stern wrote:

On Thu, 28 Aug 2003, Roe Peterson wrote:



These two patches make the NZ90 memory stick import work correctly as a usb-storage
device under RedHat 8 running kernel 2.4.20-18.8. - and will probably work under 2.4.20-20...


nz90-usb-storage.patch:
- the NZ90 doesn't like seeing prevent/allow medium removal commands, so I've just
stopped sending them. I should probably have a little more smarts here (only skip them
when dealing with an NZ90), but I'm a bit lazy... and the NZ is the only USB storage
device I have...



Does it identify itself (in its INQUIRY response) as having removeable media? If not, this is somewhat understandable -- the SCSI layer shouldn't send these commands to nonremoveable devices. I believe this has been fixed in 2.6. But if the NZ90 says the media _is_ removeable then it should be able to handle the PREVENT-ALLOW-MEDIUM-REMOVAL command.



Actually, it does identify itself as removable - definitely a bug in the nz90.


- on the _very_first_ inquiry command after MS-import has started, the NZ90 returns
Unit Attention, Check condition, Transition from not-ready to ready. This (incorrectly,
IMHO) caused the transport system to lock the device. The patch arranges for the INQUIRY
to always trigger a REQUEST SENSE, reading and clearing the condition, and to ignore
the incorrect error status.



That's a bug in the NZ90 -- INQUIRY is _not_ supposed to trigger Unit Attention (according to the SCSI-2 standard). On the other hand, if INQUIRY doesn't do it then some later command like READ-CAPACITY will.


I'm beginning to think this could have something to do with the NZ90 identifying
itself as an ATA device instead of a transparent scsi device. Here's the first trace:


14:02:21 tbolt kernel: usb-storage: Command INQUIRY (6 bytes)
Aug 20 14:02:21 tbolt kernel: usb-storage: 12 00 00 00 ff 00 76 f6 2b db 1a c0
Aug 20 14:02:21 tbolt kernel: usb-storage: Call to usb_stor_control_msg() returned 12
Aug 20 14:02:21 tbolt kernel: usb-storage: usb_stor_transfer_partial(): xfer 255 bytes
Aug 20 14:02:21 tbolt kernel: usb-storage: USB IRQ received for device on host 1
Aug 20 14:02:21 tbolt kernel: usb-storage: -- IRQ data length is 2
Aug 20 14:02:21 tbolt kernel: usb-storage: -- IRQ state is 0
Aug 20 14:02:21 tbolt kernel: usb-storage: -- Interrupt Status (0x28, 0x0)
Aug 20 14:02:21 tbolt kernel: usb-storage: -- not a command-completion IRQ


This status (0x28) appears ONLY to happen if unit attention is being raised.

In any case, the result afterwards was:

Aug 20 14:02:21 tbolt kernel: usb-storage: usb_stor_bulk_msg() returned 0 xferred 56/255
Aug 20 14:02:21 tbolt kernel: usb-storage: CBI data stage result is 0x1
Aug 20 14:02:21 tbolt kernel: usb-storage: Current value of ip_waitq is: 0
Aug 20 14:02:27 tbolt kernel: usb-storage: command_abort() called
Aug 20 14:02:27 tbolt kernel: usb-storage: -- simulating missing IRQ
Aug 20 14:02:27 tbolt kernel: usb-storage: Did not get interrupt on CBI
Aug 20 14:02:27 tbolt kernel: usb-storage: -- transport indicates command was aborted
Aug 20 14:02:27 tbolt kernel: usb-storage: scsi command aborted
Aug 20 14:02:27 tbolt kernel: usb-storage: *** thread sleeping.
Aug 20 14:02:27 tbolt kernel: usb-storage: queuecommand() called
Aug 20 14:02:27 tbolt kernel: usb-storage: *** thread awakened.
Aug 20 14:02:27 tbolt kernel: usb-storage: Command TEST_UNIT_READY (6 bytes)
Aug 20 14:02:27 tbolt kernel: usb-storage: 00 00 00 00 00 00 00 00 00 00 00 00
Aug 20 14:02:27 tbolt kernel: usb-uhci.c: interrupt, status 3, frame# 1636
Aug 20 14:02:27 tbolt kernel: usb-storage: Call to usb_stor_control_msg() returned -32
Aug 20 14:02:27 tbolt kernel: usb-storage: -- Stall on control pipe. Clearing
Aug 20 14:02:37 tbolt kernel: usb-storage: command_abort() called
Aug 20 14:02:37 tbolt kernel: usb-storage: usb_stor_clear_halt: result=-2
Aug 20 14:02:37 tbolt kernel: usb-storage: -- transport indicates command failure
Aug 20 14:02:37 tbolt kernel: usb-storage: Issuing auto-REQUEST_SENSE
Aug 20 14:02:37 tbolt kernel: usb-storage: Call to usb_stor_control_msg() returned 12
Aug 20 14:02:37 tbolt kernel: usb-storage: usb_stor_transfer_partial(): xfer 18 bytes
Aug 20 14:02:37 tbolt kernel: usb-storage: USB IRQ received for device on host 1
Aug 20 14:02:37 tbolt kernel: usb-storage: -- IRQ data length is 2
Aug 20 14:02:37 tbolt kernel: usb-storage: -- IRQ state is 0
Aug 20 14:02:37 tbolt kernel: usb-storage: -- Interrupt Status (0x0, 0x0)
Aug 20 14:02:37 tbolt kernel: usb-storage: -- Current value of ip_waitq is: 0
Aug 20 14:02:37 tbolt kernel: usb-storage: usb_stor_bulk_msg() returned 0 xferred 18/18
Aug 20 14:02:37 tbolt kernel: usb-storage: usb_stor_transfer_partial(): transfer complete
Aug 20 14:02:37 tbolt kernel: usb-storage: CBI data stage result is 0x0
Aug 20 14:02:37 tbolt kernel: usb-storage: Current value of ip_waitq is: 1
Aug 20 14:02:37 tbolt kernel: usb-storage: Got interrupt data (0x0, 0x0)
Aug 20 14:02:37 tbolt kernel: usb-storage: -- Result from auto-sense is 0
Aug 20 14:02:37 tbolt kernel: usb-storage: -- code: 0x70, key: 0x6, ASC: 0x28, ASCQ: 0x0
Aug 20 14:02:37 tbolt kernel: usb-storage: Unit Attention: not ready to ready transition
Aug 20 14:02:37 tbolt kernel: usb-storage: scsi cmd done, result=0x2
Aug 20 14:02:37 tbolt kernel: usb-storage: scsi command aborted


Followed by an attempted device_reset.

Once I got the driver to accept 0x28 as a valid command completion, the situation changed:

ug 20 16:54:00 tbolt kernel: usb-storage: USB Mass Storage device detected
Aug 20 16:54:00 tbolt kernel: usb-storage: Endpoints: In: 0xf6679ba8 Out: 0xf6679b94 Int: 0xf6679b80 (Period 1)
Aug 20 16:54:00 tbolt kernel: usb-storage: New GUID 054c00ea0000000000000000
Aug 20 16:54:00 tbolt kernel: usb-storage: Transport: Control/Bulk/Interrupt
Aug 20 16:54:00 tbolt kernel: usb-storage: Protocol: 8070i
Aug 20 16:54:00 tbolt kernel: usb-storage: Allocating IRQ for CBI transport
Aug 20 16:54:00 tbolt kernel: usb-storage: usb_submit_urb() returns 0
Aug 20 16:54:00 tbolt kernel: usb-storage: *** thread sleeping.
Aug 20 16:54:00 tbolt kernel: scsi1 : SCSI emulation for USB Mass Storage devices
Aug 20 16:54:00 tbolt kernel: usb-storage: queuecommand() called
Aug 20 16:54:00 tbolt kernel: usb-storage: *** thread awakened.
Aug 20 16:54:00 tbolt kernel: usb-storage: Command INQUIRY (6 bytes)
Aug 20 16:54:00 tbolt kernel: usb-storage: 12 00 00 00 ff 00 1c f6 2b db 1a c0
Aug 20 16:54:00 tbolt kernel: usb-storage: Call to usb_stor_control_msg() returned 12
Aug 20 16:54:00 tbolt kernel: usb-storage: PT1: xlen is 255
Aug 20 16:54:00 tbolt kernel: usb-storage: usb_stor_transfer_partial(): xfer 255 bytes
Aug 20 16:54:00 tbolt kernel: usb-storage: USB IRQ received for device on host 1
Aug 20 16:54:00 tbolt kernel: usb-storage: -- IRQ data length is 2
Aug 20 16:54:00 tbolt kernel: usb-storage: -- IRQ state is 0
Aug 20 16:54:00 tbolt kernel: usb-storage: -- Interrupt Status (0x28, 0x0)
Aug 20 16:54:00 tbolt kernel: usb-storage: -- Current value of ip_waitq is: 0
Aug 20 16:54:00 tbolt kernel: usb-storage: usb_stor_bulk_msg() returned 0 xferred 56/255
Aug 20 16:54:00 tbolt kernel: usb-storage: CBI data stage result is 0x1
Aug 20 16:54:00 tbolt kernel: usb-storage: Current value of ip_waitq is: 1
Aug 20 16:54:00 tbolt kernel: usb-storage: Got interrupt data (0x28, 0x0)
Aug 20 16:54:00 tbolt kernel: usb-storage: CBI IRQ data showed reserved bType 40
Aug 20 16:54:00 tbolt kernel: usb-storage: Issuing auto-REQUEST_SENSE
Aug 20 16:54:00 tbolt kernel: usb-storage: Call to usb_stor_control_msg() returned 12
Aug 20 16:54:00 tbolt kernel: usb-storage: PT1: xlen is 18
Aug 20 16:54:00 tbolt kernel: usb-storage: usb_stor_transfer_partial(): xfer 18 bytes
Aug 20 16:54:00 tbolt kernel: usb-storage: USB IRQ received for device on host 1
Aug 20 16:54:00 tbolt kernel: usb-storage: -- IRQ data length is 2
Aug 20 16:54:00 tbolt kernel: usb-storage: -- IRQ state is 0
Aug 20 16:54:00 tbolt kernel: usb-storage: -- Interrupt Status (0x0, 0x0)
Aug 20 16:54:00 tbolt kernel: usb-storage: -- Current value of ip_waitq is: 0
Aug 20 16:54:00 tbolt kernel: usb-storage: usb_stor_bulk_msg() returned 0 xferred 18/18
Aug 20 16:54:00 tbolt kernel: usb-storage: usb_stor_transfer_partial(): transfer complete
Aug 20 16:54:00 tbolt kernel: usb-storage: CBI data stage result is 0x0
Aug 20 16:54:00 tbolt kernel: usb-storage: Current value of ip_waitq is: 1
Aug 20 16:54:00 tbolt kernel: usb-storage: Got interrupt data (0x0, 0x0)
Aug 20 16:54:00 tbolt kernel: usb-storage: -- Result from auto-sense is 0
Aug 20 16:54:00 tbolt kernel: usb-storage: -- code: 0x70, key: 0x6, ASC: 0x28, ASCQ: 0x0
Aug 20 16:54:00 tbolt kernel: usb-storage: Unit Attention: not ready to ready transition
Aug 20 16:54:00 tbolt kernel: usb-storage: Fixing INQUIRY data to show SCSI rev 2
Aug 20 16:54:00 tbolt kernel: usb-storage: scsi cmd done, result=0x0
Aug 20 16:54:00 tbolt kernel: usb-storage: *** thread sleeping.
Aug 20 16:54:00 tbolt kernel: Vendor: Sony Model: CLIE MGMS Rev: 1.00
Aug 20 16:54:00 tbolt kernel: Type: Direct-Access ANSI SCSI revision: 02


So, (at least), the device ID'ed correctly. Anyhow, after a bit more hacking around, I found this:

Aug 21 11:24:52 tbolt kernel: usb-storage: Command ALLOW_MEDIUM_REMOVAL (6 bytes)
Aug 21 11:24:52 tbolt kernel: usb-storage: 1e 00 00 00 01 00 f8 f4 58 53 15 c0
Aug 21 11:24:52 tbolt kernel: usb-uhci.c: search_dev_ep:
Aug 21 11:24:52 tbolt kernel: usb-uhci.c: urb: f4f67f00
Aug 21 11:24:52 tbolt kernel: usb-uhci.c: submit_urb: scheduling f4f67f80
Aug 21 11:24:52 tbolt kernel: usb-uhci.c: uhci_submit_control start
Aug 21 11:24:52 tbolt kernel: usb-uhci.c: Allocated qh @ f46e1000
Aug 21 11:24:52 tbolt kernel: usb-uhci.c: uhci_submit_control end
Aug 21 11:24:52 tbolt kernel: usb-uhci.c: submit_urb: scheduled with ret: 0
Aug 21 11:24:52 tbolt kernel: usb-uhci.c: interrupt
Aug 21 11:24:52 tbolt kernel: usb-uhci.c: interrupt
Aug 21 11:24:52 tbolt kernel: usb-uhci.c: interrupt, status 3, frame# 1702
Aug 21 11:24:52 tbolt kernel: usb-uhci.c: process_transfer: len:8 status:38000007 mapped:0 toggle:0
Aug 21 11:24:52 tbolt kernel: usb-uhci.c: process_transfer: len:12 status:3800000b mapped:0 toggle:1


Once the "interrupt, status 3" occurs, it seems that the connection to the NZ90 is dead. A series of
timeouts begin to go off, which ultimately cause the scsi system to declare the device offline.


What do you mean, "caused the transport system to lock the device"

Whoops. See above. The actual message from the log was:

Aug 20 17:01:59 tbolt kernel: scsi: device set offline - not ready or command retry failed after bus reset: host 1 channel 0 id 0 lun 0

What is a locked NZ90 and how do you lock it? And what is the "transport system"?


drivers/usb/storage/transport.c







------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to