Talk:Map Custom Device Entries with udev

From ArchWiki
Revision as of 17:47, 15 September 2007 by Grey (talk | contribs)
Jump to: navigation, search

Hi there, I often thought about changing this, but I'm not sure yet. This article suggests two rules for a task which only requires one rule. There has also been confusion about this on the forums. Example:

# Symlink multi-part device
BUS=="usb", SYSFS{serial}=="1730C13B18000B84", KERNEL=="sd?", NAME="%k", SYMLINK+="usbdisk", GROUP="storage"
BUS=="usb", SYSFS{serial}=="1730C13B18000B84", KERNEL=="sd?[1-9]", NAME="%k", SYMLINK+="usbdisk%n", GROUP="storage"

This can be done by one single rule (it works here, at least), like this:

BUS=="usb", SYSFS{serial}=="1730C13B18000B84", KERNEL=="sd*", NAME="%k", SYMLINK+="usbdisk%n", GROUP="storage"

Also, for simplicity, you can omit the GROUP and NAME statements, because they are already set in udev.rules, so the rule would be

BUS=="usb", SYSFS{serial}=="1730C13B18000B84", KERNEL=="sd*", SYMLINK+="usbdisk%n"

This rule will create usbdisk, usbdisk1, usbdisk2 etc. and it will leave NAME and GROUP to the defaults set in udev.rules.

Is there a reason that the wiki page suggests 2 rules here and adds redundancy to GROUP and NAME statements? Does anyone know a case where this doesn't work? brain0 09:49, 19 December 2005 (EST)

I'm reading the wiki as someone new to building and maintaining a linux system, and I'm going to record my impressions in order to maybe improve the wiki at the end.

First point: the udevinfo invocations use undocumented switches. They are short versions of what is documented in the man pages. For a user that reads the wiki alongside with running the commands this is confusing. Also a wiki should almost always use long switches for clarities sake.

Example: current wiki:

 udevinfo -a -p `udevinfo -q path -n /dev/sda`

long version:

 udevinfo --path==`udevinfo --query=path --name=/dev/sda` --attribute-walk

Also, what is the reason for not using the more direct

 udevinfo --name=/dev/sda --attribute-walk

Isn't that equivalent?