Bug 5579

Summary: Microtek driver: error -22 submitting URB, kernel-2.6.14.
Product: Drivers Reporter: David (decibelshelp)
Component: USBAssignee: Greg Kroah-Hartman (greg)
Status: RESOLVED CODE_FIX    
Severity: normal CC: kernel
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.14 Subsystem:
Regression: --- Bisected commit-id:
Bug Depends on:    
Bug Blocks: 5089    
Attachments: 2.6.14 kernel system Dmesg output.
2.6.14 kernel system /var/log/debug output after plugging scanner in.
2.6.14 kernel system /var/log/hotplug/evens output after plugging scanner in.
2.6.14 kernel system /var/log/kern.log output after plugging scanner in.
2.6.13 kernel system log outputs from the Same system that work.
2.6.14 kernel system hardware info.
2.6.14 kernel system software info.
2.6.14 kernel system with more debug enabled in drivers.
Patch for Microtek driver: error -22 submitting URB

Description David 2005-11-09 16:25:49 UTC
Most recent kernel where this bug did not occur:2.6.13
Distribution: Gentoo AMD64
Hardware Environment: Gigabyte GA-K8NS Ultra-939, Nvidia GeForce 6800, attached
files containing /proc/ioports, /proc/iomem, lsusb, lspci
Software Environment: attached output of ver_linux script
Problem Description:
Microtek Scanmaker V6UPL error: error -22 submitting URB.
Have several kernels on same system all work except for kernel-2.6.14 and 2.6.14_rc5
When plug in scanner or during boot, major difference between working and 
non-working kernel is shown below.

From kern.log on 2.6.14 kernel:
....
Nov  8 07:34:34 decibels scsi1 : microtekX6
Nov  8 07:34:34 decibels ohci_hcd 0000:00:02.0: urb ffff81002acce780 path 2
ep2in 83160000 cc 8 --> status -75
Nov  8 07:34:34 decibels microtek usb (rev 0.4.3): error -22 submitting URB
Nov  8 07:34:34 decibels microtek usb (rev 0.4.3): error -22 submitting URB
Nov  8 07:34:34 decibels hub 2-0:1.0: state 5 ports 4 chg 0000 evt 0004

Noticed first in 2.6.14_rc5, tried 2.6.14 and same results. 
Kernel-2.6.11 and 2.6.13 and both work, so have previous kernels.

This scanner is a usb scanner that uses the scsi generic driver. 
From kern.log on working kernel.
 
Nov  5 15:49:06 decibels scsi2 : microtekX6
Nov  8 15:49:06 decibels Vendor:           Model: Scanner V6UPL     Rev: 1.00
Nov  8 15:49:06 decibels Type:   Scanner                            ANSI SCSI
revision: 02
Nov  8 15:49:06 decibels Attached scsi generic sg0 at scsi2, channel 0, id 0,
lun 0,  type 6
Nov  8 15:49:06 decibels hub 2-0:1.0: state 5 ports 4 chg 0000 evt 0004

Yes, this scanner is still supported and is listed in the kernel microtek.c source. 

Steps to reproduce: reboot or unplug/replug in scanner.
Comment 1 David 2005-11-09 16:29:35 UTC
Created attachment 6516 [details]
2.6.14 kernel system Dmesg output.
Comment 2 David 2005-11-09 16:31:05 UTC
Created attachment 6517 [details]
2.6.14 kernel system /var/log/debug output after plugging scanner in.
Comment 3 David 2005-11-09 16:31:56 UTC
Created attachment 6518 [details]
2.6.14 kernel system /var/log/hotplug/evens output after plugging scanner in.
Comment 4 David 2005-11-09 16:32:44 UTC
Created attachment 6519 [details]
2.6.14 kernel system /var/log/kern.log output after plugging scanner in.
Comment 5 David 2005-11-09 16:34:48 UTC
Created attachment 6520 [details]
2.6.13 kernel system log outputs from the Same system that work.
Comment 6 David 2005-11-09 16:41:18 UTC
Created attachment 6521 [details]
2.6.14 kernel system hardware info.

