After upgrading to udev-144 I could not mount my Nikon D40 camera as a USB storage device any more. Turns out the device doesn't like it when one accesses its last sector (or past last sector) and stops working from that moment on. Subsequent reads will return IO errors. The problem is caused by RAID scans of vol_id as RAID disks store a special block in their last sector. As it makes no sense to scan for RAID on a camera, I just added --skip-raid to all vol_id calls in /etc/udev/rules.d/. Then it worked. There should be a way to disable the RAID checks per device, or globally or some other way. Reproducible: Always Steps to Reproduce: 1. Use udev-144 2. Plug in a NIKON camera Actual Results: Sep 5 21:24:30 mithril scsi 4:0:0:0: Direct-Access NIKON D40 1.10 PQ: 0 ANSI: 2 Sep 5 21:24:30 mithril sd 4:0:0:0: [sdb] 3970049 512-byte hardware sectors (2033 MB) Sep 5 21:24:30 mithril sd 4:0:0:0: [sdb] Write Protect is off Sep 5 21:24:30 mithril sd 4:0:0:0: [sdb] Mode Sense: 0f 00 00 00 Sep 5 21:24:30 mithril sd 4:0:0:0: [sdb] Assuming drive cache: write through Sep 5 21:24:30 mithril sd 4:0:0:0: [sdb] 3970049 512-byte hardware sectors (2033 MB) Sep 5 21:24:30 mithril sd 4:0:0:0: [sdb] Write Protect is off Sep 5 21:24:30 mithril sd 4:0:0:0: [sdb] Mode Sense: 0f 00 00 00 Sep 5 21:24:30 mithril sd 4:0:0:0: [sdb] Assuming drive cache: write through Sep 5 21:24:30 mithril sdb: sdb1 Sep 5 21:24:30 mithril sd 4:0:0:0: [sdb] Attached SCSI removable disk Sep 5 21:24:30 mithril sd 4:0:0:0: Attached scsi generic sg2 type 0 Sep 5 21:24:30 mithril usb-storage: device scan complete Sep 5 21:24:30 mithril end_request: I/O error, dev sdb, sector 3970048 Sep 5 21:24:30 mithril Buffer I/O error on device sdb, logical block 3970048 Sep 5 21:24:30 mithril end_request: I/O error, dev sdb, sector 3970048 Sep 5 21:24:30 mithril Buffer I/O error on device sdb, logical block 3970048 Sep 5 21:24:30 mithril end_request: I/O error, dev sdb, sector 3970048 Sep 5 21:24:30 mithril Buffer I/O error on device sdb, logical block 3970048 Sep 5 21:24:30 mithril end_request: I/O error, dev sdb, sector 3970048 Sep 5 21:24:30 mithril Buffer I/O error on device sdb, logical block 3970048 Sep 5 21:24:30 mithril end_request: I/O error, dev sdb, sector 3970048 Sep 5 21:24:30 mithril Buffer I/O error on device sdb, logical block 3970048 Sep 5 21:24:30 mithril end_request: I/O error, dev sdb, sector 3970048 Sep 5 21:24:30 mithril Buffer I/O error on device sdb, logical block 3970048 Sep 5 21:24:30 mithril end_request: I/O error, dev sdb, sector 3970048 Sep 5 21:24:30 mithril Buffer I/O error on device sdb, logical block 3970048 Sep 5 21:24:30 mithril end_request: I/O error, dev sdb, sector 40 Sep 5 21:24:30 mithril Buffer I/O error on device sdb, logical block 40 Sep 5 21:24:30 mithril end_request: I/O error, dev sdb, sector 41 Sep 5 21:24:30 mithril Buffer I/O error on device sdb, logical block 41 Sep 5 21:24:30 mithril Buffer I/O error on device sdb, logical block 42 Sep 5 21:24:30 mithril end_request: I/O error, dev sdb, sector 40 Expected Results: Sep 5 21:55:21 mithril scsi 11:0:0:0: Direct-Access NIKON D40 1.10 PQ: 0 ANSI: 2 Sep 5 21:55:21 mithril sd 11:0:0:0: [sdb] 3970049 512-byte hardware sectors (2033 MB) Sep 5 21:55:21 mithril sd 11:0:0:0: [sdb] Write Protect is off Sep 5 21:55:21 mithril sd 11:0:0:0: [sdb] Mode Sense: 0f 00 00 00 Sep 5 21:55:21 mithril sd 11:0:0:0: [sdb] Assuming drive cache: write through Sep 5 21:55:21 mithril sd 11:0:0:0: [sdb] 3970049 512-byte hardware sectors (2033 MB) Sep 5 21:55:21 mithril sd 11:0:0:0: [sdb] Write Protect is off Sep 5 21:55:21 mithril sd 11:0:0:0: [sdb] Mode Sense: 0f 00 00 00 Sep 5 21:55:21 mithril sd 11:0:0:0: [sdb] Assuming drive cache: write through Sep 5 21:55:21 mithril sdb: sdb1 Sep 5 21:55:21 mithril sd 11:0:0:0: [sdb] Attached SCSI removable disk Sep 5 21:55:21 mithril sd 11:0:0:0: Attached scsi generic sg2 type 0 Sep 5 21:55:21 mithril usb-storage: device scan complete Sep 5 21:55:28 mithril hald: mounted /dev/sdb1 on behalf of uid 1000
kernel is broken, not udev. Bug 185517, Bug 186326, Bug 188521 and we'll probably a special one for every single type out there.
Can you please attach the output of: cat /proc/bus/usb/devices with your Nikon D40 plugged in? Thanks.
Created attachment 130114 [details, diff] patch against 2.6.23-rc5 You are right. The attached patch fixes the problem.
Created attachment 130115 [details, diff] Patch against 2.6.22.y
from cat /proc/bus/usb/devices: T: Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 10 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=04b0 ProdID=0413 Rev= 1.10 S: Manufacturer=NIKON S: Product=NIKON DSC D40 S: SerialNumber=6149394 C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 2mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
Ortwin, Will you be submitting this upstream, or do you want us to do it on your behalf?
Mike, I have submitted the patch to linux-usb-devel@lists.sourceforge.net with a subject line "[PATCH] Nikon D40 Quirks" a couple of minutes ago.
Patch has been committed to mainline: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=9374b9fd6cef7f8b75a543d044c5b0925aae08cd Will be in 2.6.23
Reopened in anticipation of this patch eventually getting into genpatches for 2.6.22 Bug will be closed once the gentoo-sources revision containing the patch is released.
fixed in genpatches-2.6.22-8 / gentoo-sources-2.6.22-r7
(In reply to comment #10) > fixed in genpatches-2.6.22-8 / gentoo-sources-2.6.22-r7 > Could the bug maintainer get the following added to unusual_devs.h as well, it adds in support for the newer D40X with 1.00 firmware revs UNUSUAL_DEV( 0x04b0, 0x0417, 0x0100, 0x0100, "NIKON", "NIKON DSC D40X", US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_CAPACITY), I've been fighting for the past few weeks to get my new camera working and couldn't for the life of me figure out why adding an "X" to the model descriptor of the entry for the standard D40 until I realized the last two hex codes were revision markers. As of today (2007.10.08) on vanilla-sources 2.6.23-rc9 this works fine. ryn ~ # lsusb -v -s 001:005 Bus 001 Device 005: ID 04b0:0417 Nikon Corp. Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x04b0 Nikon Corp. idProduct 0x0417 bcdDevice 1.00 iManufacturer 1 NIKON iProduct 2 NIKON DSC D40X iSerial 3 3161862 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 32 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower 2mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk (Zip) iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 bNumConfigurations 1 Device Status: 0x0001 Self Powered
Shan, Please post the output of: cat /proc/bus/usb/devices with your Nikon D40X plugged in.
Reopened and waiting for user response. Sorry for bugspam.
Created attachment 133142 [details, diff] D40X patch against 2.6.23 Patch to submit upstream
Submitted upstream: http://marc.info/?l=linux-usb-devel&m=119211659617632&w=2
Already checked into the usb git kernel tree and will show up in the 2.6.24 release. I can add this to the .23 stable if needed.
Patched commited to genpatches for 2.6.22 and 2.6.23 so they will be in the next patch released for both versions when that occurs. Bug will be closed once the gentoo-sources revision containing the patch is released.
Please note that genpatches-2.6.23-2 has been released with this patch included, gentoo-sources-2.6.23-r1 is using it.
also fixed in gentoo-sources-2.6.22-r10