# USB Drive and hotplug

## vol1

Hi,

I'm running Gentoo 2.6.8 on my laptop. I'd like to use my external USB HDD with Gentoo, I read somewhere in the forum that one should install hotplug. So I did, but whenever I plug in the USB HDD my USB mouse quits working  :Crying or Very sad: . I'm not even sure, if the USB disk is recognized by Gentoo.

So here are my 2 questions:

1) How can I avoid my mouse from quitting the service whenever I plug in my USB drive?

2) Where must I define the mount point, ... for the USB drive?

Thanks in advance,

vol.1

----------

## NeddySeagoon

vol1,

If your USB drive is USB 2.0 you must plug the mouse and drive into different root hubs. While the USB hardare can do either (USB 2.0 or 1.1) standard, it cannot do both at the same time.

Your mouse will be USB 1.1.

emerge usbview to geta  graphical view of your USB subsystem.

You may make the mount point wherever you like in your filesystem tree. Putting it in /mnt is traditional but not required.

----------

## vol1

Hi,

my USB drive is USB 2.0, but my laptop only supports USB 1.1, so I guess this isn't the problem. Maybe my question with the mount point was bad formulated, in fact I wanted to ask where to find the device in my filesystem (I guess it should be somewhere in /dev/usb/...?, but this directory is empty).

Can you help me with this new information?

Thanks,

vol.1

----------

## NeddySeagoon

vol1,

USB storage devices appear as if they were SCSI. You need to have the correct scsi modules built and loaded as well as usb-storage.

Your USB drive will then appear as /dev/sdX where X is the next available scsi drive. /dev/sda is the first one.

When the device is detected, you will see encoraging signs at the end of dmesg.

You mount its partitions in the normal way - 

```
mount /dev/sda1 /Some/mount/point 
```

----------

## Tsonn

If no SCSI device shows up, try my recommendations in this thread.

----------

## vol1

Hi,

thanks for your suggestions. I now recompiled my kernel and added the following options:

-> Device Drivers -> SCSI device support ->

  <*> legacy /proc/scsi/ support

  <M> SCSI disk support

  <M> SCSI generic support

  <*> SCSI logging facility

But when I plug in my USB drive my mouse stops working and no device shows up under /dev/sd?? and also "cat /proc/bus/scsi/scsi" doesn't work (/proc/bus/scsi doesn't exist).

Have I recompiled my kernel with"too less" SCSI support, or could there be another problem?

Thanks in advance,

vol.1

----------

## NeddySeagoon

vol1,

Are those new modules loaded ?

Look at the output of lsmod

You also need the module usb-storage

Can you post the content of /proc/bus/usb/devices with the mouse and drive plugged in please. If neither device is there, post the /proc/bus/usb/devices once with the mouse detected and once with the drive detected.

Your lspci output may also be useful for diagnostics.

----------

## vol1

Hi,

I unplugged my mouse, plugged in my USB drive. Now there exists an entry /dev/sda1, I can even mount it and view its contents  :Smile: . So I guess the right modules get loaded.

If the USB drive is plugged in and I try to plug in my mouse both devices work fine  :Smile: . It looks like the order of plugging the devices is the problem, because if I try it the other way (mouse first, than USB drive) my USB drive still gets recognized, but my mouse quits service.

So, thanks to the help of both of you my only problem left to solve, is how to avoid my mouse from stopping to work when the USB drive is already plugged in. Using 'usbview' that you suggested the entry 'Optical mouse' changes to 'usbhid' when I plug in the USB drive with already connected mouse.

When the mouse doesn't work /proc/bus/usb/devices contains this:

```

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2

B:  Alloc= 93/900 us (10%), #Int=  1, #Iso=  0

D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1

P:  Vendor=0000 ProdID=0000 Rev= 2.06

S:  Manufacturer=Linux 2.6.8.1 uhci_hcd

S:  Product=VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller

S:  SerialNumber=0000:00:11.2

C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  0mA

I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub

E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

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=0402 ProdID=5642 Rev= 1.00

S:  Product=USB 2.0 Storage Device

S:  SerialNumber=12345678901234567890

C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  0mA

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

T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  2 Spd=1.5 MxCh= 0

D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1

P:  Vendor=046d ProdID=c016 Rev= 3.40

C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA

I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=02 Driver=usbhid

E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=10ms

```

It looks like 2 devices are recognized, but for some reason my mouse isn't recognized as mouse any longer  :Sad: .

Thanks again,

vol.1

----------

## NeddySeagoon

vol1,

Your USB mouse should appear in /dev/input/ as mouseN.

The output from all the mice (USB and PS/2) cna be obtained from /dev/input/mice.

Its possible that your mouse jumps from mouse0  to mouse1 when your USB drive is plugged in.