This file contains: lspci -vvv, lsusb -v, /proc/ioports, /proc/iomem,
/proc/modules.

Note: this is same computer used with the 2.6.14 kernel having problems with.
Only thing basically different is the kernel.
Comment 7 David 2005-11-09 16:42:21 UTC
Created attachment 6522 [details]
2.6.14 kernel system software info.

Output of ver_linux script.
Comment 8 David 2005-11-11 13:03:32 UTC
>On Friday 11 November 2005 14:33, Oliver Neukum wrote:
> 
> I can sort of replicate it, but I get a different error.
> Please recompile the driver with MTS_DO_DEBUG defined and try again.
> 
> 	Regards
> 		Oliver
> 

Enabled MTS_DO_DEBUG in microtek.c . Quite a lot of info:
(Kern.log after plugging in scanner)

Nov 11 15:03:18 decibels hub 1-0:1.0: state 5 ports 8 chg 0000 evt 0004
Nov 11 15:03:18 decibels ehci_hcd 0000:00:02.2: GetStatus port 2 status 001002 POWER sig=se0 CSC
Nov 11 15:03:18 decibels hub 1-0:1.0: port 2, status 0100, change 0001, 12 Mb/s
Nov 11 15:03:18 decibels hub 1-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x100
Nov 11 15:03:18 decibels hub 1-0:1.0: state 5 ports 8 chg 0000 evt 0004
Nov 11 15:03:18 decibels ehci_hcd 0000:00:02.2: GetStatus port 2 status 001803 POWER sig=j CSC CONNECT
Nov 11 15:03:18 decibels hub 1-0:1.0: port 2, status 0501, change 0001, 480 Mb/s
Nov 11 15:03:18 decibels hub 1-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x501
Nov 11 15:03:18 decibels ehci_hcd 0000:00:02.2: port 2 full speed --> companion
Nov 11 15:03:18 decibels ehci_hcd 0000:00:02.2: GetStatus port 2 status 003001 POWER OWNER sig=se0 CONNECT
Nov 11 15:03:19 decibels hub 2-0:1.0: state 5 ports 4 chg 0000 evt 0004
Nov 11 15:03:19 decibels ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [1] = 0x00010101 CSC PPS CCS
Nov 11 15:03:19 decibels hub 2-0:1.0: port 2, status 0101, change 0001, 12 Mb/s
Nov 11 15:03:19 decibels hub 2-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x101
Nov 11 15:03:19 decibels ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [1] = 0x00100103 PRSC PPS PES CCS
Nov 11 15:03:19 decibels usb 2-2: new full speed USB device using ohci_hcd and address 3
Nov 11 15:03:19 decibels ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [1] = 0x00100103 PRSC PPS PES CCS
Nov 11 15:03:19 decibels usb 2-2: new device strings: Mfr=0, Product=0, SerialNumber=0
Nov 11 15:03:19 decibels DEV: registering device: ID = '2-2'
Nov 11 15:03:19 decibels usb 2-2: hotplug
Nov 11 15:03:19 decibels PM: Adding info for usb:2-2
Nov 11 15:03:19 decibels bus usb: add device 2-2
Nov 11 15:03:19 decibels bound device '2-2' to driver 'usb'
Nov 11 15:03:19 decibels usb 2-2: adding 2-2:1.0 (config #1, interface 0)
Nov 11 15:03:19 decibels DEV: registering device: ID = '2-2:1.0'
Nov 11 15:03:19 decibels usb 2-2:1.0: hotplug
Nov 11 15:03:19 decibels PM: Adding info for usb:2-2:1.0
Nov 11 15:03:19 decibels bus usb: add device 2-2:1.0
Nov 11 15:03:19 decibels usb: Matched Device 2-2:1.0 with Driver microtekX6
Nov 11 15:03:19 decibels microtekX6 2-2:1.0: usb_probe_interface
Nov 11 15:03:19 decibels microtekX6 2-2:1.0: usb_probe_interface - got id
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:714 (mts_usb_probe)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): usb-device descriptor at 3c4e1000
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): product id = 0xb6, vendor id = 0x5da
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:721 (mts_usb_probe)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:725 (mts_usb_probe)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): found model Scanmaker V6UPL
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): model Scanmaker V6UPL is not known to be fully supported, reports welcome!
Nov 11 15:03:19 decibels scsi0 : microtekX6
Nov 11 15:03:19 decibels DEV: registering device: ID = 'host0'
Nov 11 15:03:19 decibels PM: Adding info for No Bus:host0
Nov 11 15:03:19 decibels CLASS: registering class device: ID = 'host0'
Nov 11 15:03:19 decibels class_hotplug - name = host0
Nov 11 15:03:19 decibels DEV: registering device: ID = 'target0:0:0'
Nov 11 15:03:19 decibels PM: Adding info for No Bus:target0:0:0
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:587 (mts_scsi_queuecommand)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command INQUIRY (6 bytes)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3):   12 00 00 00 24 00 9d 00 96 98
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0101
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:534 (mts_build_transfer_context)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Using scatter/gather
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfering from desc->ep_response == 2
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:455 (mts_command_done)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfer = 0x2e0dd200 context = 0x2d9f5390
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): status = 0x0 data-length = 0x24 sent = 0x6
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0301
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:376 (mts_int_submit_urb)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfer = 0x2e0dd200 context = 0x2d9f5390
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): status = 0x0 data-length = 0x24 sent = 0x6
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0301
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:496 (mts_do_sg)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfer = 0x2e0dd200 context = 0x2d9f5390
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): status = 0x0 data-length = 0x24 sent = 0x24
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Processing fragment 0 of 1
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:376 (mts_int_submit_urb)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfer = 0x2e0dd200 context = 0x2d9f5390
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): status = 0x0 data-length = 0x24 sent = 0x24
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels ohci_hcd 0000:00:02.0: urb ffff81002e0dd200 path 2 ep2in 83160000 cc 8 --> status -75
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:496 (mts_do_sg)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfer = 0x2e0dd200 context = 0x2d9f5390
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): status = 0xffffffb5 data-length = 0x24 sent = 0x0
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Processing fragment 1 of 1
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:402 (mts_transfer_cleanup)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfer = 0x2e0dd200 context = 0x2d9f5390
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): status = 0xffffffb5 data-length = 0x24 sent = 0x0
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:376 (mts_int_submit_urb)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfer = 0x2e0dd200 context = 0x2d9f5390
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): status = 0xffffffb5 data-length = 0x24 sent = 0x0
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:587 (mts_scsi_queuecommand)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command INQUIRY (6 bytes)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3):   12 00 00 00 24 00 9d 00 96 98
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:534 (mts_build_transfer_context)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Using scatter/gather
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfering from desc->ep_response == 2
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): error -22 submitting URB
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:587 (mts_scsi_queuecommand)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command INQUIRY (6 bytes)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3):   12 00 00 00 24 00 9d 00 96 98
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:534 (mts_build_transfer_context)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Using scatter/gather
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfering from desc->ep_response == 2
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): error -22 submitting URB
Nov 11 15:03:19 decibels PM: Removing info for No Bus:target0:0:0
Nov 11 15:03:19 decibels DEV: registering device: ID = 'target0:0:1'
Nov 11 15:03:19 decibels PM: Adding info for No Bus:target0:0:1
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:587 (mts_scsi_queuecommand)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command INQUIRY (6 bytes)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3):   12 00 00 00 24 00 b4 00 17 5a
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command to LUN=0 ID=1 CHANNEL=0 from SCSI layer
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): this device doesn't exist
Nov 11 15:03:19 decibels PM: Removing info for No Bus:target0:0:1
Nov 11 15:03:19 decibels DEV: registering device: ID = 'target0:0:2'
Nov 11 15:03:19 decibels PM: Adding info for No Bus:target0:0:2
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:587 (mts_scsi_queuecommand)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command INQUIRY (6 bytes)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3):   12 00 00 00 24 00 4f 00 4b 51
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command to LUN=0 ID=2 CHANNEL=0 from SCSI layer
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): this device doesn't exist
Nov 11 15:03:19 decibels PM: Removing info for No Bus:target0:0:2
Nov 11 15:03:19 decibels DEV: registering device: ID = 'target0:0:3'
Nov 11 15:03:19 decibels PM: Adding info for No Bus:target0:0:3
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:587 (mts_scsi_queuecommand)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command INQUIRY (6 bytes)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3):   12 00 00 00 24 00 00 00 00 00
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command to LUN=0 ID=3 CHANNEL=0 from SCSI layer
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): this device doesn't exist
Nov 11 15:03:19 decibels PM: Removing info for No Bus:target0:0:3
Nov 11 15:03:19 decibels DEV: registering device: ID = 'target0:0:4'
Nov 11 15:03:19 decibels PM: Adding info for No Bus:target0:0:4
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:587 (mts_scsi_queuecommand)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command INQUIRY (6 bytes)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3):   12 00 00 00 24 00 10 00 00 00
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command to LUN=0 ID=4 CHANNEL=0 from SCSI layer
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): this device doesn't exist
Nov 11 15:03:19 decibels PM: Removing info for No Bus:target0:0:4
Nov 11 15:03:19 decibels DEV: registering device: ID = 'target0:0:5'
Nov 11 15:03:19 decibels PM: Adding info for No Bus:target0:0:5
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:587 (mts_scsi_queuecommand)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command INQUIRY (6 bytes)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3):   12 00 00 00 24 00 00 00 00 00
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command to LUN=0 ID=5 CHANNEL=0 from SCSI layer
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): this device doesn't exist
Nov 11 15:03:19 decibels PM: Removing info for No Bus:target0:0:5
Nov 11 15:03:19 decibels DEV: registering device: ID = 'target0:0:6'
Nov 11 15:03:19 decibels PM: Adding info for No Bus:target0:0:6
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:587 (mts_scsi_queuecommand)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command INQUIRY (6 bytes)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3):   12 00 00 00 24 00 00 00 00 00
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command to LUN=0 ID=6 CHANNEL=0 from SCSI layer
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): this device doesn't exist
Nov 11 15:03:19 decibels PM: Removing info for No Bus:target0:0:6
Nov 11 15:03:19 decibels DEV: registering device: ID = 'target0:0:7'
Nov 11 15:03:19 decibels PM: Adding info for No Bus:target0:0:7
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:587 (mts_scsi_queuecommand)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command INQUIRY (6 bytes)
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3):   12 00 00 00 24 00 cc aa aa 2a
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command to LUN=0 ID=7 CHANNEL=0 from SCSI layer
Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): this device doesn't exist
Nov 11 15:03:19 decibels PM: Removing info for No Bus:target0:0:7
Nov 11 15:03:19 decibels bound device '2-2:1.0' to driver 'microtekX6'
Nov 11 15:03:19 decibels usb: Bound Device 2-2:1.0 to Driver microtekX6
Nov 11 15:03:19 decibels CLASS: registering class device: ID = 'usbdev2.3'
Nov 11 15:03:19 decibels class_hotplug - name = usbdev2.3
Nov 11 15:03:19 decibels hub 2-0:1.0: state 5 ports 4 chg 0000 evt 0004

