Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 250406 - kernel issues with Pentax K10D DSLR camera's storage device(usb interface/kernel 2.6.27-gentoo-r4)
Summary: kernel issues with Pentax K10D DSLR camera's storage device(usb interface/ker...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2008-12-09 15:55 UTC by Jaak Ristioja
Modified: 2008-12-14 18:16 UTC (History)
1 user (show)

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


Attachments
lsusb output for the camera (lsusb-pentax,2.57 KB, text/plain)
2008-12-09 15:56 UTC, Jaak Ristioja
Details
kernel configuration (kernel-config,51.69 KB, text/plain)
2008-12-09 15:58 UTC, Jaak Ristioja
Details
kernel (debug) messages (dmesg2,40.98 KB, text/plain)
2008-12-10 11:24 UTC, Jaak Ristioja
Details
possible fix (pentax.patch,999 bytes, patch)
2008-12-10 13:26 UTC, Daniel Drake (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaak Ristioja 2008-12-09 15:55:24 UTC
Here are the latest kernel messages:

usb-storage: device found at 4
usb-storage: waiting for device to settle before scanning
usb-storage: device scan complete
scsi scan: INQUIRY result too short (5), using 36
scsi 4:0:0:0: Direct-Access     PENTAX   DIGITAL_CAMERA   1.00 PQ: 0 ANSI: 0
sd 4:0:0:0: [sdc] 3985409 512-byte hardware sectors (2041 MB)
sd 4:0:0:0: [sdc] Write Protect is off
sd 4:0:0:0: [sdc] Mode Sense: 0a 0a 00 01
sd 4:0:0:0: [sdc] Assuming drive cache: write through
sd 4:0:0:0: [sdc] 3985409 512-byte hardware sectors (2041 MB)
sd 4:0:0:0: [sdc] Write Protect is off
sd 4:0:0:0: [sdc] Mode Sense: 0a 0a 00 01
sd 4:0:0:0: [sdc] Assuming drive cache: write through
 sdc: sdc1
sd 4:0:0:0: [sdc] Attached SCSI removable disk
sd 4:0:0:0: Attached scsi generic sg2 type 0
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4

However, no /dev/sdc exists for this what I think should be a mass storage device. I'm using sys-fs/udev-124-r1 and sys-kernel/gentoo-sources-2.6.27-r5.
Comment 1 Jaak Ristioja 2008-12-09 15:56:41 UTC
Created attachment 174734 [details]
lsusb output for the camera
Comment 2 Jaak Ristioja 2008-12-09 15:58:21 UTC
Created attachment 174737 [details]
kernel configuration
Comment 3 Jaak Ristioja 2008-12-09 16:20:52 UTC
In addition to the kernel messages above, the following kernel messages had also appeared before I shut down the camera in the end:

usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
sd 4:0:0:0: [sdc] Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK,SUGGEST_OK
end_request: I/O error, dev sdc, sector 3985408
Buffer I/O error on device sdc, logical block 3985408
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
sd 4:0:0:0: [sdc] Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK,SUGGEST_OK
end_request: I/O error, dev sdc, sector 3985408
Buffer I/O error on device sdc, logical block 3985408
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
sd 4:0:0:0: [sdc] Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK,SUGGEST_OK
end_request: I/O error, dev sdc, sector 3985408
Buffer I/O error on device sdc, logical block 3985408
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
sd 4:0:0:0: [sdc] Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK,SUGGEST_OK
end_request: I/O error, dev sdc, sector 3985408
Buffer I/O error on device sdc, logical block 3985408
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: reset full speed USB device using uhci_hcd and address 4
usb 2-1: USB disconnect, address 4
scsi 4:0:0:0: [sdc] Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK,SUGGEST_OK
end_request: I/O error, dev sdc, sector 3985408
Buffer I/O error on device sdc, logical block 3985408
scsi 4:0:0:0: [sdc] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK,SUGGEST_OK
end_request: I/O error, dev sdc, sector 735
Buffer I/O error on device sdc1, logical block 488
Buffer I/O error on device sdc1, logical block 489
Buffer I/O error on device sdc1, logical block 490
Buffer I/O error on device sdc1, logical block 491
Buffer I/O error on device sdc1, logical block 492
Buffer I/O error on device sdc1, logical block 493
Buffer I/O error on device sdc1, logical block 494
Buffer I/O error on device sdc1, logical block 495
Buffer I/O error on device sdc1, logical block 496
scsi 4:0:0:0: rejecting I/O to dead device

PS: The device shows no problems on Windows XP, although I don't know whether that specific windows installation had any Pentax drivers installed (if such drivers exist at all).
Comment 4 Panagiotis Christopoulos (RETIRED) gentoo-dev 2008-12-10 10:21:00 UTC
I don't believe that this has something to do with our gentoo-sources or udev. Probably, your usb physical connection(cable, connectors etc.) is problematic. Try to CONFIG_USB_DEBUG=y and CONFIG_USB_STORAGE_DEBUG=y in order to see some more verbose messages about what really happens. Maybe you need to enable CONFIG_USB_<something> or CONFIG_USB_STORAGE_<something>. I don't want to assign any bug to the kernel team before we 're sure that this isn't a misconfiguration or something of your side(cables etc.). Reply here when you're sure that it's a bug in udev or gentoo-sources. 
Comment 5 Jaak Ristioja 2008-12-10 11:24:53 UTC
Created attachment 174848 [details]
kernel (debug) messages

Ok, I recompiled the kernel with USB and USB mass storage verbose debug messages. Here are all kernel messages that I think might be related to this case. This is what I changed in the kernel configuration just in case. I'm quite certain the other USB options presented by the kernels xconfig are irrelevant.

CONFIG_USB_DEBUG=y
CONFIG_USB_SUSPEND=y
CONFIG_USB_STORAGE_DEBUG=y
CONFIG_USB_LD=y

According to drivers/usb/storage/unusual_devs.h, some Pentax Cameras have also been found not strictly follow the USB mass storage specifications. Perhaps that's the case?
Comment 6 Panagiotis Christopoulos (RETIRED) gentoo-dev 2008-12-10 13:09:42 UTC
I still don't believe that this is gentoo specific. Probably you would experience the same problem with vanilla-sources. But I'm not a kernel expert, so I will let the proper team to reply. Assigned to kernel team.
Comment 7 Daniel Drake (RETIRED) gentoo-dev 2008-12-10 13:26:02 UTC
Created attachment 174857 [details, diff]
possible fix

Thanks for the detailed debugging logs - helps us get straight to the problem. Your device is crashing when Linux tries to access the very final sector. This is a common problem where the device doesn't follow the SCSI specs -- it is supposed to report the address of the final sector, but it instead reports the number of sectors on the device (which is 1 higher, because sectors start at 0).

This patch should fix it, please give it a go.
Comment 8 Daniel Drake (RETIRED) gentoo-dev 2008-12-10 13:28:26 UTC
Please also post the /proc/bus/usb/devices entry for your device (you have already posted equivalent info, but this is the form that kernel developers prefer to see included in the patch description)
Comment 9 Jaak Ristioja 2008-12-10 19:04:38 UTC
The patch works like a charm. Thanks! =)

Here's the entry from /proc/bus/usb/devices:

T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0a17 ProdID=006e Rev= 1.00
S:  Manufacturer=PENTAX Corporation
S:  Product=K10D
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  2mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=08(stor.) Sub=06 Prot=50 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=  64 Ivl=100ms
Comment 10 Daniel Drake (RETIRED) gentoo-dev 2008-12-12 12:25:18 UTC
Patch was acked by upstream, so I've included it for the next 2.6.26/2.6.27 releases
Comment 11 Daniel Drake (RETIRED) gentoo-dev 2008-12-14 18:16:14 UTC
Fixed in gentoo-sources-2.6.27-r6, closing this bug now as I don't think we'll do more 2.6.26 releases. (but if we do, this patch will be in there)