Bug 6081

Summary: Pendrive (Pentadrive 256MB) not working
Product: Drivers Reporter: nissarin
Component: USBAssignee: Matthew Dharm (mdharm-usb)
Status: REJECTED WILL_NOT_FIX    
Severity: normal CC: greg, stern
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.x Subsystem:
Regression: --- Bisected commit-id:
Bug Depends on:    
Bug Blocks: 5089    
Attachments: debug log
messages...
kernel debug log
manual
kernel debug log (the right one...)
Device information (Advanced USB Port Monitor @ Win2K SP4)
Log in xml format
Binary...
yet another log...
/proc/kmsg; device plugged in - waiting 10 sec.. - unplugged
unusual_devs entry for the Pentadrive
kmsg.log

Description nissarin 2006-02-15 14:18:17 UTC
Distribution: 
  Slackware 10.1/10.2/current, Slamd64 10.2/current, SLAX 5.0.6

Hardware Environment:
  1. Gigabyte K8NF-9 Ultra; Athlon64 3000
  2. MSI K7T266 Pro2; Athlon XP 1700+
  3. Some Intel based board w/ Pentium 4 (my friend computer ;) )

Very short description - inserting pendrive into usb port ends with some errors,
restarting hotplug scripts barely resolves problem - I can access pendrive but
only read-only. 
I tried different kernels (with several configurations) - including 2.6.12.x,
2.6.14.7, 2.6.15.3 and 2.6.16-rc2 (all logs are from last one), testing on
different hardware. At the end I checked that pendrive on my friend's WinXP -
works... in fact at the very beging of my 'experiments' I managed to access it
in rw mode - unfortunatelly I have no idea how to reproduce it.
One more thing - pendrive's second device (?) is visible only in certain kernel
configuration (compiled with SCSI_MULTI_LUN I suppose...).

Some logs...
debug:
Feb 15 21:39:54 radscorpion kernel: usb-storage: device found at 5
Feb 15 21:39:54 radscorpion kernel: usb-storage: waiting for device to settle
before scanning
Feb 15 21:40:00 radscorpion kernel: sdb: Mode Sense: 23 00 00 00
Feb 15 21:40:00 radscorpion kernel: sdb: Mode Sense: 23 00 00 00
Feb 15 21:40:00 radscorpion kernel: sdc: Mode Sense: 23 00 80 00
Feb 15 21:40:00 radscorpion kernel: sdc: Mode Sense: 23 00 80 00
Feb 15 21:40:00 radscorpion kernel: usb-storage: device scan complete
Restarting hotplug...
Feb 15 21:42:09 radscorpion kernel: PCI: Setting latency timer of device
0000:00:02.1 to 64
Feb 15 21:42:09 radscorpion kernel: PCI: cache line size of 64 is not supported
by device 0000:00:02.1
Feb 15 21:42:10 radscorpion kernel: ohci_hcd: 2005 April 22 USB 1.1 'Open' Host
Controller (OHCI) Driver (PCI)
Feb 15 21:42:10 radscorpion kernel: PCI: Setting latency timer of device
0000:00:02.0 to 64
Feb 15 21:42:11 radscorpion kernel: usb-storage: device found at 2
Feb 15 21:42:11 radscorpion kernel: usb-storage: waiting for device to settle
before scanning
Feb 15 21:42:17 radscorpion kernel: sdb: Mode Sense: 23 00 80 00
Feb 15 21:42:17 radscorpion kernel: sdb: Mode Sense: 23 00 80 00
Feb 15 21:42:17 radscorpion kernel: sdc: Mode Sense: 23 00 80 00
Feb 15 21:42:17 radscorpion kernel: sdc: Mode Sense: 23 00 80 00
Feb 15 21:42:17 radscorpion kernel: usb-storage: device scan complete

