J.D. Main wrote:
> 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
>
For my device I have:
sent_bytes = self.handle.interruptWrite(0x2,
PlugUSBDevice.MIMIO_HELLO, timeout)
if sent_bytes:
read_bytes = self.handle.interruptRead(0x81,
self.MAX_PACKET_SIZE);
self.readDevice(read_bytes)
I tried the bulk write initially but for my device it required a setup
on the interrupt line.
Phil
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________ Pyusb-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyusb-users
