2011/1/17 Rob Fowler <le...@mianos.com>: > The the tutorial: > # get an endpoint instance > ep = usb.util.find_descriptor( > dev.get_interface_altsetting(), # first interface > # match the first OUT endpoint > custom_match = \ > lambda e: \ > usb.util.endpoint_direction(e.bEndpointAddress) == \ > usb.util.ENDPOINT_OUT > ) > > > is used. > In the change log and code get_interface_altsetting was removed in the > last version. > What's the trick here? Should I just try and use the first? > > This API was removed. You can now use usb.control.get_interface() to get the interface alternate setting. But notice that it returns the interface alternate setting number, not the interface object. I must change the tutorial. What you will get in the end is a cleaner core API in detriment of a harder to do corner case. The updated version should be something like this:
# get an endpoint instance cfg = dev.get_active_configuration() interface_number = cfg[0].bInterfaceNumber alternate_settting = usb.control.get_interface(interface_number) intf = usb.util.find_descriptor(cfg, bInterfaceNumber = interface_number, bAlternateSetting = alternate_setting) ep = usb.util.find_descriptor( intf, # match the first OUT endpoint custom_match = \ lambda e: \ usb.util.endpoint_direction(e.bEndpointAddress) == \ usb.util.ENDPOINT_OUT ) Maybe I recreate get_interface_altsetting in the usb.util module for next release. -- Best Regards, Wander Lairson Costa LCoN - Laboratório de Computação Natural - Natural Computing Laboratory (http://www.mackenzie.com.br/lcon.html) Programa de Pós-Graduação em Engenharia Elétrica (PPGEE) Faculdade de Computação e Informática (FCI) Universidade Presbiteriana Mackenzie - SP - Brazil ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users