Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Last revision Both sides next revision | ||
en:python-usbtmc:readme [2013/06/23 07:42] alex created |
en:python-usbtmc:readme [2013/08/08 07:05] alex [Installation] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Python USBTMC Readme ====== | ====== Python USBTMC Readme ====== | ||
- | |||
- | For more information and updates: | ||
- | http://alexforencich.com/wiki/en/python-usbtmc/start | ||
- | |||
- | GitHub repository: | ||
- | https://github.com/alexforencich/python-usbtmc | ||
===== Introduction ===== | ===== Introduction ===== | ||
Python USBTMC provides a pure Python USBTMC driver for controlling instruments over USB. | Python USBTMC provides a pure Python USBTMC driver for controlling instruments over USB. | ||
+ | |||
+ | ===== Requirements ===== | ||
+ | |||
+ | * Python 2 or Python 3 | ||
+ | * PyUSB | ||
===== Installation ===== | ===== Installation ===== | ||
Line 15: | Line 14: | ||
Extract and run | Extract and run | ||
- | # python setup.py install | + | <code> |
+ | # python setup.py install | ||
+ | </code> | ||
+ | |||
+ | ===== Configuring udev ===== | ||
+ | |||
+ | If you cannot access your device without running your script as root, then you may need to create a udev rule to properly set the permissions of the device. First, connect your device and run lsusb. Find the vendor and product IDs. Then, create a file /etc/udev/rules.d/usbtmc.rules with the following content: | ||
+ | |||
+ | <code> | ||
+ | # USBTMC instruments | ||
+ | |||
+ | # Agilent MSO7104 | ||
+ | SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="0957", ATTRS{idProduct}=="1755", GROUP="usbtmc", MODE="0660" | ||
+ | </code> | ||
+ | |||
+ | substituting the correct idVendor and idProduct from lsusb. You will also need to create the usbtmc group and add yourself to it or substitute another group of your choosing. It seems that udev does not allow 0666 rules, usually overriding the mode to 0664, so you will need to be a member of the associated group to use the device. | ||
+ | |||
+ | If you want to put the kernel usbtmc device in the same group, add the following content to the usbtmc.rules file as well. This is optional as Python USBTMC bypasses and disconnects the kernel usbtmc driver and the device will actually disappear from /dev when Python USBTMC connects. | ||
+ | |||
+ | <code> | ||
+ | # Devices | ||
+ | KERNEL=="usbtmc/*", MODE="0660", GROUP="usbtmc" | ||
+ | KERNEL=="usbtmc[0-9]*", MODE="0660", GROUP="usbtmc" | ||
+ | </code> | ||
===== Usage examples ===== | ===== Usage examples ===== |