USB devices, can they be static?

Derek Broughton news at pointerstop.ca
Thu Apr 6 13:27:43 UTC 2006


Alan McKinnon wrote:

> On Wednesday 05 April 2006 21:01, David Walker wrote:
>> So this is a question I have that I don't think there is an answer
>> to.
>>
>> I have a USB hub with 7 compact flash cards connected.  Is there
>> any way to have each flash drive always be /dev/sda (or b, or
>> etc.etc.)  So far I have found that every boot they get remapped
>> within /dev.
>>
>> So I ask, is there any way to do this?
> 
> /usr/share/doc/udev/writing_udev_rules/index.html
> 

Unfortunately no longer present in dapper!  (That makes no sense whatsoever
to me - this is one of the most useful pieces of documentation I've run
across in recent years - I think I'll file a bug against this change)

Anyway, if your system doesn't have this, just google
for "writing_udev_rules", I found it that way.

The short answer, of course, is that yes you can make all the devices
static.  The slightly longer answer is that you might find it more
convenient not to actually force them to be /dev/sda but rather use
descriptive names like /dev/CF_camera and /dev/CF_palm or
even /dev/CF1, /dev/CF2, and let the system still assign /dev/sd* as it
will.

The even longer answer is that you need to determine a way to ID the
individual device (there are vendor, product and serial number strings
available) and then create rules in /etc/udev/rules.d/ like the one used
for Palm devices:

# Create /dev/pilot symlink for Palm Pilots
KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \
                                        SYMLINK+="pilot"

In your case KERNEL is sd*, and you can use any of the SYSFS{} identifiers
to uniquely define your device, then SYMLINK+="CFsomething" will create a
symlink /dev/CFsomething for the device.
-- 
derek





More information about the ubuntu-users mailing list