-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usb timeouts on OS X 10.11.6 #27
Comments
tried Cedric's timeout pull request and got a different error:
|
tried running code against a DP832 programable power supply. got same timeout issue. seems like maybe there is some OS X funny business going on? |
OS X funny business would not surprise me at all. Have you tried with any other computers for comparison? |
Oh, can you try that with Cedric's timeout code and an explicit line termination like this?
or
It's possible that the instrument firmware is expecting a new line char. Some instruments are programmed properly and are fine with no extra chars, some need a little help. |
same timeout
got the same error :/ |
Same error here. Tried both /Users/lkostka/.virtualenvs/tmc/lib/python2.7/site-packages/usbtmc/usbtmc.pyc in ask(self, message, num, encoding)
628 self.lock()
629 self.write(message, encoding)
--> 630 return self.read(num, encoding)
631 finally:
632 if self.advantest_quirk and not was_locked:
/Users/lkostka/.virtualenvs/tmc/lib/python2.7/site-packages/usbtmc/usbtmc.pyc in read(self, num, encoding)
611 def read(self, num=-1, encoding='utf-8'):
612 "Read string from instrument"
--> 613 return self.read_raw(num).decode(encoding).rstrip('\r\n')
614
615 def ask(self, message, num=-1, encoding='utf-8'):
/Users/lkostka/.virtualenvs/tmc/lib/python2.7/site-packages/usbtmc/usbtmc.pyc in read_raw(self, num)
530 self.bulk_out_ep.write(req, timeout=int(self.timeout*1000))
531
--> 532 resp = self.bulk_in_ep.read(read_len+USBTMC_HEADER_SIZE+3, timeout=int(self.timeout*1000))
533
534 if sys.version_info >= (3, 2):
/Users/lkostka/.virtualenvs/tmc/lib/python2.7/site-packages/usb/core.pyc in read(self, size_or_buffer, timeout)
400 For details, see the Device.read() method.
401 """
--> 402 return self.device.read(self, size_or_buffer, timeout)
403
404 def clear_halt(self):
/Users/lkostka/.virtualenvs/tmc/lib/python2.7/site-packages/usb/core.pyc in read(self, endpoint, size_or_buffer, timeout)
986 intf.bInterfaceNumber,
987 buff,
--> 988 self.__get_timeout(timeout))
989
990 if isinstance(size_or_buffer, array.array):
/Users/lkostka/.virtualenvs/tmc/lib/python2.7/site-packages/usb/backend/libusb1.pyc in bulk_read(self, dev_handle, ep, intf, buff, timeout)
831 intf,
832 buff,
--> 833 timeout)
834
835 @methodtrace(_logger)
/Users/lkostka/.virtualenvs/tmc/lib/python2.7/site-packages/usb/backend/libusb1.pyc in __read(self, fn, dev_handle, ep, intf, buff, timeout)
934 # do not assume LIBUSB_ERROR_TIMEOUT means no I/O.
935 if not (transferred.value and retval == LIBUSB_ERROR_TIMEOUT):
--> 936 _check(retval)
937 return transferred.value
938
/Users/lkostka/.virtualenvs/tmc/lib/python2.7/site-packages/usb/backend/libusb1.pyc in _check(ret)
593 raise NotImplementedError(_strerror(ret))
594 else:
--> 595 raise USBError(_strerror(ret), ret, _libusb_errno[ret])
596
597 return ret
USBError: [Errno 60] Operation timed out
However device is detected.
|
I'm having the same problem. I have no problem finding my Rigol DS1054z scope on the USB but all commands time out when reading the response. pyUSB 1.0.0, python-usbtmc 0.8 on macOS 10.12.5. |
Rigol firmware does not implement usbtmc correctly. I am seriously considering removing all of the Rigol quirks from the code (they apply primarily to the 1052E, but not the 1000Z, which both share the same VID and PID so it is infeasible to determine which set of quirks to apply) and then just adding a disclaimer that Rigol devices may not work correctly. The Linux kernel driver has the same problem. |
Maybe leave code with quirks but let users use that one when they need. Default code will be without quirks and for those pesky rigol write a warning and how to use a wrapper class of some kind. Maybe that helps. I wonder how would scope work with TCP connection. Maybe swapping USB with TCP will work. |
Just a suggestion: How about removing the Rigol quirks from usbtmc.py, but provide a subclass rigol.py that overrides the read_raw method with the quirks. That way, it cleans up usbtmc.py, and only DS1052E users use the subclass. |
Not a bad idea, you would just need a subclass for basically every rigol instrument line as each one seems to implement USBTMC in their own special way. For example, the current code does not work AT ALL with the DS1000Z series units, with or without quirks. |
For whoever comes here in the future: I had the same issue with a Thorlabs device, but both on Mac OS and Linux (Debian). Thorlabs tech support mailed me a modified version of the usbtmc module that resolved the issue for me. Here's the diff:
|
hello,
i'm getting the following traceback from python when trying to send data to a Rigol mso1104z:
happy to collect more data if it will help.
The text was updated successfully, but these errors were encountered: