Hello,
I am trying to learn how to control my MP720016 from python 3 (using Spyder under Windows 10) and am having problems even connecting to it properly. My computer and programming knowledge/skills are pretty poor, so are almost certainly the cause! Any suggestions folks have would be greatly appreciated.
Here is an example Python session that fails using florentbr's API with an error indicating the device isn't present or locked by another application, followed by a few commands showing that the device is connected but that I don't have permissions to use it. I get the same results whether or not the scope software is up and running, and when it is, whether or not I have opened the SCPI Console. Likewise, if I do not attempt to use the API but first just try the usb commands I get the same permission error. After trying all of these variations, I re-tried them when running python as administrator (in case that was the permission error), and it did not make a difference.
In [1]: from vds1022 import *
In [2]: dev = VDS1022(debug=0)
Traceback (most recent call last):
File "C:\Users\tjm_f\AppData\Local\Temp\ipykernel_6696\630509923.py", line 1, in <module>
dev = VDS1022(debug=0)
File "C:\Users\tjm_f\Anaconda3\lib\site-packages\vds1022\vds1022.py", line 1403, in __init__
raise USBError("USB device %4X:%4X not found or locked by another application." % (
USBError: [Errno None] USB device 5345:1234 not found or locked by another application.
In [3]: import usb.core
In [4]: import usb.util
In [5]: dd = usb.core.find(idVendor=0x5345, idProduct=0x1234)
In [6]: dd.set_configuration()
Traceback (most recent call last):
File "C:\Users\tjm_f\AppData\Local\Temp\ipykernel_6696\2171008298.py", line 1, in <module>
dd.set_configuration()
File "C:\Users\tjm_f\Anaconda3\lib\site-packages\usb\core.py", line 915, in set_configuration
self._ctx.managed_set_configuration(self, configuration)
File "C:\Users\tjm_f\Anaconda3\lib\site-packages\usb\core.py", line 113, in wrapper
return f(self, *args, **kwargs)
File "C:\Users\tjm_f\Anaconda3\lib\site-packages\usb\core.py", line 158, in managed_set_configuration
self.managed_open()
File "C:\Users\tjm_f\Anaconda3\lib\site-packages\usb\core.py", line 113, in wrapper
return f(self, *args, **kwargs)
File "C:\Users\tjm_f\Anaconda3\lib\site-packages\usb\core.py", line 131, in managed_open
self.handle = self.backend.open_device(self.dev)
File "C:\Users\tjm_f\Anaconda3\lib\site-packages\usb\backend\libusb1.py", line 804, in open_device
return _DeviceHandle(dev)
File "C:\Users\tjm_f\Anaconda3\lib\site-packages\usb\backend\libusb1.py", line 652, in __init__
_check(_lib.libusb_open(self.devid, byref(self.handle)))
File "C:\Users\tjm_f\Anaconda3\lib\site-packages\usb\backend\libusb1.py", line 604, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
USBError: [Errno 13] Access denied (insufficient permissions)
In [7]: print(dd)
DEVICE ID 5345:1234 on Bus 001 Address 009 =================
bLength : 0x12 (18 bytes)
bDescriptorType : 0x1 Device
bcdUSB : 0x200 USB 2.0
bDeviceClass : 0x0 Specified at interface
bDeviceSubClass : 0x0
bDeviceProtocol : 0x0
bMaxPacketSize0 : 0x40 (64 bytes)
idVendor : 0x5345
idProduct : 0x1234
bcdDevice : 0x100 Device 1.0
iManufacturer : 0x1 Error Accessing String
iProduct : 0x2 Error Accessing String
iSerialNumber : 0x3 Error Accessing String
bNumConfigurations : 0x1
CONFIGURATION 1: 100 mA ==================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x29 (41 bytes)
bNumInterfaces : 0x1
bConfigurationValue : 0x1
iConfiguration : 0x0
bmAttributes : 0x80 Bus Powered
bMaxPower : 0x32 (100 mA)
INTERFACE 0: Physical ==================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x0
bAlternateSetting : 0x0
bNumEndpoints : 0x2
bInterfaceClass : 0x5 Physical
bInterfaceSubClass : 0x0
bInterfaceProtocol : 0x0
iInterface : 0x0
ENDPOINT 0x81: Bulk IN ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x40 (64 bytes)
bInterval : 0x20
ENDPOINT 0x1: Bulk OUT ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x1 OUT
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x40 (64 bytes)
bInterval : 0x20
I have also included a screenshot of the device manager, in case that gives some extra info.
Thanks!
Jason