It is possible at least on linux to get the port associated with a device from
userspace - I'd assume that on each platform it's possible, just that
libusb
is incomplete (on top of being undocumented).
Here's a patch for matching portnum on linux, with a few pieces pulled from
libusb. It lacks autoconf macros to isolate it -- but it does appear to work.
Regards,
Alex Peyser
On Friday 06 June 2008 05:55:04 am nut-upsuser-request at
lists.alioth.debian.org >
> Message: 2
> Date: Fri, 6 Jun 2008 08:39:45 +0200 (CEST)
> From: "Arjen de Korte" <nut+users at de-korte.org>
> Subject: Re: [Nut-upsuser] Multiple ups/Belkin 1500VA no serial number
> To: "Alex Peyser" <a.peyser at umiami.edu>
> Cc: nut-upsuser at lists.alioth.debian.org
> Message-ID:
> <1056.193.67.155.121.1212734385.squirrel at mail.de-korte.org>
> Content-Type: text/plain;charset=iso-8859-1
>
> > I hadn't previously looked into libusb, but is there a reason why
the
> > filename
> > member of usb_device is't matched on? On linux, they may not be
unique
> > or deterministic in theory --- but in practice they are, particularly
for
> > servers where you're not constantly plugging in and out devices.
>
> The filename *will* change, even if you don't plug in and out devices.
> This may happen as often as once every half hour. Therefor, the device
> name can't be used in the matching. It may appear to work now, but if
for
> some reason the devices are enumerated again, the connection *will* be
> lost.
>
> > Am I missing something in the logic, or do I just have an unusual
case?
>
> Neither. These devices are just not suitable for use with NUT as long as
> the libusb library doesn't expose the physical ports the UPS is
attached
> to.
>
> > I've written up a patch that works for me -- it pulls out the
filename
> > from
> > the usb_device, and matches it with a file= parameter for ups.conf.
I'd
> > guess
> > that a better long-term solution would be to have upsdrv listen to hal
> > for ups's that are connecting -- but that would obviously be a lot
more
> > work, and
> > it requires mucking up the server with hal stuff.
>
> We already have HAL enabled drivers, but I'm not sure if these use all
the
> information from HAL to match a UPS or if they need the devices to be
> 'unique' as well (like the classic ones).
>
> Best regards, Arjen
> --
> Eindhoven - The Netherlands
> Key fingerprint - 66 4E 03 2C 9D B5 CB 9B 7A FE 7E C1 EE 88 BC 57
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nut-port.patch
Type: text/x-diff
Size: 11080 bytes
Desc: not available
Url :
http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20080609/8d7aff45/attachment.patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url :
http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20080609/8d7aff45/attachment.pgp