I am trying to get data from the usb interface of an UT61B DMM.
That's my test program:

import usb.util
import usb.backend.libusb1

def Gosub():
     failures = 0
     failuresmaximum = 48
     dev = usb.core.find (idVendor = 0x1a86, idProduct = 0xe008) # 
Multimeter UT61B
     if dev == None:
         print ('Multimeter UT61B not found')
     else:
         print ('Multimeter UT61B was found')
         print ('dev:\n' + str (dev) + '\n')
         dev.set_configuration ()
         ep = dev [0] [0,0] [0]
         if ep == None:
             print ('ep is None')
         else:
             data = None
             while failures < failuresmaximum:
                 try:
                     data = dev.read (ep.bEndpointAddress, ep.wMaxPackeSize)
                     print ('Success. len (date): ' + len (date))
                 except:
                     failures += 1
             print ('Failures: ' + str (failures))
             if data == None:
                 print ('No data read')
             else:
                 for ss in data:
                     print (str (ss))

print ('Starting')
Gosub ()
print ('Ready.-')

I get this output:

Starting
Multimeter UT61B was found
dev:
DEVICE ID 1a86:e008 on Bus 004 Address 002 =================
  bLength                :   0x12 (18 bytes)
  bDescriptorType        :    0x1 Device
  bcdUSB                 :  0x100 USB 1.0
  bDeviceClass           :    0x0 Specified at interface
  bDeviceSubClass        :    0x0
  bDeviceProtocol        :    0x0
  bMaxPacketSize0        :    0x8 (8 bytes)
  idVendor               : 0x1a86
  idProduct              : 0xe008
  bcdDevice              : 0x1200 Device 18.0
  iManufacturer          :    0x1 WCH.CN 
  iProduct               :    0x2 USB to Serial
  iSerialNumber          :    0x0
  bNumConfigurations     :    0x1
   CONFIGURATION 1: 100 mA ==================================
    bLength              :    0x9 (9 bytes)
    bDescriptorType      :    0x2 Configuration
    wTotalLength         :   0x29 (41 bytes)
    bNumInterfaces       :    0x1
    bConfigurationValue  :    0x1
    iConfiguration       :    0x4 Error Accessing String
    bmAttributes         :   0x80 Bus Powered
    bMaxPower            :   0x32 (100 mA)
     INTERFACE 0: Human Interface Device ====================
      bLength            :    0x9 (9 bytes)
      bDescriptorType    :    0x4 Interface
      bInterfaceNumber   :    0x0
      bAlternateSetting  :    0x0
      bNumEndpoints      :    0x2
      bInterfaceClass    :    0x3 Human Interface Device
      bInterfaceSubClass :    0x0
      bInterfaceProtocol :    0x0
      iInterface         :    0x0
       ENDPOINT 0x82: Interrupt IN ==========================
        bLength          :    0x7 (7 bytes)
        bDescriptorType  :    0x5 Endpoint
        bEndpointAddress :   0x82 IN
        bmAttributes     :    0x3 Interrupt
        wMaxPacketSize   :    0x8 (8 bytes)
        bInterval        :    0x5
       ENDPOINT 0x2: Interrupt OUT ==========================
        bLength          :    0x7 (7 bytes)
        bDescriptorType  :    0x5 Endpoint
        bEndpointAddress :    0x2 OUT
        bmAttributes     :    0x3 Interrupt
        wMaxPacketSize   :    0x8 (8 bytes)
        bInterval        :    0x5

Failures: 48
No data read
Ready.-

Here is the USB trace of this failing code:

  0 InfoStart  23:07:22.463 00:00:00.000 00:00:00.000