syslog:
Feb 15 21:40:00 radscorpion kernel: sdb: assuming drive cache: write through
Feb 15 21:40:00 radscorpion kernel: sdb: assuming drive cache: write through
Feb 15 21:40:00 radscorpion kernel: end_request: I/O error, dev sdb, sector 0
Feb 15 21:40:00 radscorpion kernel: Buffer I/O error on device sdb, logical block 0
Feb 15 21:40:00 radscorpion kernel: end_request: I/O error, dev sdb, sector 0
Feb 15 21:40:00 radscorpion kernel: Buffer I/O error on device sdb, logical block 0
Feb 15 21:40:00 radscorpion kernel: ldm_validate_partition_table(): Disk read
failed.
Feb 15 21:40:00 radscorpion kernel: end_request: I/O error, dev sdb, sector 0
Feb 15 21:40:00 radscorpion kernel: Buffer I/O error on device sdb, logical block 0
Feb 15 21:40:00 radscorpion kernel:  unable to read partition table
Feb 15 21:40:00 radscorpion kernel: sdc: assuming drive cache: write through
Feb 15 21:40:00 radscorpion kernel: sdc: assuming drive cache: write through
Restarting hotplug...
Feb 15 21:42:09 radscorpion kernel: hub 1-0:1.0: hub_port_status failed (err = -19)
Feb 15 21:42:09 radscorpion kernel: hub 1-0:1.0: connect-debounce failed, port 2
disabled
Feb 15 21:42:09 radscorpion kernel: hub 1-0:1.0: cannot disable port 2 (err = -19)
Feb 15 21:42:17 radscorpion kernel: sdb: assuming drive cache: write through
Feb 15 21:42:17 radscorpion kernel: sdb: assuming drive cache: write through
Feb 15 21:42:17 radscorpion kernel: sdc: assuming drive cache: write through
Feb 15 21:42:17 radscorpion kernel: sdc: assuming drive cache: write through

messages:
Feb 15 21:39:17 radscorpion syslogd 1.4.1: restart.
Feb 15 21:39:18 radscorpion kernel: klogd 1.4.1, log source = /proc/kmsg started.
Feb 15 21:39:46 radscorpion kernel: usb 2-1: USB disconnect, address 4
Feb 15 21:39:54 radscorpion kernel: usb 2-2: new high speed USB device using
ehci_hcd and address 5
Feb 15 21:39:54 radscorpion kernel: usb 2-2: configuration #1 chosen from 1 choice
Feb 15 21:39:54 radscorpion kernel: scsi5 : SCSI emulation for USB Mass Storage
devices
Feb 15 21:39:59 radscorpion kernel:   Vendor:           Model: USB Flash Drive 
 Rev: PMAP
Feb 15 21:39:59 radscorpion kernel:   Type:   Direct-Access                    
 ANSI SCSI revision: 00
Feb 15 21:39:59 radscorpion kernel: SCSI device sdb: 500736 512-byte hdwr
sectors (256 MB)
Feb 15 21:40:00 radscorpion kernel: sdb: Write Protect is off
Feb 15 21:40:00 radscorpion kernel: SCSI device sdb: 500736 512-byte hdwr
sectors (256 MB)
Feb 15 21:40:00 radscorpion kernel: sdb: Write Protect is off
Feb 15 21:40:00 radscorpion kernel:  sdb:<6>sd 5:0:0:0: SCSI error: return code
= 0x8000002
Feb 15 21:40:00 radscorpion kernel: sdb: Current: sense key: Medium Error
Feb 15 21:40:00 radscorpion kernel:     Additional sense: Unrecovered read error
Feb 15 21:40:00 radscorpion kernel: sd 5:0:0:0: SCSI error: return code = 0x8000002
Feb 15 21:40:00 radscorpion kernel: sdb: Current: sense key: Medium Error
Feb 15 21:40:00 radscorpion kernel:     Additional sense: Unrecovered read error
Feb 15 21:40:00 radscorpion kernel: sd 5:0:0:0: SCSI error: return code = 0x8000002
Feb 15 21:40:00 radscorpion kernel: sdb: Current: sense key: Medium Error
Feb 15 21:40:00 radscorpion kernel:     Additional sense: Unrecovered read error
Feb 15 21:40:00 radscorpion kernel: sd 5:0:0:0: Attached scsi removable disk sdb
Feb 15 21:40:00 radscorpion kernel: sd 5:0:0:0: Attached scsi generic sg1 type 0
Feb 15 21:40:00 radscorpion kernel:   Vendor:           Model: USB Flash Drive 
 Rev: PMAP
Feb 15 21:40:00 radscorpion kernel:   Type:   Direct-Access                    
 ANSI SCSI revision: 00
