Opened 19 years ago
Closed 18 years ago
#1785 closed task (invalid)
Udev Rules need verified for accuracy, completeness, and bloat
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | 6.2 |
Component: | Book | Version: | SVN |
Severity: | normal | Keywords: | |
Cc: |
Description
r7569 introduced a new method of installing rule files from a tarball instead of a monolithic file. The previous 25-lfs.rules file is left intact with some only some cosmetic changes. This gives us the ability to strip out what truly isn't needed, add what is, and modularize it more.
Change History (5)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
Okay, here's round one. Please help correct this for accuracy, grammar, and readability. I don't know how pedantic and technical I should be for the book.
All discussion of devices below refers to devices which can be properly exported by the kernel via sysfs (as discussed on xref="the page that dicusses this").
Uevent: An event generated by the kernel whenever a device is added or removed. In this context, added doesn't necessarily mean the device was just plugged in. It means the kernel now recognizes it. All devices are "added" when the kernel is first booting up.
ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus"
The files, directories, and symlinks in /sys do not all appear at once. They appear as the kernel identifies and enumerates them. However, the uevent will be generated as soon as the device is known to the kernel. For some devices, it may take the kernel an extra few milliseconds to export all the information to /sys/devices while Udev may already be processing the uevent. To avoid race conditions, this rule matches those devices (which have an ACTION of add, DEVPATH of /devices/*, and a non-empty environment variable named PHYSDEVBUS) and causes Udev to wait until the kernel has created the needed "bus" file (in this case it will be a symlink) for that particular device before it attempts to match any other rule. This gives the kernel time to enumerate the various devices and export them via sysfs.
ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt"
Very similar to the previous rule, any uevent for devices handled by the kernel's SCSI subsystem where the ACTION to take is "add" the device, Udev will wait for the existence of the file /sys/bus/scsi/devices/<device number>/ioerr_cnt.
KERNEL=="mice"
The majority of rules exist to create device nodes. In the above example any uevent generated by the kernel with the name "mice" will cause a device node to be created at /dev/mice with a default ownership of root:root and default permissions of 0660. To change the permissions or ownership, one would fine-tune the above rule as such:
KERNEL=="mice", MODE="0644", GROUP="some group"
Further additions to the rule allow modifying the location where the device node is created. For example, /dev/mice is not the standard location for the mice device node, /dev/input/mice is. We can acheive this with:
KERNEL=="mice", MODE="0644", GROUP="some group", NAME="input/%k"
Finally, if this device commonly has a symlink associated with it -- for example, /dev/mouse often is a symlink to /dev/input/mice -- you can acheive this with the following:
KERNEL=="mice", MODE="0644", GROUP="some group", NAME="input/%k", SYMLINK="mouse"
A final word of caution: Any particular rule must be written on one line and a comma must separate each part of the rule.
comment:3 by , 19 years ago
Did you mean for the above to go into this ticket? It seems to me that it fits better with #1790, unless I misinterpreted your intentions.
comment:5 by , 18 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
What do we do with this? It seems it is no longer LFS's bug. Closing.
The first change pending regards possible Suse-specific liness mentioned in ticket #1769