Hi,
I'm using PyUSB along with usblib1 and python-usbtmc, and I am getting this
strange error every time I attempt to do anything with an instantiated
"Instrument" object from python-usbtmc with a particular USB device. Other
USB devices work fine with these same Python libraries. What is going on
here? It seems like "None" should never be a valid error number (should
actually be a real number). Any thoughts on what to look for or where to
go next? I'm a realtive newbie to Python debugging, so any pointers to
good debugging practices would be appreciated also.
I am running Mac OS X El Capitan (10.11.6).
Some details of what I am doing:
import usbtmc
hdo = usbtmc.Instrument(0x05FF,0x1023)
hdo.ask('*IDN?')
results in:
USBError: [Errno None] Other error
This exact same sequence (with different USB VID and PID) works with other
gear.
The traceback shows that the lowest level function in usbtmc that causes
this error is "clear()". In other words, this produces the same error:
import usbtmc
hdo = usbtmc.Instrument(0x05FF,0x1023)
hdo.clear()
Any ideas? I may start experimenting with different backends to see if
that yields anything interesting.
Here are some details of my setup:
Python 2.7.12 (see below)
$ brew info libusb
libusb: stable 1.0.20 (bottled), HEAD
Library for USB device access
http://libusb.info
/usr/local/Cellar/libusb/1.0.20 (27 files, 492.9K) *
Poured from bottle on 2016-08-17 at 10:52:34
From: https://github.com/Homebrew/homebrew-core/blob/master/Formul
a/libusb.rb
==> Options
--universal
Build a universal binary
--with-default-log-level-debug
Build with default runtime log level of debug (instead of none)
--without-runtime-logging
Build without runtime logging functionality
--HEAD
Install HEAD version
$ pip show PyUSB
---
Metadata-Version: 2.0
Name: pyusb
Version: 1.0.0
...
$ pip show libusb1
---
Metadata-Version: 2.0
Name: libusb1
Version: 1.5.1
...
$ pip show python-usbtmc
---
Metadata-Version: 2.0
Name: python-usbtmc
Version: 0.7
...
Here is the traceback from iPython at the exception (I will provide the
full DEBUG output in a subsequent posting since otherwise this post exceeds
the max allowable size):
USBError Traceback (most recent call last)
<ipython-input-3-a36f0cb89a8d> in <module>()
----> 1 hdo.clear()
/usr/local/lib/python2.7/site-packages/usbtmc/usbtmc.pyc in clear(self)
634
635 if not self.connected:
--> 636 self.open()
637
638 # Send INITIATE_CLEAR
/usr/local/lib/python2.7/site-packages/usbtmc/usbtmc.pyc in open(self)
336 self.connected = True
337
--> 338 self.clear()
339
340 self.get_capabilities()
/usr/local/lib/python2.7/site-packages/usbtmc/usbtmc.pyc in clear(self)
643 self.iface.index,
644 0x0001,
--> 645 timeout=self.timeout)
646 if (b[0] == USBTMC_STATUS_SUCCESS):
647 # Initiate clear succeeded, wait for completion
/usr/local/lib/python2.7/site-packages/usb/core.pyc in ctrl_transfer(self,
bmRequestType, bRequest, wValue, wIndex, data_or_wLength, timeout)
1032 and rqtype != util.CTRL_TYPE_VENDOR:
1033 interface_number = wIndex & 0xff
-> 1034 self._ctx.managed_claim_interface(self,
interface_number)
1035
1036 ret = self._ctx.backend.ctrl_transfer(
/usr/local/lib/python2.7/site-packages/usb/core.pyc in wrapper(self, *args,
**kwargs)
100 try:
101 self.lock.acquire()
--> 102 return f(self, *args, **kwargs)
103 finally:
104 self.lock.release()
/usr/local/lib/python2.7/site-packages/usb/core.pyc in
managed_claim_interface(self, device, intf)
165
166 if i not in self._claimed_intf:
--> 167 self.backend.claim_interface(self.handle, i)
168 self._claimed_intf.add(i)
169
/usr/local/lib/python2.7/site-packages/usb/_debug.pyc in do_trace(*args,
**named_args)
58 fn = type(args[0]).__name__ + '.' + f.__name__
59 _trace_function_call(logger, fn, *args[1:],
**named_args)
---> 60 return f(*args, **named_args)
61 _interop._update_wrapper(do_trace, f)
62 return do_trace
/usr/local/lib/python2.7/site-packages/usb/backend/libusb1.pyc in
claim_interface(self, dev_handle, intf)
809 @methodtrace(_logger)
810 def claim_interface(self, dev_handle, intf):
--> 811 _check(self.lib.libusb_claim_interface(dev_handle.handle,
intf))
812
813 @methodtrace(_logger)
/usr/local/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 None] Other error
------------------------------------------------------------------------------
_______________________________________________
pyusb-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyusb-users