Feb 15 21:40:00 radscorpion kernel: SCSI device sdc: 3072 512-byte hdwr sectors
(2 MB)
Feb 15 21:40:00 radscorpion kernel: sdc: Write Protect is on
Feb 15 21:40:00 radscorpion kernel: SCSI device sdc: 3072 512-byte hdwr sectors
(2 MB)
Feb 15 21:40:00 radscorpion kernel: sdc: Write Protect is on
Feb 15 21:40:00 radscorpion kernel:  sdc: sdc1
Feb 15 21:40:00 radscorpion kernel: sd 5:0:0:1: Attached scsi removable disk sdc
Feb 15 21:40:00 radscorpion kernel: sd 5:0:0:1: Attached scsi generic sg2 type 0
Restarting hotplug...
Feb 15 21:42:08 radscorpion kernel: ehci_hcd 0000:00:02.1: remove, state 1
Feb 15 21:42:08 radscorpion kernel: usb usb2: USB disconnect, address 1
Feb 15 21:42:08 radscorpion kernel: usb 2-2: USB disconnect, address 5
Feb 15 21:42:09 radscorpion kernel: ehci_hcd 0000:00:02.1: USB bus 2 deregistered
Feb 15 21:42:09 radscorpion kernel: ACPI: PCI interrupt for device 0000:00:02.1
disabled
Feb 15 21:42:09 radscorpion kernel: ohci_hcd 0000:00:02.0: remove, state 1
Feb 15 21:42:09 radscorpion kernel: usb usb1: USB disconnect, address 1
Feb 15 21:42:09 radscorpion kernel: usb 1-9: USB disconnect, address 4
Feb 15 21:42:09 radscorpion kernel: usb 1-10: USB disconnect, address 5
Feb 15 21:42:09 radscorpion kernel: drivers/usb/class/usblp.c: usblp0: removed
Feb 15 21:42:09 radscorpion kernel: ohci_hcd 0000:00:02.0: USB bus 1 deregistered
Feb 15 21:42:09 radscorpion kernel: ACPI: PCI interrupt for device 0000:00:02.0
disabled
Feb 15 21:42:09 radscorpion kernel: usbcore: deregistering driver usbhid
Feb 15 21:42:09 radscorpion kernel: usbcore: deregistering driver hiddev
Feb 15 21:42:09 radscorpion kernel: usbcore: deregistering driver usb-storage
Feb 15 21:42:09 radscorpion kernel: ACPI: PCI Interrupt 0000:00:02.1[B] -> Link
[APCL] -> GSI 20 (level, low) -> IRQ 19
Feb 15 21:42:09 radscorpion kernel: ehci_hcd 0000:00:02.1: EHCI Host Controller
Feb 15 21:42:09 radscorpion kernel: ehci_hcd 0000:00:02.1: debug port 1
Feb 15 21:42:09 radscorpion kernel: ehci_hcd 0000:00:02.1: new USB bus
registered, assigned bus number 1
Feb 15 21:42:09 radscorpion kernel: ehci_hcd 0000:00:02.1: irq 19, io mem 0xfeb00000
Feb 15 21:42:09 radscorpion kernel: ehci_hcd 0000:00:02.1: USB 2.0 started, EHCI
1.00, driver 10 Dec 2004
Feb 15 21:42:10 radscorpion kernel: usb usb1: configuration #1 chosen from 1 choice
Feb 15 21:42:10 radscorpion kernel: hub 1-0:1.0: USB hub found
Feb 15 21:42:10 radscorpion kernel: hub 1-0:1.0: 10 ports detected
Feb 15 21:42:10 radscorpion kernel: ACPI: PCI Interrupt 0000:00:02.0[A] -> Link
[APCF] -> GSI 21 (level, low) -> IRQ 18
Feb 15 21:42:10 radscorpion kernel: ohci_hcd 0000:00:02.0: OHCI Host Controller
Feb 15 21:42:10 radscorpion kernel: ohci_hcd 0000:00:02.0: new USB bus
registered, assigned bus number 2
Feb 15 21:42:10 radscorpion kernel: ohci_hcd 0000:00:02.0: irq 18, io mem 0xf0102000
Feb 15 21:42:10 radscorpion kernel: usb usb2: configuration #1 chosen from 1 choice
Feb 15 21:42:10 radscorpion kernel: hub 2-0:1.0: USB hub found
Feb 15 21:42:10 radscorpion kernel: hub 2-0:1.0: 10 ports detected
Feb 15 21:42:10 radscorpion kernel: usb 1-2: new high speed USB device using
ehci_hcd and address 2
Feb 15 21:42:10 radscorpion kernel: USB Universal Host Controller Interface
driver v2.3
Feb 15 21:42:10 radscorpion kernel: usb 1-2: configuration #1 chosen from 1 choice
Feb 15 21:42:10 radscorpion kernel: ohci_hcd 0000:00:02.0: wakeup
Feb 15 21:42:11 radscorpion kernel: Initializing USB Mass Storage driver...
Feb 15 21:42:11 radscorpion kernel: usb 2-9: new low speed USB device using
ohci_hcd and address 2
Feb 15 21:42:11 radscorpion kernel: usb 2-9: configuration #1 chosen from 1 choice
Feb 15 21:42:11 radscorpion kernel: usb 2-10: new full speed USB device using
ohci_hcd and address 3
Feb 15 21:42:11 radscorpion kernel: usb 2-10: configuration #1 chosen from 1 choice
Feb 15 21:42:11 radscorpion kernel: drivers/usb/class/usblp.c: usblp0: USB
Bidirectional printer dev 3 if 0 alt 0 proto 2 vid 0x03F0 pid 0x1504
Feb 15 21:42:11 radscorpion kernel: scsi6 : SCSI emulation for USB Mass Storage
devices
Feb 15 21:42:11 radscorpion kernel: usbcore: registered new driver usb-storage
Feb 15 21:42:11 radscorpion kernel: USB Mass Storage support registered.
Feb 15 21:42:11 radscorpion kernel: usbcore: registered new driver hiddev
Feb 15 21:42:11 radscorpion kernel: input: A4Tech USB Optical Mouse as
/class/input/input2
Feb 15 21:42:11 radscorpion kernel: input: USB HID v1.10 Mouse [A4Tech USB
Optical Mouse] on usb-0000:00:02.0-9
Feb 15 21:42:11 radscorpion kernel: usbcore: registered new driver usbhid
Feb 15 21:42:11 radscorpion kernel: drivers/usb/input/hid-core.c: v2.6:USB HID
core driver
Feb 15 21:42:17 radscorpion kernel:   Vendor:           Model: USB Flash Drive 
 Rev: PMAP
