After quite some hassle talking to an OWON oscilloscope, there are new problems during the installation on another PC.
The USB driver seems to be installed, at least that's what Windows10 makes me believe.
The software which can be downloaded from PeakTech's homepage (DS_Wave V2.2.2) doesn't seem to work. When trying to connect the device remotely via that software it causes a "crash"/restart of the oscilloscope.
Anyway, I don't want to use their software but I would like to address the oscilloscope via pyUSB.
This little Python program is working on the first PC but not on the second PC.
### communicate with a Peaktech 1337 Oscilloscope (OWON)
import usb.core
import usb.util
from usb.backend import libusb1
def send(dev,cmd):
# address taken from results of print(dev): ENDPOINT 0x3: Bulk OUT
dev.write(3,cmd+'\r')
# address taken from results of print(dev): ENDPOINT 0x81: Bulk IN
result = (dev.read(0x81,10000,1000)).tobytes().decode('utf-8')[:-4]
return result
back = libusb1.get_backend()
print(type(back))
dev = usb.core.find(idVendor=0x5345, idProduct=0x1234, backend=back)
print(dev)
dev.set_configuration()
print(send(dev,"*IDN?"))
### end of script
Result on PC1: (Python 3.7.4)
<class 'NoneType'>
DEVICE ID 5345:1234 on Bus 000 Address 001 =================
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 : 0x294 Device 2.94
iManufacturer : 0x1 System CPU
iProduct : 0x2 Oscilloscope
iSerialNumber : 0x3 SERIAL
bNumConfigurations : 0x1
CONFIGURATION 1: 500 mA ==================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x20 (32 bytes)
bNumInterfaces : 0x1
bConfigurationValue : 0x1
iConfiguration : 0x5 Bulk Data Configuration
bmAttributes : 0xc0 Self Powered
bMaxPower : 0xfa (500 mA)
INTERFACE 0: Physical ==================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x0
bAlternateSetting : 0x0
bNumEndpoints : 0x2
bInterfaceClass : 0x5 Physical
bInterfaceSubClass : 0x6
bInterfaceProtocol : 0x50
iInterface : 0x4 Bulk Data Interface
ENDPOINT 0x81: Bulk IN ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x200 (512 bytes)
bInterval : 0x0
ENDPOINT 0x3: Bulk OUT ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x3 OUT
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x200 (512 bytes)
bInterval : 0x0
,P1337,1842237,V2.4. # <--- that's the response I'm expecting after sending `*IDN?`
Result on PC2: (Python 3.10.7)
<class 'usb.backend.libusb1._LibUSB'>
DEVICE ID 5345:1234 on Bus 001 Address 049 =================
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 : 0x294 Device 2.94
iManufacturer : 0x1 Error Accessing String
iProduct : 0x2 Error Accessing String
iSerialNumber : 0x3 Error Accessing String
bNumConfigurations : 0x1
CONFIGURATION 1: 500 mA ==================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x20 (32 bytes)
bNumInterfaces : 0x1
bConfigurationValue : 0x1
iConfiguration : 0x5 Error Accessing String
bmAttributes : 0xc0 Self Powered
bMaxPower : 0xfa (500 mA)
INTERFACE 0: Physical ==================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x0
bAlternateSetting : 0x0
bNumEndpoints : 0x2
bInterfaceClass : 0x5 Physical
bInterfaceSubClass : 0x6
bInterfaceProtocol : 0x50
iInterface : 0x4 Error Accessing String
ENDPOINT 0x81: Bulk IN ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x200 (512 bytes)
bInterval : 0x0
ENDPOINT 0x3: Bulk OUT ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x3 OUT
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x200 (512 bytes)
bInterval : 0x0
Traceback (most recent call last):
File "C:\Users\Lab\Programs\Test\Test_PeakTech.py", line 18, in <module>
dev.set_configuration()
File "C:\Users\Lab\AppData\Local\Programs\Python\Python310\lib\site-packages\usb\core.py", line 915, in set_configuration
self._ctx.managed_set_configuration(self, configuration)
File "C:\Users\Lab\AppData\Local\Programs\Python\Python310\lib\site-packages\usb\core.py", line 113, in wrapper
return f(self, *args, **kwargs)
File "C:\Users\Lab\AppData\Local\Programs\Python\Python310\lib\site-packages\usb\core.py", line 158, in managed_set_configuration
self.managed_open()
File "C:\Users\Lab\AppData\Local\Programs\Python\Python310\lib\site-packages\usb\core.py", line 113, in wrapper
return f(self, *args, **kwargs)
File "C:\Users\Lab\AppData\Local\Programs\Python\Python310\lib\site-packages\usb\core.py", line 131, in managed_open
self.handle = self.backend.open_device(self.dev)
File "C:\Users\Lab\AppData\Local\Programs\Python\Python310\lib\site-packages\usb\backend\libusb1.py", line 804, in open_device
return _DeviceHandle(dev)
File "C:\Users\Lab\AppData\Local\Programs\Python\Python310\lib\site-packages\usb\backend\libusb1.py", line 652, in __init__
_check(_lib.libusb_open(self.devid, byref(self.handle)))
File "C:\Users\Lab\AppData\Local\Programs\Python\Python310\lib\site-packages\usb\backend\libusb1.py", line 604, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)
What is going wrong here? I'm out of ideas and wasting my time
- which access and why is it denied?
- do I have the wrong driver at the right location or the right driver at the wrong location?
- might this be an issue between Python 3.7.4 and 3.10.7 ?
- any other info required to find out what the actual problem is?
Thank you for any hints.