Author Topic: Rigol DS1054Z Screenshot via Linux command line  (Read 6147 times)

0 Members and 1 Guest are viewing this topic.

Offline WaveyDipoleTopic starter

  • Frequent Contributor
  • **
  • Posts: 852
  • Country: gb
Rigol DS1054Z Screenshot via Linux command line
« on: March 28, 2021, 10:08:33 pm »
I read recently in these two articles that it is possible to get a screenshot from a Rigol DS1054Z via the command line on Linux:

https://hackaday.io/project/6857-master-your-rigol-from-command-line
https://www.theimpossiblecode.com/blog/rigol-ds1054z-screen-capture-linux/

Since I use Linux most of the time, I had hoped this would be useful, however the problem is that it doesn't seem to work. I can connect to port 5555 using nc, telnet or PuTTy in RAW mode and the connection holds, but the scope just does not respond to anything including *IDN?. I tried the same on Windows but with the same result. The scope does respond when using the SCPI command console in UltraScope.

Aside from the fact that the connection stays open in nc, I have confirmed that port 5555 is open:

Starting Nmap 7.60 ( https://nmap.org ) at 2021-03-28 23:05 BST
Nmap scan report for 10.210.210.162
Host is up (0.0047s latency).
Not shown: 996 closed ports
PORT     STATE SERVICE
80/tcp   open  http
111/tcp  open  rpcbind
617/tcp  open  sco-dtmgr
5555/tcp open  freeciv

Nmap done: 1 IP address (1 host up) scanned in 0.13 seconds

I did a Wireshark capture of sending an *IDN? in UltraSigma and the rather weird thing is that it seems to be using port 618, which nmap does not even list as open?

I am using the lates available firmware 00.04.04.04.03, which is shown as 00.04.04.SP4 on the scope in System Information. It didn't work with the previous version 00.04.04.01.01/00.04.04.SP1 either.

Has anyone tried this on their DS1054Z scope and did it work?
« Last Edit: March 28, 2021, 10:38:09 pm by WaveyDipole »
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2259
  • Country: 00
Re: Rigol DS1054Z Screenshot via Linux command line
« Reply #1 on: March 28, 2021, 10:29:05 pm »
The following works fine here:

Connect to your scope via LAN using telnet: (change the ip-address to the actual address of your scope)

Code: [Select]
> telnet 192.168.1.100 5555
Trying 192.168.1.100...
Connected to 192.168.1.100.
Escape character is '^]'.
*IDN?
RIGOL TECHNOLOGIES,DS1104Z,DS1ZA170XXXXXX,00.04.04.SP3

Using USB connection:

Code: [Select]
echo "*IDN?" > /dev/usbtmc0; cat /dev/usbtmc0
RIGOL TECHNOLOGIES,DS1104Z,DS1ZA170XXXXXX,00.04.04.SP3
cat: /dev/usbtmc0: Connection timed out

 

Offline WaveyDipoleTopic starter

  • Frequent Contributor
  • **
  • Posts: 852
  • Country: gb
Re: Rigol DS1054Z Screenshot via Linux command line
« Reply #2 on: March 29, 2021, 03:25:49 pm »
Ok, tried it again today:

$ telnet 10.210.210.162 5555
Trying 10.210.210.162...
Connected to 10.210.210.162.
Escape character is '^]'.
*IDN?
RIGOL TECHNOLOGIES,DS1104Z,DS1ZA182712286,00.04.04.SP4

Guess it must have been a network glitch of some kind?
The screenshot examples now work as well.
Weird.
 

Offline HoracioDos

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: ar
  • Just an IT monkey with a DSO
Re: Rigol DS1054Z Screenshot via Linux command line
« Reply #3 on: March 29, 2021, 05:22:54 pm »
Hello.
You can use LXI-Tools if you don't want too much trouble.
https://github.com/lxi-tools/lxi-tools from Martin Lund.
https://lxi-tools.github.io
Latest version is available with Snap.

 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2259
  • Country: 00
 
The following users thanked this post: HoracioDos

Offline WaveyDipoleTopic starter

  • Frequent Contributor
  • **
  • Posts: 852
  • Country: gb
Re: Rigol DS1054Z Screenshot via Linux command line
« Reply #5 on: March 30, 2021, 12:48:07 pm »
Had a look at lxi-tools and the command line version seems to work and I was able to send SCPI commands and get a screenshot. Thanks for the link.

I initially installed it from the Linux repository but couldn't find the lxi-gui tool. I then downloaded the sources from the GitHub, but again, I got only the cli version. There is a ./src/gui/lxi-gui directory, but when I tried running make in there I got:

Quote
$ make
/usr/lib/x86_64-linux-gnu/qt4/bin/uic mainwindow.ui -o ui_mainwindow.h
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp
In file included from main.cpp:1:0:
mainwindow.h:6:10: fatal error: QtCharts/QChartView: No such file or directory
 #include <QtCharts/QChartView>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:231: recipe for target 'main.o' failed
make: *** [main.o] Error 1

It looks like am missing QtCharts, but I can't find such a module in the Linux Mint repository or any information on how to install it, so am a bit stuck at the moment.
« Last Edit: March 30, 2021, 01:36:06 pm by WaveyDipole »
 

Offline sb42

  • Contributor
  • Posts: 42
  • Country: 00
Re: Rigol DS1054Z Screenshot via Linux command line
« Reply #6 on: March 30, 2021, 04:07:59 pm »
Had a look at lxi-tools and the command line version seems to work and I was able to send SCPI commands and get a screenshot. Thanks for the link.

I initially installed it from the Linux repository but couldn't find the lxi-gui tool. I then downloaded the sources from the GitHub, but again, I got only the cli version. There is a ./src/gui/lxi-gui directory, but when I tried running make in there I got:

Quote
$ make
/usr/lib/x86_64-linux-gnu/qt4/bin/uic mainwindow.ui -o ui_mainwindow.h
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp
In file included from main.cpp:1:0:
mainwindow.h:6:10: fatal error: QtCharts/QChartView: No such file or directory
 #include <QtCharts/QChartView>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:231: recipe for target 'main.o' failed
make: *** [main.o] Error 1

It looks like am missing QtCharts, but I can't find such a module in the Linux Mint repository or any information on how to install it, so am a bit stuck at the moment.

It looks like you're building against qt4, whereas lxi-tools claims to require qt5. I suspect that the lxi-tools build system generates a (wrong) Makefile in the lxi-gui directory even if the build dependencies for that program aren't satisfied(?)

QTCharts should be in libqt5charts5-dev, which you'd need on top of qtbase5-dev. I can build and run lxi-gui on my Debian/unstable system like so:

Code: [Select]
./configure --enable-lxi-gui
make
./src/gui/lxi-gui/lxi-gui
 

Offline WaveyDipoleTopic starter

  • Frequent Contributor
  • **
  • Posts: 852
  • Country: gb
Re: Rigol DS1054Z Screenshot via Linux command line
« Reply #7 on: March 30, 2021, 05:57:36 pm »
QTCharts should be in libqt5charts5-dev, which you'd need on top of qtbase5-dev. I can build and run lxi-gui on my Debian/unstable system like so:

Code: [Select]
./configure --enable-lxi-gui
make
./src/gui/lxi-gui/lxi-gui

Thank you for the hints. It was the --enable-lxi-gui flag that I was missing. I apologise if I missed that info somewhere on their Github, but I don't see it mentioned.

I did a 'make clean' followed by './configure --enable-lxi-gui'. This time configure reports that Qt5Charts is required. I therefore checked and found that the binary version is installed but the dev version was not. I installed the missing dev package and ran configure again. This time it completed.

Make now compiles lxi and then attempts to compile the gui, but it fails with errors. The two errors seem to relate to the earlier warnings? It does. at least, seem to be using QT5. I'm still trying to figure out what the errors are about.

$ make
Making all in src
make[1]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src'
  CC       libapp_a-options.o
  CC       libapp_a-discover.o
discover.c: In function ‘discover’:
discover.c:66:20: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     info.broadcast = &broadcast;
                    ^
discover.c:67:17: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     info.device = &device;
                 ^
discover.c:68:18: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     info.service = &service;
                  ^
  CC       libapp_a-scpi.o
  CC       libapp_a-screenshot.o
  CC       libapp_a-benchmark.o
  CC       libapp_a-run.o
  CC       libapp_a-lxilua.o
lxilua.c: In function ‘connect’:
lxilua.c:51:26: warning: passing argument 1 of ‘lxi_connect’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     device = lxi_connect(address, 0, NULL, option.timeout, VXI11);
                          ^~~~~~~
In file included from lxilua.c:36:0:
/usr/include/lxi.h:59:5: note: expected ‘char *’ but argument is of type ‘const char *’
 int lxi_connect(char *address, int port, char *name, int timeout, lxi_protocol_t protocol);
     ^~~~~~~~~~~
lxilua.c: In function ‘scpi’:
lxilua.c:83:31: warning: passing argument 2 of ‘lxi_send’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     length = lxi_send(device, command, strlen(command), option.timeout);
                               ^~~~~~~
In file included from lxilua.c:36:0:
/usr/include/lxi.h:60:5: note: expected ‘char *’ but argument is of type ‘const char *’
 int lxi_send(int device, char *message, int length, int timeout);
     ^~~~~~~~
lxilua.c: In function ‘scpi_raw’:
lxilua.c:132:31: warning: passing argument 2 of ‘lxi_send’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     length = lxi_send(device, command, strlen(command), option.timeout);
                               ^~~~~~~
In file included from lxilua.c:36:0:
/usr/include/lxi.h:60:5: note: expected ‘char *’ but argument is of type ‘const char *’
 int lxi_send(int device, char *message, int length, int timeout);
     ^~~~~~~~
  CC       plugins/libapp_a-screenshot_keysight-dmm.o
  CC       plugins/libapp_a-screenshot_keysight-ivx.o
  CC       plugins/libapp_a-screenshot_rigol-1000z.o
  CC       plugins/libapp_a-screenshot_rigol-2000.o
  CC       plugins/libapp_a-screenshot_rigol-dg4000.o
  CC       plugins/libapp_a-screenshot_rigol-dm3068.o
  CC       plugins/libapp_a-screenshot_rigol-dp800.o
  CC       plugins/libapp_a-screenshot_rigol-dsa.o
  CC       plugins/libapp_a-screenshot_rohde-schwarz-hmo-rtb.o
  CC       plugins/libapp_a-screenshot_siglent-sdm3000.o
  CC       plugins/libapp_a-screenshot_siglent-sdg.o
  CC       plugins/libapp_a-screenshot_siglent-sds.o
  CC       plugins/libapp_a-screenshot_siglent-ssa3000x.o
  CC       plugins/libapp_a-screenshot_tektronix.o
  AR       libapp.a
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       main.o
  CCLD     lxi
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src'
Making all in man
make[1]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/man'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/man'
Making all in src/gui/lxi-gui
make[1]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
qtchooser -run-tool=qmake -qt=5 -makefile -o Makefile.qmake lxi-gui.pro \
   QT_INCDIR="//usr/local/include" \
   QT_LIBDIR="//usr/local/lib" \
   SNAPCRAFT="" \
   
Info: creating stash file /home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui/.qmake.stash
make -f Makefile.qmake  all
make[2]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCharts -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -isystem /usr/include/libdrm -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o main.o main.cpp
main.cpp: In function ‘void lxi_setup()’:
main.cpp:32:26: error: invalid conversion from ‘void (*)(const char*, const char*)’ to ‘void (*)(char*, char*)’ [-fpermissive]
     lxi_info.broadcast = &broadcast;
                          ^~~~~~~~~~
main.cpp:33:23: error: invalid conversion from ‘void (*)(const char*, const char*)’ to ‘void (*)(char*, char*)’ [-fpermissive]
     lxi_info.device = &device;
                       ^~~~~~~
Makefile.qmake:426: recipe for target 'main.o' failed
make[2]: *** [main.o] Error 1
make[2]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
Makefile:471: recipe for target 'all-local' failed
make[1]: *** [all-local] Error 2
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
Makefile:409: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
 

Offline sb42

  • Contributor
  • Posts: 42
  • Country: 00
Re: Rigol DS1054Z Screenshot via Linux command line
« Reply #8 on: March 30, 2021, 08:35:09 pm »
make[2]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCharts -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -isystem /usr/include/libdrm -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o main.o main.cpp
main.cpp: In function ‘void lxi_setup()’:
main.cpp:32:26: error: invalid conversion from ‘void (*)(const char*, const char*)’ to ‘void (*)(char*, char*)’ [-fpermissive]
     lxi_info.broadcast = &broadcast;
                          ^~~~~~~~~~
main.cpp:33:23: error: invalid conversion from ‘void (*)(const char*, const char*)’ to ‘void (*)(char*, char*)’ [-fpermissive]
     lxi_info.device = &device;
                       ^~~~~~~
Makefile.qmake:426: recipe for target 'main.o' failed
make[2]: *** [main.o] Error 1
make[2]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
Makefile:471: recipe for target 'all-local' failed
make[1]: *** [all-local] Error 2
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
Makefile:409: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

On my system, with liblxi-1.13, the prototypes of those two functions in lxi-gui's main.cpp match the corresponding types in liblxi's lxi_info_t struct from lxi.h.  On your system the types appear to differ.  Perhaps you can upgrade your liblxi or, uh, fix lxi-gui/main.cpp :)

