LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Forcing a specific driver for a device, through udev (http://www.linuxquestions.org/questions/linux-hardware-18/forcing-a-specific-driver-for-a-device-through-udev-836411/)

indienick 10-05-2010 05:38 PM

Forcing a specific driver for a device, through udev
 
My co-workers and I are trying to develop a USB device, which uses an FTDI chip as a USB-serial controller. The thing is, we would ideally like to set a cusom idVendor and idProduct on the FTDI chip.

The problem occurs that when we set custom idVendor and idProduct values, udev(7) loads the "usb" driver. If we leave the idVendor and idProduct values to their originals, udev(7) loads the "ftdi_sio" driver. The whole reason for the custom idVendor and idProduct values is so that I can (hopefully) write a udev(7) rule to map that particular device to a specific entry in /dev.

Is there a way to write a udev(7) rule so that you can forcefully load a particular driver for a device? Is there something else that could be done to get a similar result?

Google searching hasn't yielded anything conclusive, yet.

gdejonge 10-06-2010 04:56 AM

Strange, I did a google search on writing udev rules and it came up with
http://www.reactivated.net/writing_udev_rules.html

So you probably need something like this:
Code:

SUBSYSTEM="usb", ATTRS{idVendor}="xxxx", ATTRS{idProduct}="xxxx", RUN+="modprobe ftdi_sio" NAME="Whatever"
Also you should check the directories /etc/udev/rules.d and /lib/udev/rules.d

_______________
Gerrard

indienick 10-06-2010 11:46 AM

Thanks, gdejonge. I've read that too.

After poking around on IRC last night, I discovered that once it gets to udev(7), it's a little too late. The kernel needs to somehow be told that the device is supposed to use the ftdi_sio driver, instead of the usb driver.

It's starting to look like I might need to copy and modify the ftdi_sio driver to look for the specific idVendor and idProduct values, unless there is a way to do it with modules.d and surrounding bits.

EDIT: Alright, so I have solved this issue. We cannot change the idVendor and idProduct values of the FTDI chip if we want the kernel to recognize the device and use the ftdi_sio driver. I ended up concocting a udev(7) rule that will catch the FTDI USB-serial device and provide a nice, descriptive symlink.

The only other alternative I could see was copying and modifying the ftdi_sio driver from the kernel sources.


All times are GMT -5. The time now is 06:59 AM.