Answer the question
In order to leave comments, you need to log in
How to check which devices are connected to pc using python?
Hello everyone
. I'm making my bot here, and suddenly I wanted to add the function of checking devices connected to the PC to it (there's just nothing to do). Tell me where to dig, what libraries to use?
PS Ideally, everything should be reduced to a small simple function that will return a list or tuple with connected devices. Like this - ["mouse" , "keyboard" , "webcam"]
Answer the question
In order to leave comments, you need to log in
For HID(keyboard-mouse)
Example:
import usb
busses = usb.busses()
for bus in busses:
devices = bus.devices
for dev in devices:
handle = dev.open()
print("Device:", dev.filename)
print(" VID: 0x{:04x}".format(dev.idVendor))
print(" PID: 0x{:04x}".format(dev.idProduct))
print(" Manufacturer: 0x{:x}".format(dev.iManufacturer), end='')
run the command line and send "{path} adb devices" to it, in response you will receive a list of androids.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question