2012/10/25 Stefano Di Martino <stefan...@gmx.net>:
> Am 25.10.2012 23:46, schrieb Wander Lairson Costa:
>>
>> The problem is how to make a backend specific feature available on
>> final API and keeping it sane for users from other backends.
> I'm not sure, if you are aware that pyUSB is already doing this:
> Here the libusb 1.0 backend:
>
> def get_device_descriptor(self, dev):
>          ....
> dev_desc.bus = _lib.libusb_get_bus_number(dev.devid)
> dev_desc.address = _lib.libusb_get_device_address(dev.devid)
>
> the openusb backend:
>
> def  get_device_descriptor(self,  dev):
>
> ...
>          desc.bus = None
> desc.address = None
>
> the libusb 0 backend:
>
> def get_device_descriptor(self, dev):
> return _DeviceDescriptor(dev)
>
> My suggestion is to continue this logic:
>
> def get_device_descriptor(self, dev):
>          ....
> dev_desc.bus = _lib.libusb_get_bus_number(dev.devid)
> dev_desc.address = _lib.libusb_get_device_address(dev.devid)
>          dev_desc.port_number = _lib.libusb_get_port_number(dev.devid) #
> This is new!
>

This is fine for me. You can do a pull request, but I have to update
docs and create unit tests before putting it into master branch.
Remember that for backends which port number is not available,
port_number should be assigned None.

> If this new line would f*ck up your API, then the API is alread f*cked
> up, because I'm following only the existing logic in pyUSB.
>

It is not the best approach IMO, but I was requested to include bus
and address info by an user and couldn't find any better solution.

>> That said, I think fragmentation is bad, but if you want to fork it,
>> go ahead, freedom is what OSS is about :)
> I'm not a friend of fregmentation... Man> Best regards
> Stefano

I agree.

-- 
Best Regards,
Wander Lairson Costa

------------------------------------------------------------------------------
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_sfd2d_oct
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to