From 2ce865c4c219602f69d280b45f81a30775f5fcce Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 25 Apr 2011 02:13:46 +0200 Subject: [PATCH] update to python-usb 1.0.0a1 api --- software/device.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/software/device.py b/software/device.py index 8ec2859..1ab1cf5 100644 --- a/software/device.py +++ b/software/device.py @@ -17,10 +17,14 @@ class Device: except: pass usbdev.set_configuration() - self.epo = usb.util.find_descriptor(usbdev.get_interface_altsetting(), + cfg = usbdev.get_active_configuration() + interface_number = cfg[(0,0)].bInterfaceNumber + alternate_setting = usb.control.get_interface(usbdev, interface_number) + intf = usb.util.find_descriptor(cfg, bInterfaceNumber = interface_number, bAlternateSetting = alternate_setting) + self.epo = usb.util.find_descriptor(intf, custom_match = lambda e: \ usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_OUT) - self.epi = usb.util.find_descriptor(usbdev.get_interface_altsetting(), + self.epi = usb.util.find_descriptor(intf, custom_match = lambda e: \ usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_IN) else: