[Linux® USB page]

USB devices and Linux (valid for Kernel 2.2/2.4)


Note: the information on this page is not really valid anymore for 2.6.X Kernel. The USB system was completely re-done for 2.6.X and most things work now out of the box. Especially mass storage devices don't need special care unless they are really broken. Also the hardware manufactures have less bugs theses days in their hardware.

The USB support in Linux is very good. As opposed to other common operating systems you often do not need a special driver. However some devices require special settings or are not covered from an application protocol point of view by the USB specifications or other publicly available specification. It's always a good idea to first search for supported devices in the Linux USB database at www.qbik.ch/usb/devices. I would do that even if you do not need the device to work under Linux. It gives you more flexibility and freedom.

USB is a standard. Specifications which are applicable to devices listed further down on this page can be found at www.usb.org/developers: Information on how to reverse-engineer USB devices with usbsniff can be found at:
www.toth.demon.co.uk/usb/reverse-0.2.txt

The Linux USB pages are at: www.linux-usb.org.

Guido's USB devices

Here I list a number of USB devices that I use now for some time with Linux and without any problems.

Hp DeskJet 970C printer



Works without any additional USB driver. As a postscript converter I use turboprint (www.turboprint.de).
Here the /proc/bus/usb/devices entry as reference:
T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=03f0 ProdID=1004 Rev= 1.00
S:  Manufacturer=Hewlett-Packard
S:  Product=DeskJet 970C
S:  SerialNumber=ES08J1D0WCJQ
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  2mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=07(print) Sub=01 Prot=01 Driver=usblp
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
I:  If#= 0 Alt= 1 #EPs= 2 Cls=07(print) Sub=01 Prot=02 Driver=usblp
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=  0ms


Hp ScanJet 5200c



This scanner was one of the very first USB scanner supported by Linux. You can use it together with Sane/Gimp. This allows you to access the scanner from any computer in your network.
Required kernel modules: scanner + usb-uhci or usb-ohci
Configuration: Edit /etc/sane.d/dll.conf to enable hp and insert in /etc/sane.d/hp.conf the following lines:
/dev/usb/scanner0
option connect-device
option enable-image-buffering
Device file: /dev/usb/scanner0 (major 180, minor 48)
Here the /proc/bus/usb/devices entry as reference:
T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=03f0 ProdID=0401 Rev= 1.00
S:  Product=HP ScanJet 5200C
S:  SerialNumber=SG01G170DDHT
C:* #Ifs= 1 Cfg#= 1 Atr=60 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=usbscanner
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  16 Ivl=  0ms
E:  Ad=83(I) Atr=03(Int.) MxPS=   1 Ivl=250ms


Atek Super Mini Optical Mouse



[linuxfocus logo] I have written an article in linuxfocus about it. Therefore I will not give any further details here. The article is: http://linuxfocus.org/English/November2001/article220.shtml
Here the /proc/bus/usb/devices entry as reference:
T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=1.5 MxCh= 0
D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=1894 ProdID=5103 Rev= 0.01
S:  Manufacturer=JPC
S:  Product=JPC USB MOUSE
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=02 Driver=hid
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl= 10ms


Neodio CompactFlash Card Reader/Writer



