From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Thu, 08 Jan 2004 11:18:52 +0000 Subject: Re: scsi-devfs.sh Message-Id: <20040108111852.GA2023@vrfy.org> List-Id: References: <200401080835.59228.remco@d-compu.dyndns.org> In-Reply-To: <200401080835.59228.remco@d-compu.dyndns.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Thu, Jan 08, 2004 at 11:51:48AM +0100, Remco wrote: > Op donderdag 08 januari 2004 11:30, schreef Kay Sievers: > > On Thu, Jan 08, 2004 at 08:35:58AM +0100, Remco wrote: > > > Analogous to the 'ide-devfs.sh' script, I created a 'scsi-devfs.sh' > > > CALLOUT script. I tried to make it useful for any SCSI device. (using > > > names taken from the Linux SCSCI 2.4 howto, so if there were any major > > > changes in 2.6 they are not reflected in the script) Since I only own one > > > external USB drive that's all I could test it with, so other devices have > > > not been tested. > > > > > > scsi-devfs.sh: > > > > > > #!/bin/sh > > > > > > # udev CALLOUT script > > > # return devfs-like-names for scsi-devices > > > # CALLOUT, BUS="scsi", PROGRAM="/etc/udev/scsi-devfs.sh %k %b %n", > > > ID="[nst*]", NAME="%1c", SYMLINK="%2c" # CALLOUT, BUS="scsi", > > > PROGRAM="/etc/udev/scsi-devfs.sh %k %b %n", ID="[scd*]", NAME="%1c", > > > SYMLINK="%2c" # CALLOUT, BUS="scsi", PROGRAM="/etc/udev/scsi-devfs.sh %k > > > %b %n", ID="s[dgrt]*", NAME="%1c", SYMLINK="%2c" > > > > What does a character class with a asterisk ID="[nst*]" mean? > > Shouldn't it be ID="nst*"? Same for ID="scd*". > > I don't know how I came up with those brackets but you're absolutely right ! > Correct me if I'm wrong but any rule like "ID=[???*]" would mean ID-ing every > device in the system and this seems pretty senseless in general. > Everything inside the brackets are a character class. A character class may contain a list of characters that should match or a range like [0-9] or [a-z]. But everything inside is only compared with one single char of the string. udev's matching is partly based on fnmatch(): http://developer.novell.com/ndk/doc/libc/index.html?page=/ndk/doc/libc/libc_enu/data/amsgxku.html You may also use only one rule in udev.rules. Just use ID="*" and exit with nonzero in the script when no device is matching your processing. The rule is only applied when the callout returns successful. thanks, Kay ------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel