diff --git a/README b/README index dc5c52e..3e321e9 100644 --- a/README +++ b/README @@ -28,8 +28,9 @@ matplotlib Setup USB permissions for udev ------------------------------ -echo 'ACTION=="add", BUS=="usb", SYSFS{idVendor}=="1ab1", SYSFS{idProduct}=="0588", GROUP:="adm"' > tmpfile +echo 'ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1ab1", ATTRS{idProduct}=="0588", GROUP="adm"' > tmpfile sudo chown root:root tmpfile +sudo chmod 644 tmpfile sudo mv tmpfile /etc/udev/rules.d/10-rigol.rules sudo udevadm control --reload-rules @@ -40,6 +41,6 @@ On my DS1102E the WAVE:POINT:MODE options seem to have no effect. Maybe the fir udev can add more symlinks with SYMLINK+="usbtmc-newname" new udev rules -ACTION=="add", BUS=="usb", SYSFS{idVendor}=="164e", SYSFS{idProduct}=="0fa2", GROUP:="adm", SYMLINK+="usbtmc-bnc645" -ACTION=="add", BUS=="usb", SYSFS{idVendor}=="1ab1", SYSFS{idProduct}=="0588", GROUP:="adm", SYMLINK+="usbtmc-rigol" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="164e", ATTRS{idProduct}=="0fa2", GROUP:="adm", SYMLINK+="usbtmc-bnc645" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1ab1", ATTRS{idProduct}=="0588", GROUP:="adm", SYMLINK+="usbtmc-rigol" diff --git a/__init__.py b/__init__.py index dc8bfbf..868bdba 100644 --- a/__init__.py +++ b/__init__.py @@ -1,4 +1,5 @@ from oscope import * from rigol import RigolScope from waverunner import Waverunner -from utils import * \ No newline at end of file +from utils import * + diff --git a/rigol.py b/rigol.py index 6b5bfbd..33c4e80 100755 --- a/rigol.py +++ b/rigol.py @@ -27,7 +27,7 @@ RAW_DATA_LENGTH = 9000 class RigolScope(Scope): - '''Class to control a Rigol DS1000 series oscilloscope'' + '''Class to control a Rigol DS1000 series oscilloscope''' def __init__(self, device): '''Initialize Hardware''' try: @@ -188,7 +188,7 @@ def forceTrigger(self): if __name__ == "__main__": print "# RigolScope Test #" - scope = RigolScope("/dev/usbtmc-rigol") + scope = RigolScope("/dev/usbtmc0") scope.grabData() scope.writeWaveformToFile("out.dat") scope.close() diff --git a/tests/display_rigol.py b/tests/display_rigol.py index 5032430..a94b801 100755 --- a/tests/display_rigol.py +++ b/tests/display_rigol.py @@ -13,13 +13,11 @@ from matplotlib import pyplot import sys import os -sys.path.append(os.path.expanduser('~/Source')) -sys.path.append(os.path.expanduser('~/src')) -sys.path.append('/var/local/src') -from pyoscope import RigolScope +sys.path.append(os.path.expanduser('.')) +from rigol import RigolScope # Initialize our scope -scope = RigolScope("/dev/usbtmc-rigol") +scope = RigolScope("/dev/usbtmc0") scope.grabData() data1 = scope.getScaledWaveform(1) data2 = scope.getScaledWaveform(2) @@ -37,7 +35,7 @@ else: tUnit = "S" -# close interface +scope.unlock() scope.close() # Plot the data diff --git a/tests/display_wr.py b/tests/display_wr.py index d7fde98..a7a3075 100755 --- a/tests/display_wr.py +++ b/tests/display_wr.py @@ -13,10 +13,8 @@ from matplotlib import pyplot import sys import os -sys.path.append(os.path.expanduser('~/Source')) -sys.path.append(os.path.expanduser('~/src')) -sys.path.append('/var/local/src') -from pyoscope import Waverunner +sys.path.append(os.path.expanduser('.')) +from waverunner import Waverunner """ Example program to plot the Y-T data from one scope channel derived from capture_channel_1.py but using new interface methods """ diff --git a/tests/get_data.py b/tests/get_data.py index 0acdfdd..0b91bda 100755 --- a/tests/get_data.py +++ b/tests/get_data.py @@ -9,14 +9,12 @@ import sys import os from matplotlib import pyplot -sys.path.append(os.path.expanduser('~/Source')) -sys.path.append(os.path.expanduser('~/src')) -sys.path.append('/var/local/src') -from pyoscope import RigolScope -from pyoscope import Waverunner -from pyoscope import makeDataFilePath +sys.path.append(os.path.expanduser('.')) +from rigol import RigolScope +from waverunner import Waverunner +from utils import makeDataFilePath """ Capture data from Rigol oscilloscope and write to a file - usage: python save_channel.py + usage: python get_data.py if filename is not given STDOUT will be used""" SCOPE_ADDRESS = 'nigpib1' @@ -31,9 +29,10 @@ sys.exit(1) print filename -#scope = RigolScope("/dev/usbtmc0") -scope = Waverunner(SCOPE_ADDRESS) +scope = RigolScope("/dev/usbtmc0") +#scope = Waverunner(SCOPE_ADDRESS) scope.grabData() scope.writeWaveformToFile(filename) +scope.unlock() scope.close() diff --git a/tests/realtime_plot_demo.py b/tests/realtime_plot_demo.py index b15d955..36e0567 100755 --- a/tests/realtime_plot_demo.py +++ b/tests/realtime_plot_demo.py @@ -14,7 +14,10 @@ ''' import numpy from matplotlib import pyplot -from pyusbtmc import RigolScope +import sys +import os +sys.path.append(os.path.expanduser('.')) +from rigol import RigolScope import time # Initialize our scope