What does your /etc/X11/xorg.conf (or XF86Config) use as a device to find the mouse?

You can 

```
cat /dev/input/mice
```

to check that mouse events are still reported when its not working.

Looking at your /proc/bus/usb/devices you only appear to have a single root hub. Would this be a laptop ?

----------

## vol1

Hi,

both, /dev/input/mouse0 (my Touchpad) and /dev/mouse1 (my USB mouse) do exist, but the USB mouse (/dev/mouse1) doesn't produce any output  :Sad: . And /dev/input/mice only produces output when I use my touchpad.

/etc/X11/XF86Config contains the following mouse-related lines:

```

Section "InputDevice"

    Identifier  "Mouse1"

    Driver      "mouse"

    Option "Protocol"    "Auto"

    Option "Device"      "/dev/mouse"

EndSection

Section "InputDevice"

    Identifier  "USB-Mouse"

    Driver      "mouse"

    Option      "Protocol"      "IMPS/2"

    Option      "Device"        "/dev/input/mice"

    Option      "ZAxisMapping"  "4 5"

    Option      "Emulate3Buttons"

EndSection

    InputDevice "Mouse1" "CorePointer"

    InputDevice "USB-Mouse" "SendCoreEvents"

```

Do you think there's anything wrong with that?

Thanks,

vol.1

----------

## NeddySeagoon

vol1,

That looks fine. With those settings you should be able to use either or both mice.

If you don't get any output from your USB mouse, itsa kernel issue?

Pust the USB section of your kernel .config file please.

----------

## vol1

Hi,

here's the USB related stuff of my Kernel config file - hope you can read something useful out of the lines:

```

#

# USB support

#

CONFIG_USB=y

CONFIG_USB_DEBUG=y

#

# Miscellaneous USB options

#

CONFIG_USB_DEVICEFS=y

# CONFIG_USB_BANDWIDTH is not set

# CONFIG_USB_DYNAMIC_MINORS is not set

#

# USB Host Controller Drivers

#

# CONFIG_USB_EHCI_HCD is not set

CONFIG_USB_OHCI_HCD=y

CONFIG_USB_UHCI_HCD=y

#

# USB Device Class drivers

#

# CONFIG_USB_AUDIO is not set

# CONFIG_USB_BLUETOOTH_TTY is not set

# CONFIG_USB_MIDI is not set

# CONFIG_USB_ACM is not set

CONFIG_USB_PRINTER=m

CONFIG_USB_STORAGE=y

# CONFIG_USB_STORAGE_DEBUG is not set

# CONFIG_USB_STORAGE_RW_DETECT is not set

# CONFIG_USB_STORAGE_DATAFAB is not set

CONFIG_USB_STORAGE_FREECOM=y

CONFIG_USB_STORAGE_ISD200=y

# CONFIG_USB_STORAGE_DPCM is not set

# CONFIG_USB_STORAGE_HP8200e is not set

# CONFIG_USB_STORAGE_SDDR09 is not set

# CONFIG_USB_STORAGE_SDDR55 is not set

# CONFIG_USB_STORAGE_JUMPSHOT is not set

#

# USB Human Interface Devices (HID)

#

CONFIG_USB_HID=y

CONFIG_USB_HIDINPUT=y

# CONFIG_HID_FF is not set

# CONFIG_USB_HIDDEV is not set

# CONFIG_USB_AIPTEK is not set

# CONFIG_USB_WACOM is not set

# CONFIG_USB_KBTAB is not set

# CONFIG_USB_POWERMATE is not set

# CONFIG_USB_MTOUCH is not set

# CONFIG_USB_EGALAX is not set

# CONFIG_USB_XPAD is not set

# CONFIG_USB_ATI_REMOTE is not set

#

# USB Imaging devices

#

# CONFIG_USB_MDC800 is not set

# CONFIG_USB_MICROTEK is not set

# CONFIG_USB_HPUSBSCSI is not set

#

# USB Multimedia devices

#

# CONFIG_USB_DABUSB is not set

#

# Video4Linux support is needed for USB Multimedia device support

#

#

# USB Network adaptors

#

# CONFIG_USB_CATC is not set

# CONFIG_USB_KAWETH is not set

# CONFIG_USB_PEGASUS is not set

# CONFIG_USB_RTL8150 is not set

# CONFIG_USB_USBNET is not set

#

# USB port drivers

#

# CONFIG_USB_USS720 is not set

#

# USB Serial Converter support

#

# CONFIG_USB_SERIAL is not set

#

# USB Miscellaneous drivers

#

# CONFIG_USB_EMI62 is not set

# CONFIG_USB_EMI26 is not set

# CONFIG_USB_TIGL is not set

# CONFIG_USB_AUERSWALD is not set

# CONFIG_USB_RIO500 is not set

# CONFIG_USB_LEGOTOWER is not set

# CONFIG_USB_LCD is not set

# CONFIG_USB_LED is not set

# CONFIG_USB_CYTHERM is not set

# CONFIG_USB_SPEEDTOUCH is not set

# CONFIG_USB_PHIDGETSERVO is not set

# CONFIG_USB_TEST is not set

#

# USB Gadget Support

#

CONFIG_USB_GADGET=m

CONFIG_USB_GADGET_NET2280=y

CONFIG_USB_NET2280=m

# CONFIG_USB_GADGET_PXA2XX is not set

# CONFIG_USB_GADGET_GOKU is not set

# CONFIG_USB_GADGET_SA1100 is not set

# CONFIG_USB_GADGET_DUMMY_HCD is not set

CONFIG_USB_GADGET_DUALSPEED=y

CONFIG_USB_ZERO=m

CONFIG_USB_ETH=m

CONFIG_USB_ETH_RNDIS=y

CONFIG_USB_GADGETFS=m

# CONFIG_USB_FILE_STORAGE is not set

# CONFIG_USB_G_SERIAL is not set

```

