Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcing driver to device match

Tags:

linux

kernel

usb

People also ask

What is probing in device driver?

The probe routine specifies a physical device ID as a device node property so that the bus driver can find the appropriate device driver for this device node. Note that the device ID is bus class specific.

What is device probing?

Probe() happens at the time of device boot or when device is connected.For a "platform" device the probe function is invoked when a platform device is registered and it's device name matches the name specified on the device driver.

What is kernel probe?

Kernel probes are a set of tools to collect Linux kernel debugging and performance information. Developers and system administrators usually use them either to debug the kernel, or to find system performance bottlenecks. The reported data can then be used to tune the system for better performance.

What is platform device driver?

Platform drivers are dedicated to devices not based on conventional buses. I2C devices or SPI devices are platform devices, but respectively rely on I2C or SPI buses not on the platform bus. Everything needs to be done manually with the platform driver.


Find the module in the sysfs tree. In this case it was in

/sys/bus/usb-serial/drivers/cp2101

In this directory, there is a new_id file entry that can be used to dynamically add VID PID pair like this :

echo VID PID >new_id

Here is a LWN entry about this feature


In case you want to make this change permanent and assign specific driver to device (VID, PID) you may find this answer useful.

For example create new file/etc/udev/rules.d/98-joystick.rules with content:

ACTION=="add", ATTRS{idVendor}=="1345", ATTRS{idProduct}=="6005", RUN+="/sbin/modprobe xpad" RUN+="/bin/sh -c 'echo 1345 6005 > /sys/bus/usb/drivers/xpad/new_id'"

Replace 1345 with your VID and 6005 with your PID.

Replace xpad with appropriate driver.

Run following command:

$ sudo udevadm control --reload

Unplug and plug your device back and check if the new driver is loaded.

Example shown here is for fixing driver issues with Speedlink Strike FX Gamepad (SL-6537-BK)


You don't need actually recompile the whole kernel, recompiling only relevant kernel module with updated match table will be enough, in case that this answer, does not work on your kernel.