Find /dev entries for any loaded kernel module.

11 07 2011

Hey folks, just got a quick one for you.

Recently, I needed to find out to which /dev entries a particular driver was attached. For this, I did the following.

First, navigate to /sys. This is where kernel information is stored about devices and drivers. Under here, you’ll notice folders like “block” (for storage devices) and “bus” for pluggable items such as USB devices and PCI cards.

We are going to be looking in “bus”, as the device I am looking for is connected via USB. From /sys/bus, navigate to usb/drivers, and you will see a list of all drivers currently attached to devices connected via USB.

From here, I needed the ftdi_sio driver, so I cd’d into the folder, and had a look around. Nothing which makes much sense so far, but bear with me. There will be one or multiple symlinks in this folder, which consists of numbers, hyphens, colons and dots. These link to each device’s sysfs folder. Run the command:
ls [0-9]*/

This will look in any folder which starts with a number (in this case our two device folders). Within these folders should be your information. In my case, there was a folder in each of them called ttyUSB? (where the ? was a number).

Now I knew that I just had to connect my program to /dev/ttyUSB? to communicate with the devices.

If there’s anything anybody doesn’t understand about this, feels that I could explain better, or simply wants to know more about, then feel free to let me know via the comments.

Have a great day!

n00b

Advertisements




Bootsplash patch repository!

20 11 2009

Hi guys, just a quick, but hopefully very useful message… I’ve found a repository which holds Bootsplash patches for every 2.6 kernel currently in existence! No longer will you have to trawl the Internet for hours trying to find a suitable patch!

n00b