I have a PM100D powermeter device from Thorlabs.

The problem I encounter is, I would like to communicate with it through writing and reading from the node file in /dev.

I tried doing this in ubuntu 16.04 previously, and I therefore created an appropriate udev rule that would make me owner and groupowner of the created node. However, this was leading nowhere, as I then could never write anything into the created node in /dev. I should say in ubuntu, somehow the system never created a usbtmc0 for me, it just created the node somewhere in /dev/bus/usb/xxx/yyy

When i tried doing the same writing and reading commands in Debian, it all worked fine. I now understand that the reason why is because i'm actually writing in /dev/usbtmc0 which is automatically created when i plug my device from Debian, but it did not in ubuntu. the node which was created in ubuntu, in the form /dev/bus/usb/xxx/yyy is created also now: therefore i have somehow both /dev/usbtmc0 and /dev/bus/usb/xxx/yyy being created when i plug my device in Debian. Again, if i try to communicate with the usbtmc0 node, all goes fine, but if i try to communicate through the xxx/yyy node, the writing goes wrong (i get a "OSError: [Errno 22] Invalid argument" from python). When plugged and unplugged in ubuntu and debian, i checked in each case that the module usbtmc was loaded, and it was loaded at plugin-time in each case (i made sure of that by first removing the module and then plugging the device, and after that, i checked that the module was loaded back)

So i suppose my question is double:

1) how could i change the default behaviour of node creation from usbtmc? that is, specifically in Debian, the node gets created for the root user, except i'd like to make my python script work for anyone on the computer. I can't quite seem to make udev help me here, because i don't seem to control the creation of usbtmc0. Any ideas?

2) is there a way to force usbtmc to create a node in ubuntu 16.04? it does not do it by itself, though it does with debian 9. also, somehow, on my computer, dmesg does not warn me about the creation of usbtmc0 node, whereas it does on another computer

[Mon Mar 12 16:26:55 2018] usb 3-1.6: new full-speed USB device number 15 using ehci-pci
[Mon Mar 12 16:27:00 2018] usb 3-1.6: New USB device found, idVendor=1313, idProduct=8078
[Mon Mar 12 16:27:00 2018] usb 3-1.6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Mon Mar 12 16:27:00 2018] usb 3-1.6: Product: PM100D
[Mon Mar 12 16:27:00 2018] usb 3-1.6: Manufacturer: Thorlabs
[Mon Mar 12 16:27:00 2018] usb 3-1.6: SerialNumber: P0016534

thanks very much for your help.

EDIT: as a matter of fact, i can indeed influence the usbtmc0 node with a udev rule, simply with such a line in the /etc/udev/rules.d/10-local-rules file

KERNEL=="usbtmc*", MODE="0666", GROUP="usbtmc"

A comment: you can also specifically target the PM100 power meters.


# Thorlabs PM100USB/PM100D
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1313", ATTRS{idProduct}=="8072", GROUP="usbtmc", MODE="0660"
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1313", ATTRS{idProduct}=="8078", GROUP="usbtmc", MODE="0660"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.