[CompactFlash Reader/Writer]
This device is a usb mass storage device and according to the description from the chip manufacture (http://www.neodio.com.tw/nd-5010.htm) it should be fully standard compliant but it is not. It requires therefore an entry in drivers/usb/storage/unusual_devs.h and re-compilation of the Kernel. I have tested it with Kernel 2.4.17. Later Kernels might already have the required entry as I submitted it to the maintainer of unusual_devs.h.

Compactflash Reader/Writer is a small half round device. There is no information about the manufacturer printed anywhere (It's a real no name device ;-). It has no cables. You plug it to the computer either directly or via expansion cable.

The device appears from Linux point of view like a SCSI disk. The listing in /proc/bus/usb/devices for this device is:
T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=16 #Cfgs=  1
P:  Vendor=0aec ProdID=5010 Rev= 1.00
S:  Manufacturer=Card Reader/Writer
S:  Product=Card Reader/Writer
S:  SerialNumber=0AEC301000001A00
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
To unusual_devs.h you need to add the following lines:
UNUSUAL_DEV( 0x0aec, 0x5010, 0x0100, 0x0100, "Card Reader/Writer",
        "neodio card reader/writer", US_SC_SCSI, US_PR_BULK,
        NULL,  US_FL_FIX_INQUIRY),
This device behaves very much like the Dimage 5 Camera listed below (it's a pseudo SCSI disk).

Please note that it is very important for Linux to have a correct filesystem on the card. Some cameras write some nonsence that Windoes ignores but Linux produces errors. If you format the card with my Dimage 5 then only the first 16Mb can be read. If you format the card with Windows and use it in the camera or this card reader then there is no such problem.

Keith Hudson wrote me that he bought a 64MB USB Pen Drive. It does not mention any manufacturer but contains also a Neodio 5010 chip. It works with the same settings as the Reader/Writer. A picture of the pen drive is shown below.
[key drive]

USB pendrive

This is a "portable flashdrive" and it is one of the few implementations which follow the USB standard. That means you do not need a modified Kernel or a special driver for any operating system.

I am happy that there is finally a company who read the USB specifications!
[pendrive]
The pendrive (from http://www.pendrive.com) identifies itself as follows:
T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0d7d ProdID=0120 Rev= 1.00
S:  Manufacturer=
S:  Product=USB Disk Pro
S:  SerialNumber=072A101001A2
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
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=255ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=255ms
E:  Ad=83(I) Atr=03(Int.) MxPS=   2 Ivl=  1ms
You plug it in, you mount /dev/sda1 and you have access to your files on any Linux system (or other OS).

Minolta Dimage 5



[Dimage 5]
[linuxfocus logo] I have written an article in linuxfocus about it. Therefore I will not give any further details here. The article is:
http://linuxfocus.org/English/May2002/article240.shtml

Changes for the 2.6.x and 2.4.22 (or higher) Kernels

As of 2.4.22 the usb storage code from 2.6.x has been proted back to 2.4.x. This means a few small changes: My dimage cameras need now the following entries:

UNUSUAL_DEV( 0x0686, 0x4008, 0x0001, 0x0001,
             "Minolta",
             "DiMAGE 5",
             US_SC_SCSI, US_PR_DEVICE, NULL,
             US_FL_SINGLE_LUN ),

UNUSUAL_DEV( 0x0686, 0x400b, 0x0001, 0x0001,
             "Minolta",
             "DiMAGE 7i",
             US_SC_SCSI, US_PR_DEVICE, NULL,
             US_FL_SINGLE_LUN ),
and the card reader works with
UNUSUAL_DEV( 0x0aec, 0x5010, 0x0100, 0x0100, "Card Reader/Writer",
        "neodio card reader/writer", US_SC_SCSI, US_PR_DEVICE,
        NULL,  US_FL_FIX_INQUIRY),
For the kernel configuration make sure that you have
CONFIG_SCSI=y
CONFIG_CHR_DEV_SG=y
CONFIG_CHR_DEV_SM=m

CONFIG_USB=m
CONFIG_USB_DEVICEFS=y
CONFIG_USB_STORAGE=m
# optional:
CONFIG_USB_STORAGE_DEBUG=y
and do not set CONFIG_SCSI_MULTI_LUN !!. The dimage just hangs if you probe for multiple luns (update: I am now using this US_FL_SINGLE_LUN flag. Since then I have not tried what happens if you use CONFIG_SCSI_MULTI_LUN). USB debug seems to cause also problems:
# CONFIG_SCSI_MULTI_LUN is not set
# CONFIG_USB_DEBUG is not set
There is also a problem with linux storage system not beeing able to handle different devices on the fly. I have to e.g unload usb-storage after I unplug one device and add a new one. If I don't "rmmod usb-storage" then the new device will just hang. I have automated this. It is therefore not a big problem but I can only use one device at a time.

Add in the /etc/hotplug/usb.agent script the lines:
remove)
    # dimage 7i
    if [ "$PRODUCT" = "686/400b/1" ]; then
         /sbin/rmmod usb-storage
    fi
    # dimage 5
    if [ "$PRODUCT" = "686/4008/1" ]; then
         /sbin/rmmod usb-storage
    fi
This will automatically unload the module as soon as you unplug it.

External HD



[external usb disk]
This is a small case which takes normal laptop 2.5" disk and you connect it to the computer via usb. Unfortunately it uses more than 500mA (because of the HD). As the power is supplied via the usb connector it does not work with a computers. This is due to the fact that the USB specification limits the max. power consumption per device to 500mA.

On those computers where it works you need the following entry in unusual_devices.h:
2.4.22 (or higher) Kernels:

UNUSUAL_DEV(  0x05e3, 0x0702, 0x0000, 0x0002,
                "EagleTec",
                "External Hard Disk",
                US_SC_SCSI, US_PR_DEVICE, NULL,
                US_FL_FIX_INQUIRY|US_FL_MODE_XLATE ),

The device identifies itself as follows:

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=05e3 ProdID=0702 Rev= 0.02
S:  Product=USB TO IDE
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 96mA
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=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms


After testing this device for a while I found the following problem: If you have the ehci module loaded (ehci-hcd) then it will fail large data transfers of several 100Mb (see below). The solution is to run "rmmod ehci-hcd". I don't know if this is true for all kernel version. I am using 2.4.22 at the moment and this is where I see this fault.
usb_control/bulk_msg: timeout
usb_control/bulk_msg: timeout
...
 I/O error: dev 08:11, sector 0
EXT3-fs error (device sd(8,17)) in ext3_reserve_inode_write: IO failure
 I/O error: dev 08:11, sector 0
EXT3-fs error (device sd(8,17)) in ext3_new_inode: IO failure
 I/O error: dev 08:11, sector 0
 I/O error: dev 08:11, sector 1980896
 I/O error: dev 08:11, sector 1981144
 I/O error: dev 08:11, sector 1981392
 I/O error: dev 08:11, sector 1981640


Page Maintained by: Guido Socher, e-mail : guidosocher (at) gmail.com