From: J.D. M. <jd...@co...> - 2009-11-04 01:12:20
|
Hi folks, I was hoping to get a little snippet of code to help me query a USB temperature sensor with Python. I have installed libusb-win32 (v1.12.2) and pyusb (v0.4.2). I can sucessfully enumerate the device. Here's what it looks like: Device: \\.\libusb0-0008--0x1dfd-0x0002 Device class: 0 Device sub class: 0 Device protocol: 0 Max packet size: 8 idVendor: 7677 (0x1dfd) idProduct: 2 (0x0002) Device Version: 01.10 Configuration: 1 Total length: 41 selfPowered: 0 remoteWakeup: 0 maxPower: 200 Interface: 0 Alternate Setting: 0 Interface class: 3 Interface sub class: 0 Interface protocol: 0 Endpoint: 0x81L Type: 3 Max packet size: 16 Interval: 10 Endpoint: 0x2L Type: 3 Max packet size: 16 Interval: 10 I'm more used to working with serial ports than usb so I was hoping for a very minimal amount of code to: 1. Instantiate the device 2. Write a string ("hello world") 3. Read the response I have gotten as far as: handle = dev.open() handle.bulkWrite(0x81,"hello world") but then get an error: invalid endpoint 0x81 I'm clearly missing some steps or doing something wrong. Any help would be greatly appreciated. Best Regards, J.D. |