(The right fix would be for lxi-tools to have a versioned dependency on a liblxi that implements the expected API, or to test the API at configure-time...)
 

Offline WaveyDipoleTopic starter

  • Frequent Contributor
  • **
  • Posts: 852
  • Country: gb
Re: Rigol DS1054Z Screenshot via Linux command line
« Reply #9 on: March 31, 2021, 02:50:20 pm »
Thank you once again. I have liblxi-1.8 on my system. This is not surprising since Linux Mint pulls from an older Ubuntu repository. I removed the library installed from the linux repository and downloaded the sources from the lxi-tools Github. The current liblxi library co compiled with minimal fuss(just needed libxml2). After that I ran 'make clean' and './configure --enable-lxi-gui again. This time another Qt component was missing - QtGui/QAction:

Code: [Select]
$ make
Making all in src
make[1]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src'
  CC       libapp_a-options.o
  CC       libapp_a-discover.o
  CC       libapp_a-scpi.o
  CC       libapp_a-screenshot.o
  CC       libapp_a-benchmark.o
  CC       libapp_a-run.o
  CC       libapp_a-lxilua.o
  CC       plugins/libapp_a-screenshot_keysight-dmm.o
  CC       plugins/libapp_a-screenshot_keysight-ivx.o
  CC       plugins/libapp_a-screenshot_rigol-1000z.o
  CC       plugins/libapp_a-screenshot_rigol-2000.o
  CC       plugins/libapp_a-screenshot_rigol-dg4000.o
  CC       plugins/libapp_a-screenshot_rigol-dm3068.o
  CC       plugins/libapp_a-screenshot_rigol-dp800.o
  CC       plugins/libapp_a-screenshot_rigol-dsa.o
  CC       plugins/libapp_a-screenshot_rohde-schwarz-hmo-rtb.o
  CC       plugins/libapp_a-screenshot_siglent-sdm3000.o
  CC       plugins/libapp_a-screenshot_siglent-sdg.o
  CC       plugins/libapp_a-screenshot_siglent-sds.o
  CC       plugins/libapp_a-screenshot_siglent-ssa3000x.o
  CC       plugins/libapp_a-screenshot_tektronix.o
  AR       libapp.a
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       main.o
  CCLD     lxi
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src'
Making all in man
make[1]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/man'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/man'
Making all in src/gui/lxi-gui
make[1]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
make -f Makefile.qmake  all
make[2]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCharts -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -isystem /usr/include/libdrm -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o main.o main.cpp
g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCharts -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -isystem /usr/include/libdrm -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o mainwindow.o mainwindow.cpp
In file included from mainwindow.cpp:2:0:
ui_mainwindow.h:14:10: fatal error: QtGui/QAction: No such file or directory
 #include <QtGui/QAction>
          ^~~~~~~~~~~~~~~
compilation terminated.
Makefile.qmake:437: recipe for target 'mainwindow.o' failed
make[2]: *** [mainwindow.o] Error 1
make[2]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
Makefile:471: recipe for target 'all-local' failed
make[1]: *** [all-local] Error 2
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
Makefile:409: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

I checked and I have libqt5gui5 installed and libqtgui4 apparently. I did a bit of digging and found that I need to add 'QT += widgets' to the .pro file. After a make clean and make, the program finally compiled. I then did a make install.

The problem I now have is that it is not finding liblxi.so.1:

Code: [Select]
$ lxi-gui
lxi-gui: error while loading shared libraries: liblxi.so.1: cannot open shared object file: No such file or directory

I ran 'sudo ldconfig' and after that was able to launch the gui. Phew!

On clicking 'Search', the gui identified the IP of my scope and I was able to send an *IDN? and grab a screenshot, so we finally have success! Got there in the end.

Thank you very much for your help with the compile issues.
« Last Edit: March 31, 2021, 04:08:51 pm by WaveyDipole »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf