Hi,

On 03/23/2013 12:05 PM, Ludovic Rousseau wrote:
> 2013/3/23 Hans de Goede <hdego...@redhat.com>:
>> We all seem to agree on that, which is good :)  So it would be helpful
>> to get some feedback on my proposed API for the opting in before I
>> actually start coding this. Let me quote my own API proposal from
>> another mail:
>>
>> Assuming all platforms will do auto-detach on interface claim (which
>> makes sense given that drivers are usually per interface), we could
>> make this a device_handle property, so then an app would do something
>> like:
>>
>> libusb_device_handle *handle;
>>
>> libusb_open(dev, &handle);
>> libusb_set_auto_detach(handle, 1);
>> libusb_claim_interface(handle, x);
>>
>> With:
>> void libusb_set_auto_detach(libusb_device_handle *dev, int auto_detach);
>
> I propose to rename the function in libusb_set_auto_detach_kernel_driver()

Ack.

>
> I also propose to give a symbolic name to the parameter value instead
> of using 1.
> Something like LIBUSB_AUTO_DETACH_KERNEL_DRIVER_ENABLE
>
> I don't know if we also need a LIBUSB_AUTO_DETACH_KERNEL_DRIVER_DISABLE
> If not maybe the parameter can be removed.
> Or maybe the function can be named:
> libusb_set_parameter(handle, LIBUSB_AUTO_DETACH_KERNEL_DRIVER_ENABLE)

I've been thinking about something more generic, ie:
int libusb_set_parameter(libusb_device_handle *dev, int parameter,
                          int value);

But it seems better to me to just add per parameter set functions, these
kind of multiplex functions are needlessly hard to use, and need demultiplex
code in the implementation, which as ioctl code in the kernel shows, is
easy at first but gets hard pretty quickly.

Thinking more about this I propose to simply add a:

void libusb_enable_auto_detach_kernel_driver(libusb_device_handle *dev);

Function, this solves the whole needing defines for the argument problem,
and the name makes it clear at once what the function does.

Regards,

Hans

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to