Hi

I am trying to use a USB port to talk to a 18F46K20 pic controller. The
project, which is in the early stages, will communicate simple commands to
the controller,  to get temperature and humidity data from a sensor
attached to the controller.
I want to use Python to manipulate the results in graphic form.
I have read some articles about using PyUSB for interacting with the USB
port so I thought I would do some preliminary tests to trial it before I
get into the more complex parts.
I copied a small program to test it (
https://github.com/pyusb/pyusb/blob/master/docs/tutorial.rst)
import usb.core
import usb.util
dev = usb.core.find(idVendor=0x04B3, idProduct=0x310C)
if dev is None:
    raise ValueError('Device not found')
print (dev.idProduct,dev.idVendor)
dev.set_configuration()
The device is an USB optical mouse. Info from USB Device Viewer is at the
end of this email.
Line 6 outputs 12556 1203 ( which is in decimal).
Line 7 produces the following
Exception has occurred: USBError
[Errno 40] Operation not supported or unimplemented on this platform
  File "C:\Users\John Beamish\test\usbtest.py", line 7, in <module>
    dev.set_configuration()
I loaded pyusb 1.1.0 with pip install pyusb and libusb1 1.8 with pip
install libusb1
I am running Python 3.9 0n Windows 10 Home Version 2004.

I know I have/ or am doing something wrong but if anyone is able to advise
me I would really appreciate this.

This was supposed to be the easy bit!!!
Regards

John Beamish

       ---===>Device Information<===---
English product name: "USB Optical Mouse"

ConnectionStatus:
Current Config Value:              0x01  -> Device Bus Speed: Low
Device Address:                    0x27
Open Pipes:                           1

          ===>Device Descriptor<===
bLength:                           0x12
bDescriptorType:                   0x01
bcdUSB:                          0x0200
bDeviceClass:                      0x00  -> This is an Interface Class
Defined Device
bDeviceSubClass:                   0x00
bDeviceProtocol:                   0x00
bMaxPacketSize0:                   0x08 = (8) Bytes
idVendor:                        0x04B3 = IBM Corporation
idProduct:                       0x310C
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to