1

I'm trying to use pyusb to enumerates all devices connected to my pc:

>>> import usb.core
>>> dev = usb.core.find(find_all=True)
>>> for device in dev:
        print(device)

    
>>> 

Why keyboard, mouse and other plugged devices are not recognized?

Then I try to detect the mouse:

>>> dev = usb.core.find(idVendor=16700, idProduct=12314)
>>> print(dev)
None

Any ideas? Thanks! Max

mtre
  • 21
  • 4
  • 1
    I would bet on windows permissions, try to start the python as administrator – Lesnek Jul 12 '21 at 15:22
  • Same result, it doesn't recognize any usb device... – mtre Jul 12 '21 at 15:30
  • I tried exact same code on Macbook, python 3.7.5... worked on first try, even tho I have usb-c only. Fortunetly I found that windows needs to install libusb https://stackoverflow.com/questions/13773132/pyusb-on-windows-no-backend-available – Lesnek Jul 12 '21 at 15:43
  • Honestly, I did not understand very well that discussion, as far as I know the dll are present in my system but it still doesn't work. When I try to detect the mouse: >>> dev = usb.core.find(idVendor=16700, idProduct=12314) >>> print(dev) None – mtre Jul 13 '21 at 06:34
  • Is this on Windows? On Windows, HID devices already have drivers, and cannot be attached to another device without disconnecting the original driver.. – Tim Roberts Jul 13 '21 at 06:41
  • Yes is on Windows, does it means I can't interact with HID devices (keyboard, mouse...) by using Pyusb? – mtre Jul 13 '21 at 07:12
  • I used pyusb after tried unsuccessfully with Hid and Hidapi... https://stackoverflow.com/questions/68302491/python-and-hidapi-argument-error-when-trying-to-write-a-usb-device – mtre Jul 13 '21 at 07:22

0 Answers0