Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Jan 2013 08:29:58 -0700 (MST)
From:      Warren Block <wblock@wonkity.com>
To:        dweimer <dweimer@dweimer.net>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>, Shane Ambler <FreeBSD@shaneware.biz>
Subject:   Re: Locking USB Serial Device to Specific Com port
Message-ID:  <alpine.BSF.2.00.1301270825480.6993@wonkity.com>
In-Reply-To: <0fd00d9caad3787f4cd0e443e5931340@dweimer.net>
References:  <762f51b7c30dd5c920788336b3eb4fa5@dweimer.net> <51045B48.40202@ShaneWare.Biz> <0fd00d9caad3787f4cd0e443e5931340@dweimer.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



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