PNP 1 IRP_MN_QUERY_CAPABILITIES Down 23:07:32.703 00:00:10.239 00:00:10.239
PNP 2 IRP_MN_QUERY_CAPABILITIES Up 23:07:32.703 00:00:10.239 
00:00:00.000 00:00:00.000   SUCCESS
URB 3 URB_FUNCTION_CLASS_INTERFACE Down 23:07:32.795 00:00:10.332 
00:00:00.092  0 bytes OUT PENDING
URB 4 URB_FUNCTION_CONTROL_TRANSFER Up 23:07:32.795 00:00:10.332 
00:00:00.000 00:00:00.000 0 bytes OUT SUCCESS
URB 5 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Down 23:07:32.795 
00:00:10.332 00:00:00.000  8 bytes IN PENDING
URB 6 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Down 23:07:32.795 
00:00:10.332 00:00:00.000  8 bytes IN PENDING
URB 7 URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE Down 23:07:32.795 
00:00:10.332 00:00:00.000  258 bytes IN PENDING
URB 8 URB_FUNCTION_CONTROL_TRANSFER Up 23:07:32.795 00:00:10.332 
00:00:00.000 00:00:00.000 18 bytes IN SUCCESS
URB 9 URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE Down 23:07:32.795 
00:00:10.332 00:00:00.000  258 bytes IN PENDING
URB 10 URB_FUNCTION_CONTROL_TRANSFER Up 23:07:32.795 00:00:10.332 
00:00:00.000 00:00:00.000 28 bytes IN SUCCESS
IOCTL 11 IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION Down 23:07:33.806 
00:00:11.343 00:00:01.010    PENDING
USBINTERFACE 12 IdleNotification Down 23:07:33.806 00:00:11.343 
00:00:00.000    PENDING
URB 13 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Up 23:07:33.806 
00:00:11.343 00:00:00.000 00:00:01.010 0 bytes IN CANCELLED
URB 14 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Up 23:07:33.806 
00:00:11.343 00:00:00.000 00:00:01.010 0 bytes IN CANCELLED
USBINTERFACE 15 IdleNotification Down 23:07:33.806 00:00:11.343 
00:00:00.000    PENDING
  16 InfoStop  23:07:38.742 00:00:16.278 00:00:04.935 00:00:16.278

And here is the USB trace of a c++ program, which succeeds in reading 
this DMM:

  0 InfoStart  23:18:54.186 00:00:00.000 00:00:00.000
