[Nut-upsdev] ups_set_altinterface() breaks tripplite_usb on Mac OS X

Arnaud Quette aquette.dev at gmail.com
Thu Sep 3 13:22:41 UTC 2009


2009/9/3 Charles Lepple <clepple at gmail.com>

> On Thu, Sep 3, 2009 at 5:05 AM, Arnaud Quette<aquette.dev at gmail.com>
> wrote:
> >
> > 2009/9/3 Charles Lepple <clepple at gmail.com>
> >>
> >> Is there a particular reason why we are setting the alternate
> >> interface to 0 in drivers/libusb.c?
> >>
> >> I have seen some documentation which indicates that this should
> >> already done by the OS when the device is enumerated. If that is the
> >> case, then there is no reason why we should hardcode the alternate
> >> interface to 0.
> >
> > iirc, this is indeed done automatically on Linux (and possibly OSX) when
> > there's only one interface (the same goes for the config). but it's not
> the
> > case on windows.
>
> Stephan of libusb-win32 seems to disagree:
>
> http://osdir.com/ml/lib.libusb.devel.windows/2005/msg00093.html
>

interesting.
it might be worth to make some checking around

> - usb_set_configuration() => "bConfigurationValue"
> - usb_claim_interface() => "bInterfaceNumber"
> - usb_set_altinterface() => "bAlternateSetting"

and their values to have something dynamic, smart and adaptable


>> If I remove the following code, tripplite_usb seems to work*:
> >>
> >>                        /* set default interface */
> >>                       usb_set_altinterface(udev, 0);
> >
> > prefer to flag it for windows (#ifdef WIN32...) so that we don't face a
> > problem when porting to windows.
>
> I might put a comment in there, but if that call is needed, it should
> be pretty obvious during porting.
>

indeed


> >> Any objections to removing this? Can I get some volunteers to try this
> >> out on their non-OS X systems?
> >>
> >> I am using libusb-0.1.12 on Mac OS X 10.5.8.
> >>
> >> * I did have to monkey with a codeless kext in order to allow libusb
> >> to claim the device. However, it doesn't seem like OS X allows you to
> >> bypass the claim operation anymore.
> >
> > I'll be interested in the result since usbhid-ups, bcmxcp_usb and
> richcomm
> > are in the same case.
> > I'll try to make an OS X test on usbhid-ups with an Eaton...
>
> The codeless kext stuff is not too complicated - we could probably
> generate them the same way as the udev configuration files. The only
> trick is that the USB VID, PID, bConfigurationValue, bInterfaceNumber
> and bcdDevice values need to be included, in decimal (and the latter
> probably needs to be extracted from lsusb output that users have
> posted to the mailing lists).
>

isn't there some joker for the b* (like "*" meaning any value)?
having the option to match so specifically is nice, but I find strange to be
forced to do that!

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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20090903/4d061c4f/attachment.htm>


More information about the Nut-upsdev mailing list