From owner-freebsd-current@FreeBSD.ORG Fri Jul 17 15:28:27 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D134106564A for ; Fri, 17 Jul 2009 15:28:27 +0000 (UTC) (envelope-from sagara@tomahawk.com.sg) Received: from us1.tomahawkonline.net (us1.tomahawkonline.net [66.98.178.56]) by mx1.freebsd.org (Postfix) with SMTP id 203B48FC19 for ; Fri, 17 Jul 2009 15:28:26 +0000 (UTC) (envelope-from sagara@tomahawk.com.sg) Received: (qmail 4082 invoked by alias); 17 Jul 2009 12:10:00 -0000 Message-ID: <20090717121000.4081.qmail@us1.tomahawkonline.net> References: <20090714123509.16504.qmail@us1.tomahawkonline.net> <200907171322.54942.hselasky@c2i.net> <20090717085556.1810.qmail@us1.tomahawkonline.net> <200907171518.20959.hselasky@c2i.net> In-Reply-To: <200907171518.20959.hselasky@c2i.net> From: "Sagara Wijetunga" To: Hans Petter Selasky Date: Fri, 17 Jul 2009 20:10:00 +0800 Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-current@freebsd.org Subject: Re: Is extra USB event possible in FreeBSD 8? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2009 15:28:27 -0000 Hans Petter Selasky writes: > On Friday 17 July 2009 10:55:56 Sagara Wijetunga wrote: >> 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. >> >> 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? > > Hi, > > Seems to me like this is not an USB problem, at first. USB does not have any > place to put the information. The CAM API needs to be extended first, to be > able to pass along the kind of information you want, that is my > recommendation. > This is the solution in general we also thought of, to pass a list of name/value pairs to CAM. > What is your solution for multi-card-readers, where multiple hardware units will get the same vendor ID, product ID and serial number? > It is very good you mentioned this issue. Here is how it work (aka udev rules) on Linux for a 5-in-1 multi-card reader: BUS="scsi", SYSFS{model}="USB Storage-SMC", KERNEL="sd*", NAME="%k", SYMLINK="smcard%n" BUS="scsi", SYSFS{model}="USB Storage-CFC", KERNEL="sd*", NAME="%k", SYMLINK="cfcard%n" BUS="scsi", SYSFS{model}="USB Storage-MMC", KERNEL="sd*", NAME="%k", SYMLINK="mmcard%n" BUS="scsi", SYSFS{model}="USB Storage-SDC", KERNEL="sd*", NAME="%k", SYMLINK="sdcard%n" BUS="scsi", SYSFS{model}="USB Storage-MSC", KERNEL="sd*", NAME="%k", SYMLINK="mscard%n" For the very same 5-in-1 multi-card reader on FreeBSD 8: sysctl -a | grep dev.umass dev.umass.0.%desc: Generic USB Storage Device, class 0/0, rev 2.00/1.00, addr 2 dev.umass.0.%driver: umass dev.umass.0.%location: port=5 interface=0 dev.umass.0.%pnpinfo: vendor=0x07c4 product=0x3260 devclass=0x00 devsubclass=0x00 sernum="20040331152452980" intclass=0x08 intsubclass=0x06 dev.umass.0.%parent: uhub3 For the very same 5-in-1 multi-card reader on FreeBSD 8: camcontrol devlist at scbus1 target 0 lun 0 (pass0,da0) at scbus1 target 0 lun 1 (pass1,da1) at scbus1 target 0 lun 2 (pass2,da2) at scbus1 target 0 lun 3 (pass3,da3) Though the 5-in-1 multi-card reader is one unit for FreeBSD 8, its also shows different names on different LUNs. On Linux, it appear as 5 different units with multiple model names, so that, different cards can be matched individually without an issue. What we could do is send following for USB events: 1. Vendor name string (vendor-name) [eg. Lexar] 2. Vendor ID in hex (vendor-id) [eg. 0x1234] 3. Product name string (product-name) [eg. Multi-Card USB 2.0 Card Reader] 4. Product ID in hex (product-id) [eg. 0x5678] 5. LUN name string (lun-name) [eg. USB Storage-SMC] 6. LUN number (lun) [eg. 0] Best regards Sagara