![]() |
Load module on usb dongle insert...
Hi,
I have a problem with a wireless mouse on my laptop running Ubuntu 10.10. If thw receiver is plugged during boot, it works out of the box. But if I plug it in afterwards, I have to manually do Code:
sudo modprobe usbhidMy question is how to automatically load a module when a usb device with a given id is inserted? Cheers Tomek |
I've learned that the correct word is "hotplug" ;)
I have added new file usbhid.conf to /etc/modprobe.d/ with the following content Code:
#Labtec usb wireless mouseCode:
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub |
Quote:
The location of your rules directory may be different depending on your distro, but /etc/udev/rules.d or /lib/udev/rules.d are two common locations. There are loads of LQ threads dealing with udev rules, and also some pretty good tutotials on the 'net about this topic as well. See Google. In a udev rule, you can use that 'modalias' value, provided it is unique from all modaliases of your other devices, as part of the matching criteria, and tell udev to insert the usbhid driver when it finds this device, as well as any other things you wish to perform when the device is connected (run a script, issue some commands, etc..). Best of luck, whichever way you go. |
Thank you very much!
I have added this file to /etc/udev/rules.d: Code:
#Labtec wireless mouseWell, nevermind, it works this way. Thank you once more. |
I don't know all the ins and outs of this stuff and how everything ties together, but I figure that both modprobe.d/* and the udev rules, play a role, depending precisely when the device is detected; i.e.: is it found during boot, and/or is it found when it is inserted later.
For example, the UDEV rule probably plays a role first, and then, modprobe.d/* are consulted to look for any options or whatever, that are associated with the module being inserted by udev. If someone has anything to add on this subject, I would be interested in hearing more. Meanwhile, it's good to hear that you've got some success here! Cheers. |
| All times are GMT -5. The time now is 08:55 PM. |