1

Estoy tratando de dectar todos los usb conectados a mi pc utilizando pyusb, pero se me presentan los siguientes problemas:

1.- no encuentra todos los dispositivos(no aparece un hdd conectado en el momento de la ejecución)

2.- como puedo obtener el iInterface(para dectectar el nombre del dispositivo) intente:

for cfg in dev:
  print(cfg[0]['iInterface'])

aqui esta el codigo completo

import sys
import usb.core
import usb.util

dev = usb.core.find(find_all=True)

for cfg in dev:
  sys.stdout.write('hex VendedorID='+hex(cfg.idVendor)+'& ProductId'+hex(cfg.idProduct)+'\n')
  print(cfg)

Y esto es lo que devuelve:

hex VendedorID=0x413c& ProductId0x8187
    DEVICE ID 413c:8187 on Bus 000 Address 001 =================
     bLength                :   0x12 (18 bytes)
     bDescriptorType        :    0x1 Device
     bcdUSB                 :  0x200 USB 2.0
     bDeviceClass           :   0xe0 Wireless Controller
     bDeviceSubClass        :    0x1
     bDeviceProtocol        :    0x1
     bMaxPacketSize0        :   0x40 (64 bytes)
     idVendor               : 0x413c
     idProduct              : 0x8187
     bcdDevice              :  0x517 Device 5.17
     iManufacturer          :    0x1 Dell Computer Corp
     iProduct               :    0x2 DW375 Bluetooth Module
     iSerialNumber          :    0x3 E006E6DAC48E
     bNumConfigurations     :    0x1
      CONFIGURATION 1: 100 mA ==================================
       bLength              :    0x9 (9 bytes)
       bDescriptorType      :    0x2 Configuration
       wTotalLength         :   0xf4 (244 bytes)
       bNumInterfaces       :    0x4
       bConfigurationValue  :    0x1
       iConfiguration       :    0x0 
       bmAttributes         :   0xe0 Self Powered, Remote Wakeup
       bMaxPower            :   0x32 (100 mA)
        INTERFACE 0: Wireless Controller =======================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x0
         bAlternateSetting  :    0x0
         bNumEndpoints      :    0x3
         bInterfaceClass    :   0xe0 Wireless Controller
         bInterfaceSubClass :    0x1
         bInterfaceProtocol :    0x1
         iInterface         :    0x0 
          ENDPOINT 0x81: Interrupt IN ==========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x81 IN
           bmAttributes     :    0x3 Interrupt
           wMaxPacketSize   :   0x10 (16 bytes)
           bInterval        :    0x1
          ENDPOINT 0x82: Bulk IN ===============================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x82 IN
           bmAttributes     :    0x2 Bulk
           wMaxPacketSize   :   0x40 (64 bytes)
           bInterval        :    0x1
          ENDPOINT 0x2: Bulk OUT ===============================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :    0x2 OUT
           bmAttributes     :    0x2 Bulk
           wMaxPacketSize   :   0x40 (64 bytes)
           bInterval        :    0x1
        INTERFACE 1: Wireless Controller =======================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x0
         bNumEndpoints      :    0x2
         bInterfaceClass    :   0xe0 Wireless Controller
         bInterfaceSubClass :    0x1
         bInterfaceProtocol :    0x1
         iInterface         :    0x0 
          ENDPOINT 0x83: Isochronous IN ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x83 IN
           bmAttributes     :    0x1 Isochronous
           wMaxPacketSize   :    0x0 (0 bytes)
           bInterval        :    0x1
          ENDPOINT 0x3: Isochronous OUT ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :    0x3 OUT
           bmAttributes     :    0x1 Isochronous
           wMaxPacketSize   :    0x0 (0 bytes)
           bInterval        :    0x1
        INTERFACE 1, 1: Wireless Controller ====================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x1
         bNumEndpoints      :    0x2
         bInterfaceClass    :   0xe0 Wireless Controller
         bInterfaceSubClass :    0x1
         bInterfaceProtocol :    0x1
         iInterface         :    0x0 
          ENDPOINT 0x83: Isochronous IN ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x83 IN
           bmAttributes     :    0x1 Isochronous
           wMaxPacketSize   :    0x9 (9 bytes)
           bInterval        :    0x1
          ENDPOINT 0x3: Isochronous OUT ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :    0x3 OUT
           bmAttributes     :    0x1 Isochronous
           wMaxPacketSize   :    0x9 (9 bytes)
           bInterval        :    0x1
        INTERFACE 1, 2: Wireless Controller ====================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x2
         bNumEndpoints      :    0x2
         bInterfaceClass    :   0xe0 Wireless Controller
         bInterfaceSubClass :    0x1
         bInterfaceProtocol :    0x1
         iInterface         :    0x0 
          ENDPOINT 0x83: Isochronous IN ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x83 IN
           bmAttributes     :    0x1 Isochronous
           wMaxPacketSize   :   0x11 (17 bytes)
           bInterval        :    0x1
          ENDPOINT 0x3: Isochronous OUT ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :    0x3 OUT
           bmAttributes     :    0x1 Isochronous
           wMaxPacketSize   :   0x11 (17 bytes)
           bInterval        :    0x1
        INTERFACE 1, 3: Wireless Controller ====================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x3
         bNumEndpoints      :    0x2
         bInterfaceClass    :   0xe0 Wireless Controller
         bInterfaceSubClass :    0x1
         bInterfaceProtocol :    0x1
         iInterface         :    0x0 
          ENDPOINT 0x83: Isochronous IN ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x83 IN
           bmAttributes     :    0x1 Isochronous
           wMaxPacketSize   :   0x20 (32 bytes)
           bInterval        :    0x1
          ENDPOINT 0x3: Isochronous OUT ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :    0x3 OUT
           bmAttributes     :    0x1 Isochronous
           wMaxPacketSize   :   0x20 (32 bytes)
           bInterval        :    0x1
        INTERFACE 1, 4: Wireless Controller ====================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x4
         bNumEndpoints      :    0x2
         bInterfaceClass    :   0xe0 Wireless Controller
         bInterfaceSubClass :    0x1
         bInterfaceProtocol :    0x1
         iInterface         :    0x0 
          ENDPOINT 0x83: Isochronous IN ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x83 IN
           bmAttributes     :    0x1 Isochronous
           wMaxPacketSize   :   0x40 (64 bytes)
           bInterval        :    0x1
          ENDPOINT 0x3: Isochronous OUT ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :    0x3 OUT
           bmAttributes     :    0x1 Isochronous
           wMaxPacketSize   :   0x40 (64 bytes)
           bInterval        :    0x1
        INTERFACE 1, 5: Wireless Controller ====================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x5
         bNumEndpoints      :    0x2
         bInterfaceClass    :   0xe0 Wireless Controller
         bInterfaceSubClass :    0x1
         bInterfaceProtocol :    0x1
         iInterface         :    0x0 
          ENDPOINT 0x83: Isochronous IN ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x83 IN
           bmAttributes     :    0x1 Isochronous
           wMaxPacketSize   :   0x40 (64 bytes)
           bInterval        :    0x1
          ENDPOINT 0x3: Isochronous OUT ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :    0x3 OUT
           bmAttributes     :    0x1 Isochronous
           wMaxPacketSize   :   0x40 (64 bytes)
           bInterval        :    0x1
        INTERFACE 2: Vendor Specific ===========================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x2
         bAlternateSetting  :    0x0
         bNumEndpoints      :    0x2
         bInterfaceClass    :   0xff Vendor Specific
         bInterfaceSubClass :   0xff
         bInterfaceProtocol :   0xff
         iInterface         :    0x0 
          ENDPOINT 0x84: Bulk IN ===============================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x84 IN
           bmAttributes     :    0x2 Bulk
           wMaxPacketSize   :   0x20 (32 bytes)
           bInterval        :    0x1
          ENDPOINT 0x4: Bulk OUT ===============================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :    0x4 OUT
           bmAttributes     :    0x2 Bulk
           wMaxPacketSize   :   0x20 (32 bytes)
           bInterval        :    0x1
        INTERFACE 3: Application Specific ======================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x3
         bAlternateSetting  :    0x0
         bNumEndpoints      :    0x0
         bInterfaceClass    :   0xfe Application Specific
         bInterfaceSubClass :    0x1
         bInterfaceProtocol :    0x0
         iInterface         :    0x0 
    hex VendedorID=0xc45& ProductId0x6433
    DEVICE ID 0c45:6433 on Bus 000 Address 002 =================
     bLength                :   0x12 (18 bytes)
     bDescriptorType        :    0x1 Device
     bcdUSB                 :  0x200 USB 2.0
     bDeviceClass           :   0xef Miscellaneous
     bDeviceSubClass        :    0x2
     bDeviceProtocol        :    0x1
     bMaxPacketSize0        :   0x40 (64 bytes)
     idVendor               : 0x0c45
     idProduct              : 0x6433
     bcdDevice              : 0x1315 Device 19.15
     iManufacturer          :    0x2 CN018T967248725GB6YMA01
     iProduct               :    0x1 Laptop_Integrated_Webcam_HD
     iSerialNumber          :    0x0 
     bNumConfigurations     :    0x1
      CONFIGURATION 1: 500 mA ==================================
       bLength              :    0x9 (9 bytes)
       bDescriptorType      :    0x2 Configuration
       wTotalLength         :  0x37b (891 bytes)
       bNumInterfaces       :    0x2
       bConfigurationValue  :    0x1
       iConfiguration       :    0x0 
       bmAttributes         :   0x80 Bus Powered
       bMaxPower            :   0xfa (500 mA)
        INTERFACE 0: Video =====================================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x0
         bAlternateSetting  :    0x0
         bNumEndpoints      :    0x1
         bInterfaceClass    :    0xe Video
         bInterfaceSubClass :    0x1
         bInterfaceProtocol :    0x0
         iInterface         :    0x5 Integrated Webcam
          ENDPOINT 0x83: Interrupt IN ==========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x83 IN
           bmAttributes     :    0x3 Interrupt
           wMaxPacketSize   :   0x10 (16 bytes)
           bInterval        :    0x6
        INTERFACE 1: Video =====================================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x0
         bNumEndpoints      :    0x0
         bInterfaceClass    :    0xe Video
         bInterfaceSubClass :    0x2
         bInterfaceProtocol :    0x0
         iInterface         :    0x5 Integrated Webcam
        INTERFACE 1, 1: Video ==================================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x1
         bNumEndpoints      :    0x1
         bInterfaceClass    :    0xe Video
         bInterfaceSubClass :    0x2
         bInterfaceProtocol :    0x0
         iInterface         :    0x0 
          ENDPOINT 0x81: Isochronous IN ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x81 IN
           bmAttributes     :    0x5 Isochronous
           wMaxPacketSize   :   0x80 (128 bytes)
           bInterval        :    0x1
        INTERFACE 1, 2: Video ==================================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x2
         bNumEndpoints      :    0x1
         bInterfaceClass    :    0xe Video
         bInterfaceSubClass :    0x2
         bInterfaceProtocol :    0x0
         iInterface         :    0x0 
          ENDPOINT 0x81: Isochronous IN ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x81 IN
           bmAttributes     :    0x5 Isochronous
           wMaxPacketSize   :  0x100 (256 bytes)
           bInterval        :    0x1
        INTERFACE 1, 3: Video ==================================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x3
         bNumEndpoints      :    0x1
         bInterfaceClass    :    0xe Video
         bInterfaceSubClass :    0x2
         bInterfaceProtocol :    0x0
         iInterface         :    0x0 
          ENDPOINT 0x81: Isochronous IN ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x81 IN
           bmAttributes     :    0x5 Isochronous
           wMaxPacketSize   :  0x320 (800 bytes)
           bInterval        :    0x1
        INTERFACE 1, 4: Video ==================================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x4
         bNumEndpoints      :    0x1
         bInterfaceClass    :    0xe Video
         bInterfaceSubClass :    0x2
         bInterfaceProtocol :    0x0
         iInterface         :    0x0 
          ENDPOINT 0x81: Isochronous IN ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x81 IN
           bmAttributes     :    0x5 Isochronous
           wMaxPacketSize   :  0xb20 (2848 bytes)
           bInterval        :    0x1
        INTERFACE 1, 5: Video ==================================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x5
         bNumEndpoints      :    0x1
         bInterfaceClass    :    0xe Video
         bInterfaceSubClass :    0x2
         bInterfaceProtocol :    0x0
         iInterface         :    0x0 
          ENDPOINT 0x81: Isochronous IN ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x81 IN
           bmAttributes     :    0x5 Isochronous
           wMaxPacketSize   : 0x1320 (4896 bytes)
           bInterval        :    0x1
        INTERFACE 1, 6: Video ==================================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x6
         bNumEndpoints      :    0x1
         bInterfaceClass    :    0xe Video
         bInterfaceSubClass :    0x2
         bInterfaceProtocol :    0x0
         iInterface         :    0x0 
          ENDPOINT 0x81: Isochronous IN ========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x81 IN
           bmAttributes     :    0x5 Isochronous
           wMaxPacketSize   : 0x1400 (5120 bytes)
           bInterval        :    0x1
    hex VendedorID=0xa5c& ProductId0x5801
    DEVICE ID 0a5c:5801 on Bus 000 Address 003 =================
     bLength                :   0x12 (18 bytes)
     bDescriptorType        :    0x1 Device
     bcdUSB                 :  0x110 USB 1.1
     bDeviceClass           :    0x0 Specified at interface
     bDeviceSubClass        :    0x0
     bDeviceProtocol        :    0x0
     bMaxPacketSize0        :   0x40 (64 bytes)
     idVendor               : 0x0a5c
     idProduct              : 0x5801
     bcdDevice              :  0x101 Device 1.01
     iManufacturer          :    0x1 Broadcom Corp
     iProduct               :    0x2 5880
     iSerialNumber          :    0x3 0123456789ABCD
     bNumConfigurations     :    0x1
      CONFIGURATION 0: 100 mA ==================================
       bLength              :    0x9 (9 bytes)
       bDescriptorType      :    0x2 Configuration
       wTotalLength         :   0xab (171 bytes)
       bNumInterfaces       :    0x3
       bConfigurationValue  :    0x0
       iConfiguration       :    0x0 
       bmAttributes         :   0xc0 Self Powered
       bMaxPower            :   0x32 (100 mA)
        INTERFACE 0: Application Specific ======================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x0
         bAlternateSetting  :    0x0
         bNumEndpoints      :    0x3
         bInterfaceClass    :   0xfe Application Specific
         bInterfaceSubClass :    0x0
         bInterfaceProtocol :    0x0
         iInterface         :    0x4 Broadcom USH w/swipe sensor
          ENDPOINT 0x81: Bulk IN ===============================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x81 IN
           bmAttributes     :    0x2 Bulk
           wMaxPacketSize   :   0x40 (64 bytes)
           bInterval        :    0x0
          ENDPOINT 0x1: Bulk OUT ===============================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :    0x1 OUT
           bmAttributes     :    0x2 Bulk
           wMaxPacketSize   :   0x40 (64 bytes)
           bInterval        :    0x0
          ENDPOINT 0x85: Interrupt IN ==========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x85 IN
           bmAttributes     :    0x3 Interrupt
           wMaxPacketSize   :   0x10 (16 bytes)
           bInterval        :   0x20
        INTERFACE 1: Smart Card ================================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x1
         bAlternateSetting  :    0x0
         bNumEndpoints      :    0x3
         bInterfaceClass    :    0xb Smart Card
         bInterfaceSubClass :    0x0
         bInterfaceProtocol :    0x0
         iInterface         :    0x5 Contacted SmartCard
          ENDPOINT 0x82: Bulk IN ===============================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x82 IN
           bmAttributes     :    0x2 Bulk
           wMaxPacketSize   :   0x40 (64 bytes)
           bInterval        :    0x0
          ENDPOINT 0x2: Bulk OUT ===============================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :    0x2 OUT
           bmAttributes     :    0x2 Bulk
           wMaxPacketSize   :   0x40 (64 bytes)
           bInterval        :    0x0
          ENDPOINT 0x86: Interrupt IN ==========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x86 IN
           bmAttributes     :    0x3 Interrupt
           wMaxPacketSize   :   0x10 (16 bytes)
           bInterval        :   0x20
        INTERFACE 3: Application Specific ======================
         bLength            :    0x9 (9 bytes)
         bDescriptorType    :    0x4 Interface
         bInterfaceNumber   :    0x3
         bAlternateSetting  :    0x0
         bNumEndpoints      :    0x1
         bInterfaceClass    :   0xfe Application Specific
         bInterfaceSubClass :    0x0
         bInterfaceProtocol :    0x0
         iInterface         :    0x7 Broadcom USH
          ENDPOINT 0x87: Interrupt IN ==========================
           bLength          :    0x7 (7 bytes)
           bDescriptorType  :    0x5 Endpoint
           bEndpointAddress :   0x87 IN
           bmAttributes     :    0x3 Interrupt
           wMaxPacketSize   :   0x10 (16 bytes)
           bInterval        :   0x20
    [Finished in 0.5s]

este es el dispositivo que no detecta:

introducir la descripción de la imagen aquí

1 respuesta 1

0

Para que pyusb detecte a los dipsositivos externos al pc es necesario. descargar la herramienta libusb-win32-bin-1.2.6.0 para poder instalar el archivo .info correspondiente a cada dispositivo.

introducir la descripción de la imagen aquí

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.