# USB mass storage not working

## LokiCoki

Hello,

I have a problem with my USB key. When I plug it in the computer (IBM T22), I can't mount it. Here is what dmesg shows me:

```

usb 1-1: new full speed USB device using uhci_hcd and address 6

usb 1-1: new full speed USB device using uhci_hcd and address 7

usb 1-1: new full speed USB device using uhci_hcd and address 8

usb 1-1: new full speed USB device using uhci_hcd and address 9

usb 1-1: new full speed USB device using uhci_hcd and address 10

usb 1-1: new full speed USB device using uhci_hcd and address 11

usb 1-1: new full speed USB device using uhci_hcd and address 12

usb 1-1: new full speed USB device using uhci_hcd and address 13

usb 1-1: new full speed USB device using uhci_hcd and address 14

usb 1-1: new full speed USB device using uhci_hcd and address 15

usb 1-1: new full speed USB device using uhci_hcd and address 16

```

And it goes on and on and on. There is no error message anywhere but it seems like the USB key is not getting any address... The problem is even weirder because I have been able to mount the key twice a few days ago. It seems like once in a while it works, but most of the time it doesn't.

I have no problem using the key in Windows on the same machine so the USB port works fine and I use the USB key on other computers with linux on and it works fine.

I use kernel 2.6.16-gentoo-r7: 

```

quark loic # uname -a

Linux quark 2.6.16-gentoo-r7 #3 Mon Jun 5 15:16:33 EDT 2006 i686 Pentium III (Coppermine) GNU/Linux

```

And here is the output from lspci and lsusb:

```

quark loic # lspci -v |grep USB

00:07.2 USB Controller: Intel Corporation 82371AB/EB/MB PIIX4 USB (rev 01) (prog-if 00 [UHCI])

```

```
quark loic # lsusb -v

Bus 001 Device 001: ID 0000:0000  

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               1.10

  bDeviceClass            9 Hub

  bDeviceSubClass         0 Unused

  bDeviceProtocol         0 Full speed hub

  bMaxPacketSize0        64

  idVendor           0x0000 

  idProduct          0x0000 

  bcdDevice            2.06

  iManufacturer           3 Linux 2.6.16-gentoo-r7 uhci_hcd

  iProduct                2 UHCI Host Controller

  iSerial                 1 0000:00:07.2

  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 Full speed hub

      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  1x 2 bytes

        bInterval             255

Hub Descriptor:

  bLength               9

  bDescriptorType      41

  nNbrPorts             2

  wHubCharacteristic 0x000a

    No power switching (usb 1.0)

    Per-port overcurrent protection

  bPwrOn2PwrGood        1 * 2 milli seconds

  bHubContrCurrent      0 milli Ampere

  DeviceRemovable    0x00

  PortPwrCtrlMask    0x00 

 Hub Port Status:

   Port 1: 0000.0100 power

   Port 2: 0000.0100 power

```

I would really like some help on this.

Thanks in advance.

LokiCoki

----------

## Kruegi

You can include debug support for USB into the kernel.

dmesg will give you a lot more feedback in debug mode.

Thomas

----------

## LokiCoki

I enabled debug mode for USB in my kernel. Here is what is tells me when I plug my USB key in:

```
usb 1-1: new full speed USB device using uhci_hcd and address 68

hub 1-0:1.0: state 7 ports 2 chg 0000 evt 0002

hub 1-0:1.0: state 7 ports 2 chg 0000 evt 0002

uhci_hcd 0000:00:07.2: port 1 portsc 0093,00

hub 1-0:1.0: port 1, status 0101, change 0001, 12 Mb/s

hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x101

```

I have no idea of what is wrong here...

----------

## LokiCoki

That thing is getting even weirder.

I tried, just for fun, to boot the computer with the USB key (which is a Kingston DataTraveler by the way) in. And it got detected properly and I have been able to copy data from the key. The little light on the key was alway on though which I think is not good. Here the relevant output from dmesg:

```

  Vendor: Kingston  Model: DataTraveler 2.0  Rev: 6.16

  Type:   Direct-Access                      ANSI SCSI revision: 00

SCSI device sda: 498687 512-byte hdwr sectors (255 MB)

sda: Write Protect is off

sda: Mode Sense: 45 00 00 08

sda: assuming drive cache: write through

SCSI device sda: 498687 512-byte hdwr sectors (255 MB)

sda: Write Protect is off

sda: Mode Sense: 45 00 00 08

sda: assuming drive cache: write through

 sda: sda1

sd 0:0:0:0: Attached scsi removable disk sda

sd 0:0:0:0: Attached scsi generic sg0 type 0

usb-storage: device scan complete

```

So I guess my kernel has all the needed options. It must be some kind of hotplugging problem...

Thanks for any clue in advance...

----------

## Kruegi

I recently heared that there is a bug in USB system of the recent kernel versions.

You may try an older one (2.6.13) for testing.

Thomas

----------

## LokiCoki

