Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Mar 2004 18:21:44 +0100
From:      Bernd Walter <ticso@cicely12.cicely.de>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        ticso@cicely.de
Subject:   Opinions about using USB serial numbers - Patch
Message-ID:  <20040323172142.GF63452@cicely12.cicely.de>
In-Reply-To: <20040322151647.GU63452@cicely12.cicely.de>
References:  <20040320052007.GC33602@cicely12.cicely.de> <20040320.184336.88475380.imp@bsdimp.com> <20040321071100.GH33602@cicely12.cicely.de> <20040322123048.GP63452@cicely12.cicely.de> <20040322151647.GU63452@cicely12.cicely.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 22, 2004 at 04:16:48PM +0100, Bernd Walter wrote:
> On Mon, Mar 22, 2004 at 01:30:49PM +0100, Bernd Walter wrote:
> > What still puzzles me is why only the nomatch event includes pnpinfo.
> 
> I've found the code in subr_bus and it looks very intentionally to me.
> Should I move the serial number into the location string?
> Or can we add the pnpinfo to attach/detach messages as well?

I just added pnpinfo to attach/detach messages as well and I managed to
get devd to create the required symlinks:
Processing event '+ubser0 vendor=0x03da product=0x0001 devclass=0x00 devsubclass=0x00 sernum="1080054842" intclass=0xff intsubclass=0x00 at port=3 interface=0 on uhub3'
Pushing table
device-name=ubser0
vendor=0x03da
product=0x0001
devclass=0x00
devsubclass=0x00
sernum=1080054842
intclass=0xff
intsubclass=0x00
Processing attach event
Testing device-name=ubser0 against ^ed50
Testing device-name=ubser0 against ^ubser[0-9]+
Executing '/etc/devd/ubser-start.sh ubser0 1080054842'
Popping table
Processing event '-ubser0 vendor=0x03da product=0x0001 devclass=0x00 devsubclass=0x00 sernum="" intclass=0xff intsubclass=0x00 at port=3 interface=0 on uhub3'
Pushing table
device-name=ubser0
vendor=0x03da
product=0x0001
devclass=0x00
devsubclass=0x00
sernum=
intclass=0xff
intsubclass=0x00
Processing detach event
Testing device-name=ubser0 against ^ed50
Testing device-name=ubser0 against ^ubser[0-9]+
Executing '/etc/devd/ubser-stop.sh ubser0 '
Popping table

[102]cicely13# ls -al /dev/ubser0.*
crw-rw----  1 uucp  dialer  233,   0 Mar 23 17:34 /dev/ubser0.0
crw-rw----  1 uucp  dialer  233,   1 Mar 23 17:34 /dev/ubser0.1
lrwxr-xr-x  1 root  wheel          8 Mar 23 17:54 /dev/ubser.1080054842.0 -> ubser0.0
lrwxr-xr-x  1 root  wheel          8 Mar 23 17:54 /dev/ubser.1080054842.1 -> ubser0.1
lrwxr-xr-x  1 root  wheel          8 Mar 23 17:54 /dev/ubser.1080054842.2 -> ubser0.2
lrwxr-xr-x  1 root  wheel          8 Mar 23 17:54 /dev/ubser.1080054842.3 -> ubser0.3
lrwxr-xr-x  1 root  wheel          8 Mar 23 17:54 /dev/ubser.1080054842.4 -> ubser0.4
lrwxr-xr-x  1 root  wheel          8 Mar 23 17:54 /dev/ubser.1080054842.5 -> ubser0.5
crw-rw----  1 uucp  dialer  233,   2 Mar 23 17:34 /dev/ubser0.2
crw-rw----  1 uucp  dialer  233,   3 Mar 23 17:34 /dev/ubser0.3
crw-rw----  1 uucp  dialer  233,   4 Mar 23 17:34 /dev/ubser0.4
crw-rw----  1 uucp  dialer  233,   5 Mar 23 17:34 /dev/ubser0.5
[103]cicely13# ls -al /dev/ubser0.*
ls: No match.
Exit 1

The detach message doesn't contain the serial since this is not cached
as the other values - however the device-name is enough to rm the links
at detach because we know they are pointing to ubser0.* nodes.
Since this is an interface level driver I should add the interface
number to the symlink name as well - but that's up to the one
configuring devd.

The patch is at http://www.bwct.de/usb-devd.patch

-- 
B.Walter                   BWCT                http://www.bwct.de
ticso@bwct.de                                  info@bwct.de



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040323172142.GF63452>