Comment 9 Alan Stern 2005-11-11 13:51:54 UTC
On Fri, 11 Nov 2005, decibels wrote:

> >On Friday 11 November 2005 14:33, Oliver Neukum wrote:
> > 
> > I can sort of replicate it, but I get a different error.
> > Please recompile the driver with MTS_DO_DEBUG defined and try again.
> > 
> > 	Regards
> > 		Oliver
> > 
> 
> Enabled MTS_DO_DEBUG in microtek.c . Quite a lot of info:
> (Kern.log after plugging in scanner)

Correct me if I'm wrong:

> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Command INQUIRY (6 bytes)
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3):   12 00 00 00 24 00 9d 00 96 98
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0101
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:534 (mts_build_transfer_context)
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Using scatter/gather
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfering from desc->ep_response == 2
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:455 (mts_command_done)

This is the callback after sending the CDB.  Note that the driver does DMA
from a non-aligned buffer.

> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfer = 0x2e0dd200 context = 0x2d9f5390
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): status = 0x0 data-length = 0x24 sent = 0x6
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0301
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:376 (mts_int_submit_urb)

This is about to submit the URB to transfer the INQUIRY data.

> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfer = 0x2e0dd200 context = 0x2d9f5390
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): status = 0x0 data-length = 0x24 sent = 0x6
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0301
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:496 (mts_do_sg)

