[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: hotplug, udev and usbkey question



Bob Alexander <bob@ngi.it> writes:

These are the attributes you should look at:

>    looking at the device chain at
> '/sys/devices/pci0000:00/0000:00:1d.1/usb3/3-1':
>      BUS="usb"
>      ID="3-1"
>      DRIVER="usb"
>      SYSFS{bConfigurationValue}="1"
>      SYSFS{bDeviceClass}="00"
>      SYSFS{bDeviceProtocol}="00"
>      SYSFS{bDeviceSubClass}="00"
>      SYSFS{bMaxPower}=" 94mA"
>      SYSFS{bNumConfigurations}="1"
>      SYSFS{bNumInterfaces}=" 1"
>      SYSFS{bcdDevice}="0200"
>      SYSFS{bmAttributes}="80"
>      SYSFS{detach_state}="0"
>      SYSFS{devnum}="2"
>      SYSFS{idProduct}="0011"
>      SYSFS{idVendor}="08ec"
>      SYSFS{manufacturer}="IBM"
>      SYSFS{maxchild}="0"
>      SYSFS{product}="USB 2.0 Memory Key"
>      SYSFS{serial}="0206430D0A001CBC"
>      SYSFS{speed}="12"
>      SYSFS{version}=" 2.00"

Here is my rule (I have a Lexar USB key, one line):
BUS="usb", SYSFS{manufacturer}="LEXAR MEDIA", SYSFS{product}="JumpDrive
2.0 Pro", SYMLINK="usbkey%n", GROUP="disk", MODE="0660"

Your rule would be something like this (one line):
BUS="usb", SYSFS{manufacturer}="IBM", SYSFS{product}="USB 2.0 Memory
Key", NAME="usbkey%n", GROUP="disk", MODE="0660"

The %n in the NAME rule is so that if you have two or more usbkeys in
the system, the first gets the name usbkey1, the next usbkey2 etc (even
with just one, I think you would get usbkey1).  Note that the system
will create a usbkey, which is similar to sda for scsi harddisk.

You can make it even more specific (for instance, you want to create a
special node for this specific usbkey) by adding more SYSFS attributes,
for instance the serial, which is specific to each USB device.

Save the rules in /etc/udev/rules.d/00usbkey.rules

The number 00 is important, because you want udev to read your rule
before the default rules (it's a first come, permanent set).  You are
also required to have the .rules extension to all your rules, and it
must be in /etc/udev/rules.d (or wherever the udev_rules variable is set
in /etc/udev/udev.conf

-- 
John L. Fjellstad
web: http://www.fjellstad.org/          Quis custodiet ipsos custodes



Reply to: