07.06.2014 Views

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

• $major or %M: the kernel major number of the device;<br />

• $minor or %m: the kernel minor number of the device;<br />

• $result or %c: the string output by the last program invoked by PROGRAM;<br />

• and, finally, %% and $$ for the percent and dollar sign, respectively.<br />

The above lists are not complete (they include only the most important parameters), but the<br />

udev(7) manual page should be.<br />

9.11.4. A concrete example<br />

Let us consider the case of a simple USB key and try to assign it a fixed name. First, you must<br />

find the elements that will identify it in a unique manner. For this, plug it in and run udevadm<br />

info -a -n /dev/sdc (replacing /dev/sdc with the actual name assigned to the key).<br />

# udevadm info -a -n /dev/sdc<br />

[...]<br />

looking at device '/devices/pci0000:00/0000:00:10.3/usb1<br />

➥ /1-2/1-2.2/1-2.2:1.0/host9/target9:0:0/9:0:0:0/block/sdc':<br />

[...]<br />

KERNEL=="sdc"<br />

SUBSYSTEM=="block"<br />

DRIVER==""<br />

ATTR{range}=="16"<br />

ATTR{ext_range}=="256"<br />

ATTR{removable}=="1"<br />

ATTR{ro}=="0"<br />

ATTR{size}=="126976"<br />

ATTR{alignment_offset}=="0"<br />

ATTR{capability}=="53"<br />

ATTR{stat}==" 51 100 1208 256 0 0<br />

➥ 0 0 0 192 25 6"<br />

ATTR{inflight}==" 0 0"<br />

looking at parent device '/devices/pci0000:00/0000:00:10.3/usb1<br />

➥ /1-2/1-2.2/1-2.2:1.0/host9/target9:0:0/9:0:0:0':<br />

KERNELS=="9:0:0:0"<br />

SUBSYSTEMS=="scsi"<br />

DRIVERS=="sd"<br />

ATTRS{device_blocked}=="0"<br />

ATTRS{type}=="0"<br />

ATTRS{scsi_level}=="3"<br />

ATTRS{vendor}=="I0MEGA "<br />

ATTRS{model}=="UMni64MB*IOM2C4 "<br />

216 The Debian Administrator's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!