PNP 1 IRP_MN_QUERY_ID Down 23:19:03.550 00:00:09.364 00:00:09.364
PNP 2 IRP_MN_QUERY_ID Up 23:19:03.550 00:00:09.364 00:00:00.000 
00:00:00.000   SUCCESS
PNP 3 IRP_MN_QUERY_CAPABILITIES Down 23:19:03.550 00:00:09.364 00:00:00.000
PNP 4 IRP_MN_QUERY_CAPABILITIES Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000   SUCCESS
PNP 5 IRP_MN_QUERY_DEVICE_TEXT Down 23:19:03.550 00:00:09.364 00:00:00.000
PNP 6 IRP_MN_QUERY_DEVICE_TEXT Up 23:19:03.550 00:00:09.364 00:00:00.000 
00:00:00.000   SUCCESS
PNP 7 IRP_MN_QUERY_DEVICE_TEXT Down 23:19:03.550 00:00:09.364 00:00:00.000
PNP 8 IRP_MN_QUERY_DEVICE_TEXT Up 23:19:03.550 00:00:09.364 00:00:00.000 
00:00:00.000   SUCCESS
PNP 9 IRP_MN_QUERY_ID Down 23:19:03.550 00:00:09.364 00:00:00.000
PNP 10 IRP_MN_QUERY_ID Up 23:19:03.550 00:00:09.364 00:00:00.000 
00:00:00.000   SUCCESS
PNP 11 IRP_MN_QUERY_ID Down 23:19:03.550 00:00:09.364 00:00:00.000
PNP 12 IRP_MN_QUERY_ID Up 23:19:03.550 00:00:09.364 00:00:00.000 
00:00:00.000   SUCCESS
PNP 13 IRP_MN_QUERY_ID Down 23:19:03.550 00:00:09.364 00:00:00.000
PNP 14 IRP_MN_QUERY_ID Up 23:19:03.550 00:00:09.364 00:00:00.000 
00:00:00.000   SUCCESS
PNP 15 IRP_MN_QUERY_ID Down 23:19:03.550 00:00:09.364 00:00:00.000
PNP 16 IRP_MN_QUERY_ID Up 23:19:03.550 00:00:09.364 00:00:00.000 
00:00:00.000   NOT_SUPPORTED
PNP 17 IRP_MN_QUERY_INTERFACE Down 23:19:03.550 00:00:09.364 00:00:00.000
PNP 18 IRP_MN_QUERY_INTERFACE Up 23:19:03.550 00:00:09.364 00:00:00.000 
00:00:00.000   SUCCESS
PNP 19 IRP_MN_QUERY_BUS_INFORMATION Down 23:19:03.550 00:00:09.364 
00:00:00.000
PNP 20 IRP_MN_QUERY_BUS_INFORMATION Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000   SUCCESS
PNP 21 IRP_MN_QUERY_RESOURCE_REQUIREMENTS Down 23:19:03.550 00:00:09.364 
00:00:00.000
PNP 22 IRP_MN_QUERY_RESOURCE_REQUIREMENTS Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000   NOT_SUPPORTED
PNP 23 IRP_MN_QUERY_RESOURCES Down 23:19:03.550 00:00:09.364 00:00:00.000
PNP 24 IRP_MN_QUERY_RESOURCES Up 23:19:03.550 00:00:09.364 00:00:00.000 
00:00:00.000   NOT_SUPPORTED
PNP 25 IRP_MN_DEVICE_ENUMERATED Down 23:19:03.550 00:00:09.364 00:00:00.000
PNP 26 IRP_MN_QUERY_INTERFACE Down 23:19:03.550 00:00:09.364 00:00:00.000
PNP 27 IRP_MN_QUERY_INTERFACE Up 23:19:03.550 00:00:09.364 00:00:00.000 
00:00:00.000   NOT_SUPPORTED
PNP 28 IRP_MN_DEVICE_ENUMERATED Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000   SUCCESS
PNP 29 IRP_MN_QUERY_LEGACY_BUS_INFORMATION Down 23:19:03.550 
00:00:09.364 00:00:00.000
PNP 30 IRP_MN_QUERY_LEGACY_BUS_INFORMATION Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000   NOT_SUPPORTED
PNP 31 IRP_MN_QUERY_RESOURCE_REQUIREMENTS Down 23:19:03.550 00:00:09.364 
00:00:00.000
PNP 32 IRP_MN_QUERY_RESOURCE_REQUIREMENTS Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000   NOT_SUPPORTED
PNP 33 IRP_MN_FILTER_RESOURCE_REQUIREMENTS Down 23:19:03.550 
00:00:09.364 00:00:00.000
PNP 34 IRP_MN_FILTER_RESOURCE_REQUIREMENTS Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000   NOT_SUPPORTED
PNP 35 IRP_MN_QUERY_CAPABILITIES Down 23:19:03.550 00:00:09.364 
00:00:00.000
PNP 36 IRP_MN_QUERY_CAPABILITIES Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000   SUCCESS
PNP 37 IRP_MN_START_DEVICE Down 23:19:03.550 00:00:09.364 00:00:00.000
PNP 38 IRP_MN_START_DEVICE Up 23:19:03.550 00:00:09.364 00:00:00.000 
00:00:00.000   SUCCESS
URB 39 URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE Down 23:19:03.550 
00:00:09.364 00:00:00.000  18 bytes IN PENDING
URB 40 URB_FUNCTION_CONTROL_TRANSFER Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000 18 bytes IN SUCCESS
URB 41 URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE Down 23:19:03.550 
00:00:09.364 00:00:00.000  9 bytes IN PENDING
URB 42 URB_FUNCTION_CONTROL_TRANSFER Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000 9 bytes IN SUCCESS
URB 43 URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE Down 23:19:03.550 
00:00:09.364 00:00:00.000  41 bytes IN PENDING
URB 44 URB_FUNCTION_CONTROL_TRANSFER Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000 41 bytes IN SUCCESS
URB 45 URB_FUNCTION_SELECT_CONFIGURATION Down 23:19:03.550 00:00:09.364 
00:00:00.000  41 bytes OUT
URB 46 URB_FUNCTION_SELECT_CONFIGURATION Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000 41 bytes IN SUCCESS
URB 47 URB_FUNCTION_CLASS_INTERFACE Down 23:19:03.550 00:00:09.364 
00:00:00.000  0 bytes OUT PENDING
URB 48 URB_FUNCTION_CONTROL_TRANSFER Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000 0 bytes OUT SUCCESS
URB 49 URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE Down 23:19:03.550 
00:00:09.364 00:00:00.000  101 bytes IN PENDING
URB 50 URB_FUNCTION_CONTROL_TRANSFER Up 23:19:03.550 00:00:09.364 
00:00:00.000 00:00:00.000 37 bytes IN SUCCESS
URB 51 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Down 23:19:03.566 
00:00:09.380 00:00:00.015  8 bytes IN PENDING
URB 52 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Down 23:19:03.566 
00:00:09.380 00:00:00.000  8 bytes IN PENDING
PNP 53 IRP_MN_QUERY_CAPABILITIES Down 23:19:03.566 00:00:09.380 
00:00:00.000
PNP 54 IRP_MN_QUERY_CAPABILITIES Up 23:19:03.566 00:00:09.380 
00:00:00.000 00:00:00.000   SUCCESS
PNP 55 IRP_MN_QUERY_PNP_DEVICE_STATE Down 23:19:03.566 00:00:09.380 
00:00:00.000
PNP 56 IRP_MN_QUERY_PNP_DEVICE_STATE Up 23:19:03.566 00:00:09.380 
00:00:00.000 00:00:00.000   NOT_SUPPORTED
PNP 57 IRP_MN_QUERY_DEVICE_RELATIONS Down 23:19:03.566 00:00:09.380 
00:00:00.000
PNP 58 IRP_MN_QUERY_DEVICE_RELATIONS Up 23:19:03.566 00:00:09.380 
00:00:00.000 00:00:00.000   SUCCESS
PNP 59 IRP_MN_QUERY_ID Down 23:19:03.566 00:00:09.380 00:00:00.000
PNP 60 IRP_MN_QUERY_ID Up 23:19:03.566 00:00:09.380 00:00:00.000 
00:00:00.000   SUCCESS
PNP 61 IRP_MN_QUERY_ID Down 23:19:03.566 00:00:09.380 00:00:00.000
PNP 62 IRP_MN_QUERY_ID Up 23:19:03.566 00:00:09.380 00:00:00.000 
00:00:00.000   SUCCESS
PNP 63 IRP_MN_QUERY_DEVICE_RELATIONS Down 23:19:03.566 00:00:09.380 
00:00:00.000
PNP 64 IRP_MN_QUERY_DEVICE_RELATIONS Up 23:19:03.566 00:00:09.380 
00:00:00.000 00:00:00.000   SUCCESS
URB 65 URB_FUNCTION_CLASS_INTERFACE Down 23:19:07.756 00:00:13.570 
00:00:04.190  5 bytes OUT PENDING
URB 66 URB_FUNCTION_CONTROL_TRANSFER Up 23:19:07.756 00:00:13.570 
00:00:00.000 00:00:00.000 5 bytes OUT SUCCESS
URB 67 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Up 23:19:07.756 
00:00:13.570 00:00:00.000 00:00:04.190 8 bytes IN SUCCESS
URB 68 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Down 23:19:07.756 
00:00:13.570 00:00:00.000  8 bytes IN PENDING
URB 69 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Up 23:19:07.772 
00:00:13.586 00:00:00.015 00:00:04.205 8 bytes IN SUCCESS
URB 70 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Down 23:19:07.772 
00:00:13.586 00:00:00.000  8 bytes IN PENDING
URB 71 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Up 23:19:07.788 
00:00:13.601 00:00:00.015 00:00:00.031 8 bytes IN SUCCESS
URB 72 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Down 23:19:07.788 
00:00:13.601 00:00:00.000  8 bytes IN PENDING
URB 73 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Up 23:19:07.788 
00:00:13.601 00:00:00.000 00:00:00.015 8 bytes IN SUCCESS
URB 74 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Down 23:19:07.788 
00:00:13.601 00:00:00.000  8 bytes IN PENDING
URB 75 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Up 23:19:07.803 
00:00:13.617 00:00:00.015 00:00:00.015 8 bytes IN SUCCESS
URB 76 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER Down 23:19:07.803 
00:00:13.617 00:00:00.000  8 bytes IN PENDING
...

How should I change the above pyusb test program to get the DMM results?
Regards - Joe











------------------------------------------------------------------------------
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to