-
Notifications
You must be signed in to change notification settings - Fork 72
Description
Hello,
I got python-usbtmc working yesterday, and was having a good time connecting to my Keysight Ocilloscope, running IDN queries, etc. All from my Raspberry Pi 3B+. I followed everything in the readme file, except the optional Kernel bit. But this morning, it's not working!
The output from lsusb:
pi@raspberrypi:~ $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 04d9:0007 Holtek Semiconductor, Inc.
Bus 001 Device 004: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 001 Device 023: ID 0957:0588 Agilent Technologies, Inc.
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
My usbtmc.rules file:
# USBTMC instruments
# Agilent DSO1052B
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="0x0957", ATTRS{idProduct}=="0x0588", GROUP="usbtmc", MODE="0660"
My Python3 code:
>>> import usbtmc
>>> inst = usbtmc.Instrument(0x0957, 0x0588)
>>> print(inst.ask("*IDN")
However, this morning the exact same code is returning:
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)
The Pi was left on overnight, too - so nothing should have restarted, etc. The USB device was disconnected and reconnected in the morning. I didn't change anything, other than I probably re-started Python.
I've gone back through the readme (again, not the optional part) and I'm just not getting anywhere. When plugged in, the device is added to /dev/usbtmc0. Using ls -all, I get:
pi@raspberrypi:/dev $ ls -all | grep usbtmc*
crw------- 1 root root 180, 176 Jun 11 14:13 usbtmc0
Which doesn't look right to me. I've done some udevadm debugging to try and highlight an issue, and I'm seeing this line, which looks wrong, as I'd expect the mode to be picked up from my usbtmc.rules file:
usbtmc0: Handling device node '/dev/usbtmc0', devnum=c180:176, mode=0600, uid=0, gid=0
Does anyone have any thoughts?