← blog

Adding new device IDs to existing drivers on Linux (Temporary)

Often, you might want to get your incompatible hardware working with Linux using existing device drivers, but sometimes the built-in ones might not have your device ID associated with it. Linux identifies devices through Vendor ID and Product ID and loads matching drivers. However, to test out if any built in kernel module does the job of running your device, you might just want to add it’s device ID (vendor and product ID) to the driver. Let’s test!

Selection_069

In this case, I have a USB WiMAX Modem attached to my computer. I simply open up a terminal and run:

lsusb

Which gives me the output:

Bus 001 Device 012: ID 19d2:0172 ZTE WCDMA Technologies MSM AX226 WIMAX MODEM (After Modeswitch)
Bus 004 Device 002: ID 04f3:0103 Elan Microelectronics Corp.
Bus 004 Device 003: ID 09da:000a A4 Tech Co., Ltd Optical Mouse Opto 510D
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

I can easily identify my device as from it’s description, it is the first one. The most important part of it is “19d2:0172. 19d2 is the Vendor ID and 0172 is the Product ID, they are separated by a colon. I know that, the bcm_wimax module is responsible for Beceem WiMAX chips on Linux. So, I am going to add this to the bcm_wimax module. You many not find the driver name match exactly the module name, so you might want to run this to view the driver name.

sudo modprobe bcm_wimax
sudo dmesg -c

The output of this would be like:

[ 9586.202846] bcm_wimax: module is from the staging directory, the quality is unknown, you have been warned.
[ 9586.203450] beceem: Beceem Communications Inc. WiMAX driver, 5.2.45
[ 9586.203452] Copyright 2010. Beceem Communications Inc
[ 9586.203584] usbcore: registered new interface driver usbbcm

After we finally find our driver name, the syntax is like the following:

cat $VENDORID $PRODUCTID > /sys/bus/usb/drivers/$DRIVERNAME/new_id

And for our device, the values would be:

cat 19d2 0172 > /sys/bus/usb/drivers/usbbcm/new_id