Skip to contentSkip to conversation

udev rule for usb drive

DISCUSSION Mike Mildner 2 participants 3 messages May 28, 2009

lore
Share & tools
lore
#0 lore raw

hi all,

i know its cold coffee for you but i ask you again:

i can't write a rule for my usb disk. the debug modus don't help. so i hope you can help me.

root@host:#udevinfo -a -p $(udevinfo -q path -n /dev/sdc)

looking at device '/block/sdc':

    KERNEL="sdc"
    SUBSYSTEM="block"
    DRIVER=""
    ATTR{stat}="   21360   267403   289160    85764        0        0        0        0        0    52076    85756"
    ATTR{size}="976773168"
    ATTR{removable}="0"
    ATTR{range}="16"
    ATTR{dev}="8:32"

looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb3/3-1/3-1:1.0/host4/target4:0:0/4:0:0:0':

    KERNELS="4:0:0:0"
    SUBSYSTEMS="scsi"
    DRIVERS="sd"
    ATTRS{ioerr_cnt}="0x0"
    ATTRS{iodone_cnt}="0x5377"
    ATTRS{iorequest_cnt}="0x5377"
    ATTRS{iocounterbits}="32"
    ATTRS{timeout}="30"
    ATTRS{state}="running"
    ATTRS{rev}="    "
    ATTRS{model}="HD501LJ         "
    ATTRS{vendor}="SAMSUNG "
    ATTRS{scsi_level}="3"
    ATTRS{type}="0"
    ATTRS{queue_type}="none"
    ATTRS{queue_depth}="1"
    ATTRS{device_blocked}="0"
    ATTRS{max_sectors}="240"

looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb3/3-1/3-1:1.0/host4/target4:0:0':

    KERNELS="target4:0:0"
    SUBSYSTEMS=""
    DRIVERS=""

looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb3/3-1/3-1:1.0/host4':

    KERNELS="host4"
    SUBSYSTEMS=""
    DRIVERS=""

looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb3/3-1/3-1:1.0':

    KERNELS="3-1:1.0"
    SUBSYSTEMS="usb"
    DRIVERS="usb-storage"
    ATTRS{interface}="Bulk Only Interface"
    ATTRS{modalias}="usb:v04FCp0C25d0103dc00dsc00dp00ic08isc06ip50"
    ATTRS{bInterfaceProtocol}="50"
    ATTRS{bInterfaceSubClass}="06"
    ATTRS{bInterfaceClass}="08"
    ATTRS{bNumEndpoints}="02"
    ATTRS{bAlternateSetting}=" 0"
    ATTRS{bInterfaceNumber}="00"

looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb3/3-1':

    KERNELS="3-1"
    SUBSYSTEMS="usb"
    DRIVERS="usb"
    ATTRS{configuration}="Bulk Only Configuration"
    ATTRS{serial}="SAMSUNG HDS0MUJ1NQA49906      "
    ATTRS{product}="USB to Serial-ATA bridge"
    ATTRS{manufacturer}="Sunplus Technology Inc."
    ATTRS{maxchild}="0"
    ATTRS{version}=" 2.00"
    ATTRS{devnum}="2"
    ATTRS{speed}="480"
    ATTRS{bMaxPacketSize0}="64"
    ATTRS{bNumConfigurations}="1"
    ATTRS{bDeviceProtocol}="00"
    ATTRS{bDeviceSubClass}="00"
    ATTRS{bDeviceClass}="00"
    ATTRS{bcdDevice}="0103"
    ATTRS{idProduct}="0c25"
    ATTRS{idVendor}="04fc"
    ATTRS{bMaxPower}="  2mA"
    ATTRS{bmAttributes}="c0"
    ATTRS{bConfigurationValue}="1"
    ATTRS{bNumInterfaces}=" 1"

looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb3':

    KERNELS="usb3"
    SUBSYSTEMS="usb"
    DRIVERS="usb"
    ATTRS{configuration}=""
    ATTRS{serial}="0000:00:1d.7"
    ATTRS{product}="EHCI Host Controller"
    ATTRS{manufacturer}="Linux 2.6.18-6-686 ehci_hcd"
    ATTRS{maxchild}="4"
    ATTRS{version}=" 2.00"
    ATTRS{devnum}="1"
    ATTRS{speed}="480"
    ATTRS{bMaxPacketSize0}="64"
    ATTRS{bNumConfigurations}="1"
    ATTRS{bDeviceProtocol}="01"
    ATTRS{bDeviceSubClass}="00"
    ATTRS{bDeviceClass}="09"
    ATTRS{bcdDevice}="0206"
    ATTRS{idProduct}="0000"
    ATTRS{idVendor}="0000"
    ATTRS{bMaxPower}="  0mA"
    ATTRS{bmAttributes}="e0"
    ATTRS{bConfigurationValue}="1"
    ATTRS{bNumInterfaces}=" 1"

looking at parent device '/devices/pci0000:00/0000:00:1d.7':

    KERNELS="0000:00:1d.7"
    SUBSYSTEMS="pci"
    DRIVERS="ehci_hcd"
    ATTRS{broken_parity_status}="0"
    ATTRS{enable}="1"
    ATTRS{modalias}="pci:v00008086d000025ADsv000015D9sd00005180bc0Csc03i20"
    ATTRS{local_cpus}="ff"
    ATTRS{irq}="209"
    ATTRS{class}="0x0c0320"
    ATTRS{subsystem_device}="0x5180"
    ATTRS{subsystem_vendor}="0x15d9"
    ATTRS{device}="0x25ad"
    ATTRS{vendor}="0x8086"

looking at parent device '/devices/pci0000:00':

    KERNELS="pci0000:00"
    SUBSYSTEMS=""
    DRIVERS=""

thats the device and i try some houres around this rule:

SUBSYSTEMS="usb", KERNEL="sd??", ATTRS{serial}="SAMSUNG HDS0MUJ1NQA49906 ", SYMLINK+="usbplatte%n"

what is the trick? after every change on this rule i used 'udevcontrol reload_rules' but /dev dosen't show the device 'usbplatte'?

please give me a hint.
thanks a lot!

#1 lore raw

hi all,

i know its cold coffee bur i ask you again:

i can't write a rule for me usb disk. the debug modus dosn't help. so i hope you can help me.

| Mike Mildner <[email protected]> E+: +49 177 69 21 650         | 
| imunixx GmbH - UNIX consultanting - http://www.imunixx.de            | 
| H.-Heine-Str. 4, 01468 Friedewald Tel. +49-351-83975-0, Fax -25      | 
| ******************************************************************** | 
| * Es gibt zwei Dinge die Unendlich sind. Das Universum,            * | 
| * und die menschliche Dummheit. Wobei ich mir beim Universum noch  * | 
| * nicht ganz sicher bin.                           Albert Einstein * | 
| ******************************************************************** | 
#2 lore raw
In reply to Mike Mildner
Quoted 5 lines · Mike Mildner

thats the device and i try some houres around this rule:

SUBSYSTEMS="usb", KERNEL="sd??", ATTRS{serial}="SAMSUNG HDS0MUJ1NQA49906      ", SYMLINK+="usbplatte%n"

what is the trick? after every change on this rule i used 'udevcontrol reload_rules' but /dev dosen't show the device 'usbplatte'?

--reload-rules does nothing on any usual system, it just reparses the rules, which is not needed, because udevd detects changes itself.

You have to re-connect the device to get the rules applied.

Also replace the KERNEL="sd??", which will never match on the disk itself, only on partition 1-9 with "sd*", or just use SUBSYSTEM="block".

Kay