Re: Is extra USB event possible in FreeBSD 8?

From: Bernd Walter <ticso_at_cicely7.cicely.de>
Date: Fri, 17 Jul 2009 17:02:23 +0200
On Fri, Jul 17, 2009 at 04:55:56PM +0800, Sagara Wijetunga wrote:
> Hans Petter Selasky writes: 
> 
> >>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? 
> >
> 
> Hi Hans Petter 
> 
> Thank you very much for your prompt reply. 
> 
> Regarding "disk-labels", is it "label:" tag you specify for bsdlabel with 
> -A option? 
> 
> If it is, this option is out. Almost all of the USB mass storage devices, 
> eg. USB flash disks, cameras, audio players, etc. are already formatted. We 
> cannot ask users to format first (ie. in FreeBSD terms create disk lables, 
> create files systems, etc) before use as it make no sense at all. Eg. One 
> buy a camera at the airport, take photos on a tour, after the tour wants to 
> transfer photos to the computer. Now its too late to create labels. 

There are more label types.
glabel is the tool to create partition label, which reduces disk size and
requires reformating, but geom_label can use other labels as well.
msdosfs has it's media name in the filesystem header.
E.g. my camera media identifies as /dev/msdosfs/HP_Mz60 and my cell phone
under /dev/msdosfs/E65
UFS labels indentify under /dev/ufs, ...
Those label names can be changed at any time on already formated media,
since they are already part of the filesystem.

> Therefore, your first option sounds interesting. I'm not sure is it the 
> correct way forward. As you are the USB expert, could you recommend the 
> correct solution? 

You want to identify media not USB devices.

-- 
B.Walter <bernd_at_bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
Received on Fri Jul 17 2009 - 13:02:39 UTC

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