Skip to contentSkip to conversation

getting /dev entries for USB devices

DISCUSSION Stephen Morgan 2 participants 4 messages Apr 22, 2005 – Apr 28, 2005

lore
Share & tools
lore
#0 lore raw

Hello all,

I'm trying to get udev to create nodes for my USB devices. There will be several of the same device and I need their nodes named according to their bus location.

I created this rule file in /etc/udev/rules.d, called it 05-aa_dev.rules

BUS="usb", PLACE="1.1", NAME="aa_dev01"
BUS="usb", PLACE="1.2", NAME="aa_dev02"
BUS="usb", PLACE="2.1", NAME="aa_dev03"
BUS="usb", PLACE="2.2", NAME="aa_dev04"
BUS="usb", PLACE="3.1", NAME="aa_dev05"
BUS="usb", PLACE="3.2", NAME="aa_dev06"
BUS="usb", PLACE="4.1", NAME="aa_dev07"
BUS="usb", PLACE="4.2", NAME="aa_dev08"

When I plug the devices in, I see a new entry show up in /sys/bus/usb/devices, for instance "3-1". In that directory, I can find the idProduct and idVendor that match my device - so far, so good.

But nothing ever shows up in /dev. I should see one of my device names appear, shouldn't I?

I've read Daniel Drake's article on writing rules, but I'm sure I could be missing something.

Thanks for your help.

Stephen Morgan

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 32 lines

-----Original Message-----
From: Stephen Morgan [mailto:[email protected]]
Sent: Friday, April 22, 2005 10:02 AM
To: [email protected]
Subject: getting /dev entries for USB devices

Hello all,

I'm trying to get udev to create nodes for my USB devices. There will be several of the same device and I need their nodes named according to their bus location.

I created this rule file in /etc/udev/rules.d, called it 05-aa_dev.rules

BUS="usb", PLACE="1.1", NAME="aa_dev01"
BUS="usb", PLACE="1.2", NAME="aa_dev02"
BUS="usb", PLACE="2.1", NAME="aa_dev03"
BUS="usb", PLACE="2.2", NAME="aa_dev04"
BUS="usb", PLACE="3.1", NAME="aa_dev05"
BUS="usb", PLACE="3.2", NAME="aa_dev06"
BUS="usb", PLACE="4.1", NAME="aa_dev07"
BUS="usb", PLACE="4.2", NAME="aa_dev08"

When I plug the devices in, I see a new entry show up in /sys/bus/usb/devices, for instance "3-1". In that directory, I can find the idProduct and idVendor that match my device - so far, so good.

But nothing ever shows up in /dev. I should see one of my device names appear, shouldn't I?

Quoted 7 lines

I've read Daniel Drake's article on writing rules, but I'm sure I could be missing something.

Thanks for your help.

Stephen Morgan

Is there a simple way to tell if the .rules file is being applied, I mean, other than the nodes appearing in /dev? I've tried intentionally putting typos in my file and in 50-udev.rules, but couldn't see that it affected anything.

I don't see a lot of use of PLACE in .rules files, is it working okay?

running Fedora Core 3 (Linux 2.6.9-1.667, which uses udev version 039)

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id5hix
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Stephen Morgan
Quoted 15 lines · Stephen Morgan
Quoted 15 lines

I'm trying to get udev to create nodes for my USB devices. There will be several of the same device and I need their nodes named according to their bus location.

I created this rule file in /etc/udev/rules.d, called it 05-aa_dev.rules

BUS="usb", PLACE="1.1", NAME="aa_dev01"
BUS="usb", PLACE="1.2", NAME="aa_dev02"
BUS="usb", PLACE="2.1", NAME="aa_dev03"
BUS="usb", PLACE="2.2", NAME="aa_dev04"
BUS="usb", PLACE="3.1", NAME="aa_dev05"
BUS="usb", PLACE="3.2", NAME="aa_dev06"
BUS="usb", PLACE="4.1", NAME="aa_dev07"
BUS="usb", PLACE="4.2", NAME="aa_dev08"

Quoted 7 lines
Quoted 7 lines

When I plug the devices in, I see a new entry show up in /sys/bus/usb/devices, for instance "3-1". In that directory, I can find the idProduct and idVendor that match my device - so far, so good.

But nothing ever shows up in /dev. I should see one of my device names appear, shouldn't I?

It depends. Not all devices have device nodes. Some USB devices, like scanners, are only accessed through usbfs with a userspaces driver.

Quoted 4 lines

Is there a simple way to tell if the .rules file is being applied, I mean, other than the nodes appearing in /dev? I've tried intentionally putting typos in my file and in 50-udev.rules, but couldn't see that it affected anything.

You may run udevtest, with the DEVPATH of this device.

Quoted 1 line

I don't see a lot of use of PLACE in .rules files, is it working okay?

PLACE is not used anymore and removed from future udev versions. ID works the same way.

Kay

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id5hix
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Stephen Morgan
Quoted 36 lines

Kay Sievers wrote:

Quoted 5 lines · Stephen Morgan
Quoted 5 lines

I'm trying to get udev to create nodes for my USB devices. There will be several of the same device and I need their nodes named according to their bus location.

I created this rule file in /etc/udev/rules.d, called it

05-aa_dev.rules

Quoted 10 lines
Quoted 10 lines

BUS="usb", PLACE="1.1", NAME="aa_dev01"
BUS="usb", PLACE="1.2", NAME="aa_dev02"
BUS="usb", PLACE="2.1", NAME="aa_dev03"
BUS="usb", PLACE="2.2", NAME="aa_dev04"
BUS="usb", PLACE="3.1", NAME="aa_dev05"
BUS="usb", PLACE="3.2", NAME="aa_dev06"
BUS="usb", PLACE="4.1", NAME="aa_dev07"
BUS="usb", PLACE="4.2", NAME="aa_dev08"

Quoted 7 lines
Quoted 7 lines

When I plug the devices in, I see a new entry show up in /sys/bus/usb/devices, for instance "3-1". In that directory, I can find the idProduct and idVendor that match my device - so far, so good.

But nothing ever shows up in /dev. I should see one of my device names appear, shouldn't I?

It depends. Not all devices have device nodes. Some USB devices, like scanners, are only accessed through usbfs with a userspaces driver.

Quoted 1 line

Is there a simple way to tell if the .rules file is being

applied, I mean,

Quoted 1 line

other than the nodes appearing in /dev? I've tried

intentionally putting

Quoted 2 lines

typos in my file and in 50-udev.rules, but couldn't see that it affected anything.

Quoted 9 lines

You may run udevtest, with the DEVPATH of this device.

Quoted 1 line

I don't see a lot of use of PLACE in .rules files, is it working okay?

PLACE is not used anymore and removed from future udev versions. ID works the same way.

Kay

Hi Kay,

Thanks very much for your help - it led me directly to the answer. I'm in the process of converting my 2.4 driver to run under 2.6 and apparently I now have to create a device class in my driver before all the udev stuff will work.

But, after I added the class definition to my driver, I still wasn't getting the nodes. Running udevtest as you suggested showed my what was going wrong.

Both udev.rules.examples and man udev show examples of using PLACE like this:

BUS="usb", PLACE="1.3", NAME="mouse0"

and that's the format I used in my .rules file. But in order to match, that string should instead be:

BUS="usb", PLACE="1-3", NAME="mouse0"

dashes, not dots. I changed all the "." to "-" in my .rules and my nodes suddenly appeared!

Thanks again for you help,

Stephen

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id5hix
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel