controlar múltiples dispositivos a través de USB en python? posible ?

I would like to run separately some test on devices which are connected to HUB USB. My problem is that I don't know how to identify each device when I use the function usb.core.find. Can somebody help me please ?

preguntado el 28 de mayo de 14 a las 14:05

1 Respuestas

An example of a loop to list connected USB devices from aquí.

import sys
import usb.core
# find USB devices
dev = usb.core.find(find_all=True)
# loop through devices, printing vendor and product ids in decimal and hex
for cfg in dev:
  sys.stdout.write('Decimal VendorID=' + str(cfg.idVendor) + ' & ProductID=' +     str(cfg.idProduct) + '\n')
  sys.stdout.write('Hexadecimal VendorID=' + hex(cfg.idVendor) + ' & ProductID=' + hex(cfg.idProduct) + '\n\n'

PyUSB Documentation Link

PyUSB Sourceforge link

contestado el 28 de mayo de 14 a las 15:05

This only works if the device has the attributes set to your naming convention, in my case did not work, but the answer as a whole can be extrapolated - Jason v

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.