From: Joe <te...@jo...> - 2016-09-01 14:42:57
|
We use two DMMs UNI-T UT61B. They have two interfaces each, a RS232C Interface and a USB interface. The RS232C interfaces work well. Without any command before, the DMMs continuously send 2 .. 3 packages of 14 Bytes per second. We get them with a little Python 3.52 script, using PySerial. It's ok. But the younger of our computers have no RS232C comports, and I don't want to use virtual comports. So I try to use the USB interfaces of the DMMs with PyUSB 1.0, but somethin is wrong with this test script (using Win10 Version 1607, 64 bit): 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') dev.set_configuration (1) cfg = dev.get_active_configuration() intf = cfg [(0, 0)] ep = usb.util.find_descriptor (intf, custom_match = \ lambda e: usb.util.endpoint_direction (e.bEndpointAddress) == \ usb.util.ENDPOINT_IN) if ep == None: print ('ep is None') else: s = None while failures < failuresmaximum: try: s = ep.read (64, 50) print ('Success. len (s): ' + len (s)) counter = 0 except: failures += 1 print ('Failures: ' + str (failures)) if s == None: print ('No data read') else: for ss in s: print (str (ss)) # Not decoded; just to check: something received? print ('Starting') Gosub () print ('Ready.-') I get this output: Starting Multimeter UT61B was found Failures: 48 No data read Ready.- How to fix - any hint? Regards - Joe |