#9589 closed bug (fixed)
WD Elements USB drive not found
Reported by: | markh | Owned by: | mmlr |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | Drivers/USB | Version: | R1/alpha4.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | #10010 | |
Platform: | All |
Description
I have a WD Elements 500GB external USB drive. If I attach it to the computer, Haiku writes the following in the syslog, but doesn't do anything else with it:
KERN: usb hub 83: KERN: port 1: new device connected KERN: usb_disk: device reports a lun count of 1 KERN: usb_disk: vendor_identification "WD " KERN: usb_disk: product_identification "Elements 1042 " KERN: usb_disk: product_revision_level "1019" KERN: usb_disk: unhandled ioctl 24
I can attach an USB stick and that is recognized fine. I am using it to boot Haiku from the stick.
Attachments (6)
Change History (27)
comment:1 by , 12 years ago
by , 11 years ago
Attachment: | usb_disk_retry.patch added |
---|
Fix for devices that don't respond immediately
comment:2 by , 11 years ago
patch: | 0 → 1 |
---|
comment:3 by , 11 years ago
I looked into the code and it seems to be going wrong when it tries to read the status from the drive. It fails with "request_sense: device not ready", but it does not return an errror. I changed the code to return an error, so it will retry until the device is ready.
comment:4 by , 11 years ago
Please check with hrev46058 or newer. I hopefully understood your patch right. Thanks!
comment:7 by , 11 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
by , 11 years ago
by , 11 years ago
comment:8 by , 11 years ago
Sorry about that. I tested the change with a few usb devices and none had any problems. It could be that your system is slowing down, because it gets a timeout as there is no SD card inserted in the reader. Could you try it with a card inserted and see what happens?
If so, then it seems that my drive and your card reader go through the same part of the code for different reasons. I will look at the code again to see if I can understand why this happens.
comment:9 by , 11 years ago
Hi Mark and diger, could you please post a syslog with TRACE_USB_DISK activated? This TRACE should give an hint on whether a retry is needed or not.
by , 11 years ago
Attachment: | syslog_wd_elements.log added |
---|
Snippet of syslog when attaching WD Elements USB drive
comment:10 by , 11 years ago
I attached a small part of the syslog that shows what happens when the WD Elements drive is attached with TRACE_USB_DISK enabled. I did some further digging and I think I know where the problem is. The sense data contains additional data and this data clarifies exactly why the device is not responding (see https://en.wikipedia.org/wiki/Key_Code_Qualifier for the list). The WD Elements drive returns 04 01 as the response as can be seen in the log. I suspect the card reader returns something like 3A 00. If so, then we need to add code to interpret this additional data.
comment:11 by , 11 years ago
I agree. For reference the official list is at http://www.t10.org/lists/asc-num.txt This could be an idea to generate an header based on this list, and display sense information.
comment:12 by , 11 years ago
The SD card syslog indeed shows 3A 00 for the additional information. korli: What do you want to do?
comment:13 by , 11 years ago
But that's what the code already checks for in the case above the changed one. It's just that that one falls through, so now also gets the changed error code. Please just un-fall-through the case above or return the old return code for unit attention.
comment:14 by , 11 years ago
I see now what the code was doing, but according to the wikipedia article I linked to the combination of SCSI_SENSE_KEY_UNIT_ATTENTION and SCSI_ASC_MEDIUM_NOT_PRESENT cannot occur. Your list however does not indicate a limitation on this part. It might be interesting to see which sense key the SD card reader is sending, but I will change the code so it works either way.
by , 11 years ago
Attachment: | usb_disk_retry_2.patch added |
---|
This patch should work for both the WD Elements drive and the SD card reader
comment:15 by , 11 years ago
The patch still doesn't take into account all the options that the list supplies, but that might be best left for some other time.
comment:16 by , 11 years ago
I'm willing to switch usb_disk to a comprehensive SCSI ASC list, common with scsi_periph. It would provide a message, a defined action and a status return code. We could then merge and update the error sense handling code in scsi_periph as well. I should tackle this very soon and let you know when something can be tested.
comment:20 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Thanks both for the feedback! Closing as fixed.
comment:21 by , 11 years ago
Blocking: | 10010 added |
---|
(In #10010) It should be noted that that change hasn't yet been merged into the PM branch.
With a nightly build (href45525) I get something different. It now reports the following in the syslog:
KERN: usb hub 83: KERN: port 2: new device connected KERN: usb_disk: device reports a lun count of 1 KERN: usb_disk: vendor_identification "WD " KERN: usb_disk: product_identification "Elements 1042 " KERN: usb_disk: product_revision_level "1019" KERN: usb_disk: got device name "WD Elements 1042 1019": No error KERN: fs_mount - EXIT, result code is No error
It now also shows in DriveSetup, but I can't create a partition on it. Trying to mount it produces the following error:
Could not mount partition "".
Error: Invalid Argument