Feb 15 21:42:17 radscorpion kernel:   Type:   Direct-Access                    
 ANSI SCSI revision: 00
Feb 15 21:42:17 radscorpion kernel: SCSI device sdb: 500736 512-byte hdwr
sectors (256 MB)
Feb 15 21:42:17 radscorpion kernel: sdb: Write Protect is on
Feb 15 21:42:17 radscorpion kernel: SCSI device sdb: 500736 512-byte hdwr
sectors (256 MB)
Feb 15 21:42:17 radscorpion kernel: sdb: Write Protect is on
Feb 15 21:42:17 radscorpion kernel:  sdb: sdb1
Feb 15 21:42:17 radscorpion kernel: sd 6:0:0:0: Attached scsi removable disk sdb
Feb 15 21:42:17 radscorpion kernel: sd 6:0:0:0: Attached scsi generic sg1 type 0
Feb 15 21:42:17 radscorpion kernel:   Vendor:           Model: USB Flash Drive 
 Rev: PMAP
Feb 15 21:42:17 radscorpion kernel:   Type:   Direct-Access                    
 ANSI SCSI revision: 00
Feb 15 21:42:17 radscorpion kernel: SCSI device sdc: 3072 512-byte hdwr sectors
(2 MB)
Feb 15 21:42:17 radscorpion kernel: sdc: Write Protect is on
Feb 15 21:42:17 radscorpion kernel: SCSI device sdc: 3072 512-byte hdwr sectors
(2 MB)
Feb 15 21:42:17 radscorpion kernel: sdc: Write Protect is on
Feb 15 21:42:17 radscorpion kernel:  sdc: sdc1
Feb 15 21:42:17 radscorpion kernel: sd 6:0:0:1: Attached scsi removable disk sdc
Feb 15 21:42:17 radscorpion kernel: sd 6:0:0:1: Attached scsi generic sg2 type 0
Feb 15 21:46:48 radscorpion kernel: usb 1-2: USB disconnect, address 2