This is the callback.  Note that fragment 0 of a 1-fragment sg list has
just been sent.  Note also the use of page_address, which will fail for
buffers in high memory.

> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfer = 0x2e0dd200 context = 0x2d9f5390
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): status = 0x0 data-length = 0x24 sent = 0x24
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): Processing fragment 0 of 1
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): got to drivers/usb/image/microtek.c:376 (mts_int_submit_urb)

Here the driver is about to submit a 0-length URB for the non-existent
second fragment of a 1-fragment sg list.

> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): transfer = 0x2e0dd200 context = 0x2d9f5390
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): status = 0x0 data-length = 0x24 sent = 0x24
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): desc at 0x2d9f5340: toggle = 0305
> Nov 11 15:03:19 decibels microtek usb (rev 0.4.3): ep_out=c0008300 ep_response=c0010380 ep_image=c0018380
> Nov 11 15:03:19 decibels ohci_hcd 0000:00:02.0: urb ffff81002e0dd200 path 2 ep2in 83160000 cc 8 --> status -75

Not unnaturally, the device sends back more than 0 bytes, and you get 
-EOVERFLOW.

It looks like the problem is in mts_command_done.  It doesn't expect to 
deal with an sg list containing only one element.

Alan Stern

Comment 10 David 2005-11-11 14:09:40 UTC
Created attachment 6548 [details]
2.6.14 kernel system with more debug enabled in drivers.

