0
votes

I have a usb kernel module that needs to be loaded after it has been insmoded without waiting for re-enumeration

The uses case is something like this - Build and insmod the kernel module. - The user has the usb devices plugged in, so he/she expects the device to work -The driver is present(modprobe show is) but not loaded, thus the usb device does not work

Is there a way I can force the kernel to reenumarate a given device, I am currently looking at libusb,it seems like the accomplish something similar by issuing an IOCTL.

1
Perhaps it's your use of 'load' that is confusing the issue. Running insmod loads a kernel module. If a module shows up with lsmod, it has been loaded. Is the module not detecting the USB device the problem you need help solving?ctuffli
no my module is detecting the USB device, but for it to appear in lsmod I need to unplug and plug it back in. Of course this only happens once, right after the driver has been insmoded.Stb

1 Answers

0
votes

I am a little confused on exactly what you are asking.

Your device's driver should support the "probe" call. When a new device is plugged in, the lower-level USB drivers will detect and enumerate the device(s). After finding each device, it will call the probe functions of all registered USB drivers, passing a reference of the newly found device. This gives each driver the opportunity to "claim" the device as it's own, if it deems it should be used to drive the device.

This enumeration will automatically happen when the devices are plugged in - or (simply speaking) when a new USB module is loaded and registered.