lsusb output:
Bus 002 Device 003: ID 03f0:1504 Hewlett-Packard DeskJet 920c
Bus 002 Device 002: ID 09da:0006 A4 Tech Co., Ltd 
Bus 002 Device 001: ID 0000:0000  
Bus 001 Device 002: ID 13fe:1a21  
Bus 001 Device 001: ID 0000:0000  

Bus 002 Device 003: ID 03f0:1504 Hewlett-Packard DeskJet 920c
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x03f0 Hewlett-Packard
  idProduct          0x1504 DeskJet 920c
  bcdDevice            1.00
  iManufacturer           1 Hewlett-Packard
  iProduct                2 DeskJet 920C
  iSerial                 3 HU18L6P2DNBI
  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         7 Printer
      bInterfaceSubClass      1 Printer
      bInterfaceProtocol      2 Bidirectional
      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     0x0040  bytes 64 once
        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     0x0040  bytes 64 once
        bInterval               0

Bus 002 Device 002: ID 09da:0006 A4 Tech Co., Ltd 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x09da A4 Tech Co., Ltd
  idProduct          0x0006 
  bcdDevice            0.01
  iManufacturer           1 A4Tech
  iProduct                2 USB Optical Mouse
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          3 HID-Compliant Mouse
    bmAttributes         0xa0
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Devices
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      2 Mouse
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  bytes 4 three times
        bInterval              10
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      52

Bus 002 Device 001: ID 0000:0000  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0000 
  idProduct          0x0000 
  bcdDevice            2.06
  iManufacturer           3 Linux 2.6.16-rc2 ohci_hcd
  iProduct                2 OHCI Host Controller
  iSerial                 1 0000:00:02.0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0002  bytes 2 twice
        bInterval             255

Bus 001 Device 002: ID 13fe:1a21  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x13fe 
  idProduct          0x1a21 
  bcdDevice            1.00
  iManufacturer           1         
  iProduct                2 USB Flash Drive 
  iSerial                 3 075C0D410050
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
    MaxPower              200mA
    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  bytes 512 once
        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  bytes 512 once
        bInterval               0

Bus 001 Device 001: ID 0000:0000  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         1 Single TT
  bMaxPacketSize0        64
  idVendor           0x0000 
  idProduct          0x0000 
  bcdDevice            2.06
  iManufacturer           3 Linux 2.6.16-rc2 ehci_hcd
  iProduct                2 EHCI Host Controller
  iSerial                 1 0000:00:02.1
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0002  bytes 2 twice
        bInterval              12


So - any ideas (maybe some nice trick to turn off write protection ;))?
Comment 1 Matthew Dharm 2006-02-15 15:13:26 UTC
Can you compile with CONFIG_USB_STORAGE_VERBOSE_DEBUG turned on and send those logs?
Comment 2 nissarin 2006-02-15 15:40:13 UTC
Created attachment 7361 [details]
debug log
Comment 3 nissarin 2006-02-15 15:41:34 UTC
Created attachment 7362 [details]
messages...
Comment 4 Matthew Dharm 2006-02-15 16:43:59 UTC
You need to configure syslogd to send kern.debug messages to a specific file. 
The USB storage debug messages are lost otherwise.  In /etc/syslog.conf, add
   kern.=debug   /var/log/kernel

That will put the debug messages into the file /var/log/kernel.

Also, is this device supposed to report 2 LUNs?  One about 512MB and the other
about 2MB...
Comment 5 nissarin 2006-02-16 10:06:00 UTC
Created attachment 7370 [details]
kernel debug log

Compiled with CONFIG_USB_DEBUG & CONFIG_USB_STORAGE_DEBUG
(CONFIG_USB_STORAGE_VERBOSE_DEBUG is not recognized).
Comment 6 nissarin 2006-02-16 10:34:00 UTC
Created attachment 7371 [details]
manual

