From owner-freebsd-questions@FreeBSD.ORG Sun Jan 27 16:14:59 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A0E73729 for ; Sun, 27 Jan 2013 16:14:59 +0000 (UTC) (envelope-from dweimer@dweimer.net) Received: from webmail.dweimer.net (24-240-198-187.static.stls.mo.charter.com [24.240.198.187]) by mx1.freebsd.org (Postfix) with ESMTP id 731E1941 for ; Sun, 27 Jan 2013 16:14:58 +0000 (UTC) Received: from www.dweimer.net (webmail.dweimer.local [192.168.5.1]) by webmail.dweimer.net (8.14.5/8.14.5) with ESMTP id r0RGEvFZ002145 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 27 Jan 2013 10:14:58 -0600 (CST) (envelope-from dweimer@dweimer.net) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 27 Jan 2013 10:14:57 -0600 From: dweimer To: Warren Block Subject: Re: Locking USB Serial Device to Specific Com port Organization: dweimer.net Mail-Reply-To: In-Reply-To: References: <762f51b7c30dd5c920788336b3eb4fa5@dweimer.net> <51045B48.40202@ShaneWare.Biz> <0fd00d9caad3787f4cd0e443e5931340@dweimer.net> Message-ID: <92bd9c547b6d1b36daa9da4030ad2172@dweimer.net> X-Sender: dweimer@dweimer.net User-Agent: Roundcube Webmail/0.8.1 Cc: FreeBSD Questions , Shane Ambler X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: dweimer@dweimer.net List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2013 16:14:59 -0000 On 2013-01-27 09:29, Warren Block wrote: > On Sun, 27 Jan 2013, dweimer wrote: > >> On 2013-01-26 16:40, Shane Ambler wrote: >>> On 27/01/2013 08:15, dweimer wrote: >>> >>>> I would like to lock down the USB serial port adapter used on the >>>> UPS to >>>> /dev/cuaU0, to make sure the UPS is always monitored and I will >>>> get a >>>> clean shutdown in event of a power failure. >>>> I believe that this requires setting a hint line of some sort in >>>> the >>>> /boot/loader.conf file, but I am having trouble tracking down what >>>> this >>>> should be, or maybe I am on the wrong track. Here is the current >>>> information from the adpapters, the UPS adapter was connected at >>>> boot, >>>> is on /dev/cuaU0, the other one was plugged in after boot, and is >>>> on >>>> /dev/cuaU1. >>> start with man devd.conf >>> You can add your own devd files in /usr/local/etc/devd/ >>> Something along the lines of - >>> attach 200 { >>> device-name "cuaU[0-9]+"; >>> match "vendor" "0x067b"; >>> match "product" "0x2303"; >>> action "sleep 2; cd /dev; ln -s ${device-name} upsmonitor"; >>> }; >>> use usbconfig to get info. I am thinking with the similarity of the >>> two >>> you may need to rely on bus and hubaddr or devaddr to keep each >>> device >>> identified by usb port location. >> >> OK, so I was looking in the wrong direction, which might explain why >> my searching wasn't finding anything. >> >> However I might still be out of luck, after doing some checking, and >> a reboot the only difference I can find is below. >> >> dev.uplcom.0.%location: bus=1 hubaddr=1 port=0 devaddr=2 interface=0 >> dev.uplcom.1.%location: bus=1 hubaddr=3 port=0 devaddr=3 interface=0 > > usbconfig may be able to get the device serial number, although they > may not be unique. Jamming useful scripts inside an action can be > complicated. It may be easier to just trigger an external script. That's just it, can't get usbconfig to give me anything different between the two, they don't appear to have a serial number set on them. # usbconfig -d ugen0.2 dump_device_desc ugen0.2: at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0110 bDeviceClass = 0x0000 bDeviceSubClass = 0x0000 bDeviceProtocol = 0x0000 bMaxPacketSize0 = 0x0040 idVendor = 0x067b idProduct = 0x2303 bcdDevice = 0x0300 iManufacturer = 0x0001 iProduct = 0x0002 iSerialNumber = 0x0000 bNumConfigurations = 0x0001 # usbconfig -d ugen0.3 dump_device_desc ugen0.3: at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0110 bDeviceClass = 0x0000 bDeviceSubClass = 0x0000 bDeviceProtocol = 0x0000 bMaxPacketSize0 = 0x0040 idVendor = 0x067b idProduct = 0x2303 bcdDevice = 0x0300 iManufacturer = 0x0001 iProduct = 0x0002 iSerialNumber = 0x0000 bNumConfigurations = 0x0001 -- Thanks, Dean E. Weimer http://www.dweimer.net/