Re: Is extra USB event possible in FreeBSD 8?

From: Hans Petter Selasky <hselasky_at_c2i.net>
Date: Fri, 17 Jul 2009 13:22:53 +0200
Hi,

On Friday 17 July 2009 09:14:01 Sagara Wijetunga wrote:
> Sagara Wijetunga writes:
> > Hi FreeBSD community
> >
> > I want to identify the device created (eg. da0, da1, etc.) for an USB
> > Mass Storage device with its vendor and product identification numbers.
> >
> > Currently, FreeBSD 8 send following events to the devd on attach of an
> > USB Mass Storage device:
> > !system=DEVFS subsystem=CDEV type=CREATE cdev=usb/4.3.0
> > !system=DEVFS subsystem=CDEV type=CREATE cdev=ugen4.3
> > !system=DEVFS subsystem=CDEV type=CREATE cdev=usb/4.3.1
> > !system=DEVFS subsystem=CDEV type=CREATE cdev=usb/4.3.2
> >
> > +ugen4.3 vendor=0x0718 product=0x0081 devclass=0x00 devsubclass=0x00
> > sernum="14925B00" at port=7 on ugen4.1
> >
> > ? at port=7 interface=0 vendor=0x0718 product=0x0081 devclass=0x00
> > devsubclass=0x00 sernum="14925B00" intclass=0x08 intsubclass=0x06 on
> > uhub4
> >
> > +umass1 vendor=0x0718 product=0x0081 devclass=0x00 devsubclass=0x00
> > sernum="14925B00" intclass=0x08 intsubclass=0x06 at port=7 interface=0
> > vendor=0x0718 product=0x0081 devclass=0x00 devsubclass=0x00
> > sernum="14925B00" intclass=0x08 intsubclass=0x06 on uhub4
> >
> > !system=DEVFS subsystem=CDEV type=CREATE cdev=pass4
> > !system=DEVFS subsystem=CDEV type=CREATE cdev=da4
> > !system=DEVFS subsystem=CDEV type=CREATE cdev=da4s1
> > !system=DEVFS subsystem=CDEV type=CREATE cdev=msdosfs/
> >
> > Is it possible to get an extra event to the devd with the device created
> > (eg. da0, da1, etc.) with its vendor and product identification numbers?
> > eg. +da0 vendor=0x0718 product=0x0081 ...
>
> Hi FreeBSD community
>
> In case if my earlier post was not clear, here are bit more detail to
> explain my question.
>
> We want to catch device creation USB events at the devd and take actions as
> specified in following devd rules:
>
> attach 200 {
> 	match "vendor"  "0x0718";
>         match "product" "0x0081";
>         match "sernum"  "14925B00";
>         device-name     "da[0-9]+";
> 	action "action $device-name otherparams";
> };

It is not USB that creates /dev/daXXX. This is done by the CAM layer and its 
subsystems. Also the CAM layer does not have any place to supply such 
information. What we could possibly do is to fake a SCSI command providing the 
CAM layer with the required information.

Else, are you aware about disk-labels, to uniquely identify disks?

>
> It does not matter for us if the event type is attach or notification as
> long as all the above necessary information is available to make a match.
>
> Currently USB subsystem in FreeBSD 8 does not send all these crucial
> information in one event to make such a match possible.
>
> There is no such event in FreeBSD 7. This is a very basic feature should be
> available in first place.
>
> Since the USB subsystem is rewritten in FreeBSD 8 to make it better, my
> question, is it possible to make a modification to FreeBSD 8 to send an
> extra event to the devd with the device created (eg. da0, da1, da0s1, etc.)
> with its vendor and product identification numbers for USB mass storage
> devices on attaching them to the system?
> eg. +da0 vendor=0x0718 product=0x0081 ...
>     +da0s1 vendor=0x0718 product=0x0081 ...
>
> This is a requirement of the Tomahawk Desktop OS to make Tomahawk Desktop
> very much user friendly, Tomahawk Desktop is a free for any personal use
> desktop OS build on top of FreeBSD (http://www.tomahawkcomputers.com/).
>
> Your positive reply on this issue is very much appreciated.

--HPS
Received on Fri Jul 17 2009 - 09:23:55 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:52 UTC