Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 191431 - I/O error when reading from Nikon D40 camera
Summary: I/O error when reading from Nikon D40 camera
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL: http://marc.info/?l=linux-usb-devel&m...
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2007-09-05 20:11 UTC by Ortwin Glueck
Modified: 2007-11-07 13:17 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
patch against 2.6.23-rc5 (nikon-d40.patch,633 bytes, patch)
2007-09-05 20:44 UTC, Ortwin Glueck
Details | Diff
Patch against 2.6.22.y (nikon-d40-2.6.22.patch,687 bytes, patch)
2007-09-05 20:45 UTC, Ortwin Glueck
Details | Diff
D40X patch against 2.6.23 (nikon-d40x.patch,642 bytes, patch)
2007-10-11 15:24 UTC, Ortwin Glueck
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ortwin Glueck 2007-09-05 20:11:56 UTC
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
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-09-05 20:15:42 UTC
kernel is broken, not udev. Bug 185517, Bug 186326, Bug 188521 and we'll probably a special one for every single type out there.
Comment 2 Maarten Bressers (RETIRED) gentoo-dev 2007-09-05 20:42:49 UTC
Can you please attach the output of:

cat /proc/bus/usb/devices

with your Nikon D40 plugged in? Thanks.
Comment 3 Ortwin Glueck 2007-09-05 20:44:34 UTC
Created attachment 130114 [details, diff]
patch against 2.6.23-rc5

You are right. The attached patch fixes the problem.
Comment 4 Ortwin Glueck 2007-09-05 20:45:48 UTC
Created attachment 130115 [details, diff]
Patch against 2.6.22.y
Comment 5 Ortwin Glueck 2007-09-05 20:47:16 UTC
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
Comment 6 Mike Pagano gentoo-dev 2007-09-05 21:38:18 UTC
Ortwin,

Will you be submitting this upstream, or do you want us to do it on your behalf?
Comment 7 Ortwin Glueck 2007-09-05 21:56:46 UTC
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.
Comment 8 Ortwin Glueck 2007-09-13 23:15:22 UTC
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
Comment 9 Mike Pagano gentoo-dev 2007-09-14 01:29:08 UTC
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.
Comment 10 Daniel Drake (RETIRED) gentoo-dev 2007-09-22 14:08:10 UTC
fixed in genpatches-2.6.22-8 / gentoo-sources-2.6.22-r7
Comment 11 Shan Destromp 2007-10-09 02:46:53 UTC
(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
Comment 12 Mike Pagano gentoo-dev 2007-10-09 11:59:43 UTC
Shan,

Please post the output of:

cat /proc/bus/usb/devices

with your Nikon D40X plugged in.

Comment 13 Mike Pagano gentoo-dev 2007-10-09 12:00:23 UTC
Reopened and waiting for user response. Sorry for bugspam.
Comment 14 Ortwin Glueck 2007-10-11 15:24:39 UTC
Created attachment 133142 [details, diff]
D40X patch against 2.6.23

Patch to submit upstream
Comment 15 Ortwin Glueck 2007-10-11 16:04:12 UTC
Submitted upstream:

http://marc.info/?l=linux-usb-devel&m=119211659617632&w=2
Comment 16 Greg Kroah-Hartman (RETIRED) gentoo-dev 2007-10-11 16:06:55 UTC
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.
Comment 17 Mike Pagano gentoo-dev 2007-10-24 23:32:39 UTC
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.
Comment 18 Mike Pagano gentoo-dev 2007-11-02 17:27:50 UTC
Please note that genpatches-2.6.23-2 has been released with this patch included, gentoo-sources-2.6.23-r1 is using it.
Comment 19 Daniel Drake (RETIRED) gentoo-dev 2007-11-07 13:17:16 UTC
also fixed in gentoo-sources-2.6.22-r10