python-ivi / python-usbtmc

Provides a USBTMC driver for controlling instruments over USB
MIT License
160 stars 69 forks source link

Document how to use on OS X #13

Open probonopd opened 9 years ago

probonopd commented 9 years ago

The following works for me on OS X 10.9:

# Install prerequisites

$ sudo easy_install pyusb
(...) Installed /Library/Python/2.7/site-packages/pyusb-1.0.0b2-py2.7.egg

$ sudo easy_install libusb1
(...) Installed /Library/Python/2.7/site-packages/libusb1-1.3.0-py2.7.egg

$ brew install libusb

# Install python-usbtmc

$ git clone https://github.com/python-ivi/python-usbtmc.git
$ cd python-usbtmc
$ sudo python ./setup.py install
(...) Installed /Library/Python/2.7/site-packages/python_usbtmc-0.6-py2.7.egg

# Use python-usbtmc

$ python
(...)
>>> import usbtmc
>>> usbtmc.list_devices()
[<DEVICE ID 1ab1:04ce on Bus 253 Address 005>]

Note that I am using https://github.com/Homebrew/homebrew to install libusb.

1am commented 9 years ago

Thank you. It works!

kisielk commented 9 years ago

Hm, I have a Rigol DS1052E and got this installed successfully, but list_devices() returns an empty list. Has anyone got that working successfully ?

kisielk commented 9 years ago

Ah ha, I figured out the problem. In the "Utility" menu on the scope you need to set "USB Device" to "Computer" instead of "PictBridge". I was wondering why it was showing up as an imaging device...

mojca commented 7 years ago

One way to install this package on Mac is via MacPorts:

sudo port install py36-usbtmc

(replace 36 with your favourite version of Python).

I spent quite some time trying to figure out if this was supposed to work on macOS at all (I was looking for /dev/usbtmc etc.) and then realized that it works "automatically". The most helpful command was

print(usbtmc.list_devices())

This should probably be mentioned somewhere as well.