Hello list, I'm trying to communicate with the USB-2001-TC from MC (http://www.mccdaq.com/usb-data-acquisition/usb-2001-tc.aspx) using their text based protocol.
I'm using pyusb 1.0.0 a1 and figured out this script: import usb.core import usb.util def first_try(): # find our device dev = usb.core.find(idVendor = 0x09db, idProduct = 0x00f9) # was it found? if dev is None: raise ValueError('Device not found') # set the active configuration. With no arguments, the first # configuration will be the active one dev.set_configuration() # get an endpoint instance cfg = dev.get_active_configuration() for i in cfg: print i.bInterfaceNumber interface_number = i.bInterfaceNumber alternate_settting = usb.control.get_interface(dev, interface_number) intf = usb.util.find_descriptor(cfg, bInterfaceNumber = interface_number, bAlternateSetting = alternate_settting) 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 ) assert ep is not None # write the data #ep.write('test') if __name__ == "__main__": first_try() I get a assert exception (ep is none). As I have currently no knowledge about the USB related parameters of the Device and I'm no USB expert I don't know what's the problem. So any help is very welcome. Regards Alexander As I enabled pyusb loggin I get the following output: ==================================================== 2011-10-06 03:23:44,906 INFO:usb.core:find(): using backend "usb.backend.libusb10" 2011-10-06 03:23:44,910 DEBUG:usb.backend.libusb10:_LibUSB.enumerate_devices() 2011-10-06 03:23:44,913 DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device object at 0x983f8cc>) 2011-10-06 03:23:44,913 DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device object at 0x983f96c>) 2011-10-06 03:23:44,913 DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device object at 0x983f90c>) 2011-10-06 03:23:44,913 DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device object at 0x983f90c>, 0) 2011-10-06 03:23:44,914 DEBUG:usb.backend.libusb10:_LibUSB.open_device(<usb.backend.libusb10._Device object at 0x983f90c>) 2011-10-06 03:23:44,914 DEBUG:usb.backend.libusb10:_LibUSB.set_configuration(c_void_p(159873736), 1) 2011-10-06 03:23:44,939 DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device object at 0x983f90c>, 0) 2011-10-06 03:23:44,940 DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device object at 0x983f90c>, 0, 0, 0) 2011-10-06 03:23:44,940 DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device object at 0x983f90c>, 0) 2011-10-06 03:23:44,940 DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device object at 0x983f90c>, 0, 1, 0) 2011-10-06 03:23:44,940 DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device object at 0x983f90c>, 0) 2011-10-06 03:23:44,940 DEBUG:usb.backend.libusb10:_LibUSB.ctrl_transfer(c_void_p(159873736), 129, 10, 0, 0, 1, 1000) --> Interface number is: 0 2011-10-06 03:23:44,942 DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device object at 0x983f90c>, 0, 0, 0) 2011-10-06 03:23:44,943 DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device object at 0x983f90c>, 0) Traceback (most recent call last): File "/home/pyseminar/workspace/devel_pyusb/src/test_temp_device.py", line 44, in <module> first_try() File "/home/pyseminar/workspace/devel_pyusb/src/test_temp_device.py", line 37, in first_try assert ep is not None AssertionError 2011-10-06 03:23:44,947 DEBUG:usb.backend.libusb10:_LibUSB.close_device(c_void_p(159873736)) ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users