MTS_DO_DEBUG in microtek.c and OHCI_VERBOSE_DEBUG in ohci-hcd.c enabled.
Results after plugging scanner in.
Comment 11 Anonymous Emailer 2005-11-12 08:00:01 UTC
Reply-To: oliver@neukum.org

Am Freitag, 11. November 2005 22:56 schrieb Alan Stern:
> It looks like the problem is in mts_command_done. 
Comment 12 Alan Stern 2005-11-12 08:44:47 UTC
On Sat, 12 Nov 2005, Oliver Neukum wrote:

> Am Freitag, 11. November 2005 22:56 schrieb Alan Stern:
> > It looks like the problem is in mts_command_done. 
Comment 13 David 2005-11-12 09:32:23 UTC
On Saturday 12 November 2005 10:49, Alan Stern wrote:
> On Sat, 12 Nov 2005, Oliver Neukum wrote:
> 
> > Am Freitag, 11. November 2005 22:56 schrieb Alan Stern:
> > > It looks like the problem is in mts_command_done. 
Comment 14 Greg Kroah-Hartman 2005-11-14 21:37:34 UTC
So can someone send me a patch to fix this?
Comment 15 David 2005-11-15 04:27:16 UTC
Created attachment 6591 [details]
Patch for Microtek driver: error -22 submitting URB

Tested patch supplied by Oliver Neukum.
Works perfectly. Is being submitted for acceptance on usb-devel.
Patches microtek.c & microtek.h
Comment 16 Daniel Drake 2005-11-24 16:34:58 UTC
This can be closed as CODE_FIX because the fix is in Linus' tree.
Comment 17 Greg Kroah-Hartman 2005-11-24 19:46:50 UTC
Done.