Here is one of manuals shipped with pendrive
(http://pentagram.pl/produkty_new/szczegoly.php?id_grupy=31&grupa=pentagram_pendrive&id_produktu=7&lang=en),
descibing using one of it's features (which actualy could cause this problems),
this model has also other functions and their manuals says that to work they
need "Phison's hardware solutions" so this is probably real manufacturer of
this product.

About those LUNs - probably yes (unfortunatelly I'm not familar with SCSI
'terminology"), there should be 2 "disks", from what I know - first one is
"protected", second is "public" (whole device size is splitted between those
two in specified ratio). Also, I tried today (one my cousin's PC running WinXP)
remove that protected partition but it's minimal size is 1MB. 

Good news (or bad ;)) is that Win2k have similar problems - I can't access it
if I plug in when os is running but if I insert it before system starts, I can
access first device ("protected" one) - read-only. However it was fresh Win2k
install (on my old PC), maybe SP3/4 would fix it. 

If you wish I will send you program which is described in attachment.

@Pete Zaitcev
I didn't checked ub so far.
Comment 7 Matthew Dharm 2006-02-16 11:08:12 UTC
I'm still not seeing the right debug messages in your log.  Are you sure you
rebuild and reloaded the new version of the module?

If the device is having problems under Windows, then I am suspicious that the
device is bad.  I definately would like to know if SP3/4 fixes that.

Based on what I can see, the device is, actually, reporting that it's read-only.
 It's not a communication error; the device is responding correctly but with an
indication that it is read-only.

The verbose debug log will be truly telling.
Comment 8 nissarin 2006-02-16 12:44:57 UTC
Created attachment 7374 [details]
kernel debug log (the right one...)

Sorry for that.. I have small mess here 

PS:
Installed SP4, both drives visible and accessible (rw).
Comment 9 Greg Kroah-Hartman 2006-03-06 10:51:49 UTC
Matt, any thoughts?
Comment 10 Matthew Dharm 2006-03-06 11:52:04 UTC
This is definately strange.

The fact that SP3/4 fixes things makes me believe that the device is, simply,
reporting bogus information when asked for write-protect status.  I'm guessing
SP3/4 just ignores the request.

It might be useful to get Alan Stern involved with this -- get the
file-storage-gadget attached to an SP1 and SP4 system and look for a command
behavior difference.  We may need to change our detection code yet again to try
to be compatible with the "popular" OS.

But, the command/data/status transport over USB mechnism itself isn't reporting
any errors.  So quite a lot is working...
Comment 11 Alan Stern 2006-03-09 08:51:05 UTC
Maybe the thing to do is to try a USB sniffer program under Windows.  Perhaps
some funny command has to get sent to "unlock" the device.
Comment 12 nissarin 2006-03-09 12:31:55 UTC
Created attachment 7548 [details]
Device information (Advanced USB Port Monitor @ Win2K SP4)

Here is link to program I have used (30 days trial): 
http://www.shareup.com/Advanced_USB_Port_Monitor-download-45032.html

I'll post below log file in xml format and binary. Small info about my 'tests'
- I just opened 'wainting' monitor window, set program to log all traffic and
replug device (by using one of program options).

I hope it will help you.
Comment 13 nissarin 2006-03-09 12:34:30 UTC
Created attachment 7549 [details]
Log in xml format
Comment 14 nissarin 2006-03-09 12:36:17 UTC
Created attachment 7550 [details]
Binary...
Comment 15 Alan Stern 2006-03-10 12:00:23 UTC
I didn't notice anything of interest in the AUSB log.  On the other hand, it
doesn't show you trying to write anything to the drive; the only I/O commands in
the log are reads.  On the third hand, it does show that device is reporting
that it isn't write-protected.

Of course, your Linux debugging logs also showed the device wasn't
write-protected when you first plugged it in.  It didn't become write-protected
until later, perhaps when you restarted the USB subsystem.

What you should do is a fresh test.  Plug in the drive, let the errors occur,
and don't restart anything.  Then post the output from the dmesg command instead
of the contents of the system logfile.
Comment 16 nissarin 2006-03-10 13:26:14 UTC
Created attachment 7558 [details]
yet another log...

Everything like before but this time I created new file on device and write
something to it.

About 'fresh test' - I did that at first but usb monitor didn't (auto)start, so
I replugged device using program and this time monitor start working. I tried
also monitoring external usb hub, in hope that it will show all traffic but
that program show only one specified device (which must be connected). Maybe
you know some better program ?
Comment 17 Alan Stern 2006-03-10 13:49:05 UTC
I meant that you should do a fresh test under Linux.
Comment 18 nissarin 2006-03-10 14:32:10 UTC
Created attachment 7559 [details]
/proc/kmsg; device plugged in - waiting 10 sec.. - unplugged
Comment 19 Alan Stern 2006-03-11 10:37:24 UTC
Created attachment 7561 [details]
unusual_devs entry for the Pentadrive

It's possible that this patch will help.  It will stop Linux from issuing a
"Prevent Medium Removal" command, which I don't recall seeing in the Windows
log.

By the way, are you sure that the device's password is disabled?
Comment 20 nissarin 2006-03-11 16:56:03 UTC
I applied that patch to 2.6.16-rc5 but unfortunatelly it didn't help. And yes -
password protection is disabled, however afaik when password is set, then
protected drive is reported as removed and public one is accessible (on
windows). On linux, after inserting device second drive is accessible  - I can
see sdb, sdc and sdc1 (looks like password protection on ?) but restarting
hotplug allow me to mount both drives (now there is also sdb1). 

Is it possible to force that device to be rw (using unusual devs table) ?
Comment 21 Alan Stern 2006-03-11 17:29:32 UTC
The problem here isn't just that the device reports itself as write-protected. 
In fact, it doesn't report itself as write-protected at first.  The problem is
that it responds to READ commands with an error (Medium Error: Unrecovered read
error).  You'll see those errors if you read through your log in comment #18.

But then when you restart the USB system, the device obeys READ commands and
does say that it is write-protected.  I don't know why it changes its behavior
or what Windows does differently.  I'll have to go through your sniffer log more
thoroughly to try and find out; at the moment I remember only that those Medium
Errors did not occur.

You can force Linux to skip the write-protect determination step by modifying
the patch I sent.  Where it says  US_FL_NOT_LOCKABLE, change it to

    US_FL_NOT_LOCKABLE | US_FL_NO_WP_DETECT ),
Comment 22 Alan Stern 2006-03-13 07:54:44 UTC
Looking again at your sniffer log, I see these differences between Windows and
Linux:

  Windows sends a Set-Interface request for altsetting 0 and Linux doesn't.  I
doubt this makes any difference because 0 is the only altsetting the device has.

  Windows sends a READ FORMAT CAPACITIES command for both LUNs and Linux
doesn't.  Again I doubt this makes any difference.

  Windows sends INQUIRY and READ FORMAT CAPACITIES for LUN 0 and then INQUIRY
and READ FORMAT CAPACITIES for LUN 1, before trying to read from LUN 0.  Linux
sends an INQUIRY to LUN 0 and then tries to read it before sending an INQUIRY to
LUN 1.  This could be significant.

You might be able to get Linux to behave more like Windows if you do this before
plugging in the device:

    modprobe usb-storage
    rmmod sd-mod

Post the dmesg log showing what happens when you try this.
Comment 23 nissarin 2006-03-16 03:47:58 UTC
Created attachment 7585 [details]
kmsg.log

- usb-storage loaded
- inserting pendrive
- waiting...
- sd-mod loaded
- waiting...
- pendrive removed

Kernel with both US_FL_NOT_LOCKABLE and US_FL_NO_WP_DETECT.
Comment 24 Alan Stern 2006-03-16 07:53:52 UTC
Okay, that didn't help.

I don't know what the problem is.  Almost exactly the same READ(10) command
succeeded in Windows and failed in Linux.  The only difference (which might be
an important one) is that Linux asked for 8 sectors to be transferred and
Windows asked for only 1.  It was the very first sector on the device, the
sector containing the partition table.

I don't know any way to force Linux to transfer just a single sector.
Comment 25 Matthew Dharm 2007-02-27 10:09:34 UTC
I think we're all stumped on this one.  Unless someone has a brainwave, let's
close this.
Comment 26 Alan Stern 2007-02-27 10:57:59 UTC
The problem might very well be the same as the problem reported by Vaclav Barta
in this thread:

   http://marc.theaimsgroup.com/?l=linux-usb-users&m=116602219816

You can read the messages in the email archive to see all the different things
we tried.  In the end it turned out there was no way to change the kernel to
make the device work.  But there was a solution involving the plscsi program. 
It is described in the last few messages of the thread:

   http://marc.theaimsgroup.com/?l=linux-usb-users&m=117027568924140&w=2
Comment 27 nissarin 2007-02-28 16:17:30 UTC
Well, it looks pretty much the same and yes, plscsi also works in my case. To
bad that there is apparently no way to make it work 'out of box'.