PS: I'm using Kernel 2.6.8.1

So long,

vol.1

----------

## NeddySeagoon

vol1,

I'm surprised your USB works at all. 

Heres the things I would change:- 

CONFIG_USB_DEBUG=y turn this off. It fills your logs full of messages you probably don't want.

CONFIG_USB_OHCI_HCD=y  turn this off. You have a VIA chip set, so want the UHCI_HCD driver below. When you say =Y to both, normally neither works.

Turing off debug will make it faster but other than that, I'm not sure it will have any positive impact on your mouse.

----------

## vol1

Hi again,

I did as you wrote (so my kernel got smaller) and still works, thanks! But as you already suspected these changes had no effect on my 'mouse problem'.

Nevertheless,

thanks for your help,

vol.1

----------

## Tsonn

Do the different orders cause modules to be loaded in a different order?

If so, you could force the modules to always be loaded in the other that works by adding them to /etc/modules.autoload.d/kernel-2.6.

----------

## NeddySeagoon

26199,

Nice idea. At the moment, the modules in question are built into the kernel, so they are always loaded. See the snippet of .config further up the thread.

Maybe going modular and using hotplug would be a work around. Then the modules would be loaded and unloaded by the hotplug scripts.

----------

## Tsonn

Worth a try. Then you can mess with rmmod and modprobe until things work  :Smile: 

----------

## vol1

Hi,

I'd like to give it a try. Could one of you tell me what drivers I have to build as modules? And does hotplug recognize them automatically or do I have to edit some config files?

I guess 

CONFIG_USB_UHCI_HCD=m ?

CONFIG_USB_STORAGE=m ?

Please try to stop laughing if it's totally wrong   :Wink: .

Thanks,

vol.1

----------

## NeddySeagoon

vol1,

I've not had much luck with hotplug. You need to build kernel support for it but exclude PCI Hotplug Support.

You need usbstorage and both the HID... modules as modules. CONFIG_USB_UHCI_HCD=m as a module is harmless. Its the driver for your motherboard hardware and needs to be loaded for any USB stuff to work.

I'll leave the detail to 26199.

----------

## Tsonn

Like I know what I'm talking about  :Wink: 

Yeah, that sounds like a good start. If EHCI_HCD or OHCI_HCD are enabled, those ought to be changed to modules as well.

Hotplug has always worked pretty painlessly for me, so, I don't have much experience with ways in which it can go wrong  :Smile: 

----------

## NeddySeagoon

26199,

Well, some pointers to the hotplug scripts would be handy.

----------

## Tsonn

Hmm. Scripts seem to be in /etc/hotplug, but, I've never messed with them. The default ones are probably all you need  :Question: 

----------

## vol1

Hi,

kernel support for hotplug (with exclusion of PCI Hotplug support) was already set in my .config file.

I build usbstorage and CONFIG_USB_HID as modules, but "make & make modules_install" didn't let me build CONFIG_USB_HIDINPUT as module, so I said 'y'.

@NeddySeagoon: As you wrote CONFIG_USB_UHCI_HCD=m is harmless, does that mean I also can let it set to 'y' (as I did)?

After I rebooted with my 'new' kernel, my mouse worked (but maybe I've added an option to load it at login time - I'm not sure where to look for this), and when I plug the USB drive my mouse is dead again  :Sad: , but the drive still gets recognized.

Any hints?

----------

## vol1

Forget my writing about 'the USB driver might be loaded at boot time', I just rememberd where the autoload option for modules could be found  :Embarassed:  (/etc/modules.autoload.d). And I had set these option for my USB driver, but in Kernel 2.4, not in 2.6 that I'm using.

So I guess it didn't work!? Are are there still any options/preferences I've to set?

Thanks,

vol.1

----------