Thanks for the suggestion Kruegi. I tried kernel 2.6.13.5 from kernel.org but it did the exact same thing as with gentoo-sources-2.6.16-r9. I also tried some 2.6.15 kernel, and it didn't work either.

Maybe it has something to do with udev or something like that...

----------

## RuiP

hi,

whats the output of lsmod? 

how do you compiled the modules (usb and scsi related i mean), build-in or loadable?

----------

## LokiCoki

Here is the output of lsmod.

```

quark linux # lsmod

Module                  Size  Used by

sha1                    2144  2 

arc4                    1600  2 

ppp_mppe                6340  2 

ppp_async               8960  1 

crc_ccitt               1664  1 ppp_async

ndiswrapper           169232  0 

```

The modules are all built in. Here is a chunk of my config file:

```

# CONFIG_BLK_DEV_IDESCSI is not set

# SCSI device support

CONFIG_SCSI=y

CONFIG_SCSI_PROC_FS=y

# SCSI support type (disk, tape, CD-ROM)

# Some SCSI devices (e.g. CD jukebox) support multiple LUNs

# CONFIG_SCSI_MULTI_LUN is not set

# CONFIG_SCSI_CONSTANTS is not set

# CONFIG_SCSI_LOGGING is not set

# SCSI Transport Attributes

# CONFIG_SCSI_SPI_ATTRS is not set

# CONFIG_SCSI_FC_ATTRS is not set

# CONFIG_SCSI_ISCSI_ATTRS is not set

# CONFIG_SCSI_SAS_ATTRS is not set

# SCSI low-level drivers

# CONFIG_ISCSI_TCP is not set

# CONFIG_SCSI_IN2000 is not set

CONFIG_SCSI_SATA=y

# CONFIG_SCSI_SATA_AHCI is not set

# CONFIG_SCSI_SATA_SVW is not set

CONFIG_SCSI_ATA_PIIX=y

# CONFIG_SCSI_SATA_VITESSE is not set

CONFIG_SCSI_SATA_INTEL_COMBINED=y

```

```

# USB devices

# CONFIG_SND_USB_AUDIO is not set

# CONFIG_SND_USB_USX2Y is not set

# USB support

CONFIG_USB_ARCH_HAS_HCD=y

CONFIG_USB_ARCH_HAS_OHCI=y

CONFIG_USB=y

# CONFIG_USB_DEBUG is not set

# Miscellaneous USB options

CONFIG_USB_DEVICEFS=y

# CONFIG_USB_BANDWIDTH is not set

# CONFIG_USB_DYNAMIC_MINORS is not set

# CONFIG_USB_SUSPEND is not set

# CONFIG_USB_OTG is not set

# USB Host Controller Drivers

# CONFIG_USB_EHCI_HCD is not set

# CONFIG_USB_ISP116X_HCD is not set

# CONFIG_USB_OHCI_HCD is not set

CONFIG_USB_UHCI_HCD=y

# CONFIG_USB_SL811_HCD is not set

# USB Device Class drivers

# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set

# CONFIG_USB_ACM is not set

CONFIG_USB_PRINTER=y

# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'

# may also be needed; see USB_STORAGE Help for more information

CONFIG_USB_STORAGE=y

# CONFIG_USB_STORAGE_DEBUG is not set

# CONFIG_USB_STORAGE_DATAFAB is not set

# CONFIG_USB_STORAGE_FREECOM is not set

# CONFIG_USB_STORAGE_ISD200 is not set

# CONFIG_USB_STORAGE_DPCM is not set

# CONFIG_USB_STORAGE_USBAT is not set

# CONFIG_USB_STORAGE_SDDR09 is not set

# CONFIG_USB_STORAGE_SDDR55 is not set

# CONFIG_USB_STORAGE_JUMPSHOT is not set

# CONFIG_USB_STORAGE_ALAUDA is not set

# CONFIG_USB_LIBUSUAL is not set

# USB Input Devices

CONFIG_USB_HID=y

CONFIG_USB_HIDINPUT=y

# CONFIG_USB_HIDINPUT_POWERBOOK is not set

# CONFIG_USB_HIDDEV is not set

# USB port drivers

# CONFIG_USB_USS720 is not set

# USB Serial Converter support

# CONFIG_USB_SERIAL is not set

```

The above is the config for my 2.6.16-r9 kernel. The other kernels I have tried were compiled roughly in the same way.

----------

## RuiP

 *Quote:*   

> # CONFIG_USB_EHCI_HCD is not set 

 

sorry, but aren't miss the USB 2.0 support ?

and by the way ensure that you have too:

CONFIG_BLK_DEV_SD=y (or m)

----------

## LokiCoki

Well, my computer doesn't have USB2.0 ports. There is only one USB1.1 which is, according to lspci, UHCI stuff. So I thought that EHCI was useless for me.  And CONFIG_BLK_DEV_SD is set to 'y' already.

----------

## RuiP

uhmm, sorry, didn't know that you have no usb2.0 ports... no more ideas  :Sad: 

----------

