[Nut-upsdev] SUN_LIBUSB

Arnaud Quette aquette.dev at gmail.com
Wed Dec 30 09:52:05 UTC 2009


hey,

2009/12/30 Charles Lepple <clepple at gmail.com>:
> On Tue, Dec 29, 2009 at 4:25 PM, Wallis, Chase Civ USAF AFMC 519
> SMXS/MXDEA <Chase.Wallis at hill.af.mil> wrote:
>> Hi all,
>>
>>
>>
>> I’ve been trying to get a TrippLite 700DV  communicating with nut in
>> Solaris. The problem was that I would successfully send a message to the
>> ups, but wouldn’t be able to receive anything. After some snooping around I
>> found this bit of code in libusb.c libusb_get_interrupt().
>
> Chase,
>
> I am CC'ing Arnaud because I believe he was working with some folks at
> Sun a while back on USB support.

right, I've worked some 7-8 years ago with Jan Van Bruene on the ugen
driver (equivalent to Linux' usbfs):
http://developers.sun.com/solaris/developer/support/driver/docs/usbups_whitepaper.html

once the libusb has been available for Sun, obviously using the ugen
driver, I've added a few tweaks to the usbhid-ups driver.

the problem at that time was that interrupt were not well handled by
Sun's libusb.
which lead me to that crappy sleep hack.
now, in the light of your feedback, this seems not needed anymore, so
we will have to test the version of Sun's libusb to enable or disable
interrupt support.

the below information requested by Charles will help a lot...

looking
> Just to make sure we're on the same page, it sounds like you are using
> the tripplite_usb driver, right?
>
> Please let us know version numbers for the following:
>  * NUT
>  * libusb (I assume it's from Sun Freeware?)
>  * Solaris
>
>> #ifdef SUN_LIBUSB
>>
>> /*
>>
>>                 usleep(timeout * 1000);
>>
>>  */
>>
>>                 return 0;
>>
>> #else
>>
>>                 /* FIXME: hardcoded interrupt EP => need to get EP descr for
>> IF descr */
>>
>>                 ret = usb_interrupt_read(udev, 0x81, (char *)buf, bufsize,
>> timeout);
>>
>>                 if (ret > 0) {
>>
>>                                 upsdebugx(6, " ok");
>>
>>                 } else {
>>
>>                                 upsdebugx(6, " none (%i)", ret);
>>
>>                 }
>>
>>                 return ret;
>>
>> #endif
>>
>>
>>
>>
>>
>> It seems that when using Sun libusb, nut completely blocks out the read
>> attempt. I removed the preprocessor directives and voila. Worked perfectly.
>> There must have been a reason for this at some point, but I can’t find any
>> comments on the issue. And it seems to be unnecessarily blocking out usb
>> communication when using Sun libusb. Does anyone know the reason for this?
>> Should I work around the issue in the tripplite_usb driver, or can it be
>> fixed directly in libusb.c? Maybe other UPS drivers on SUN haven’t been
>> working for this reason…

this really has to be fixed in the libusb implementation, with the
above mentioned configure test.

cheers,
Arnaud
-- 
Linux / Unix Expert R&D - Eaton - http://www.eaton.com/mgeops
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.free.fr/



More information about the Nut-upsdev mailing list