EEVblog Electronics Community Forum

Products => Test Equipment => Topic started by: Tom Swift on April 29, 2019, 02:22:47 am

Title: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: Tom Swift on April 29, 2019, 02:22:47 am
*** SEE MY POST BELOW ON HOW TO SETUP X-WINDOWS ON A WINDOWS PC TO CONNECT TO THE HP1660 ***

Hi.  Apologies if this had been discussed before.  I could not find a thread on here to explain this.

I've been playing with this machine and using it for testing signals which works perfect.  The documentation is great for explaining how it works.
 I made the mistake of digging deeper into its functionality and seeing if I can hook this thing up to my PC through X Windows.  Unfortunately, there is no documentation that I can find to explain this process, (and what's available in either the documentation or the machine itself is poor).  The machine does have an Ethernet socket.

Thanks,
Tom
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: 0culus on April 29, 2019, 02:26:24 am
https://literature.cdn.keysight.com/litweb/pdf/01660-97028.pdf (https://literature.cdn.keysight.com/litweb/pdf/01660-97028.pdf)

Page 514

Seems straightforward to me, as long as you have a UNIX or UNIX-like OS on your LAN running the X server.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: Tom Swift on April 29, 2019, 02:37:14 am
Ah... gotcha.  Refer to page 494 of this document previous poster sent.  Sorry about that.  Guess I needed another pair of eyeballs.  Thanks.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: 0culus on April 29, 2019, 05:40:06 am
No problem. Hope that gets you up and running.  :-+
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: LapTop006 on April 29, 2019, 01:56:08 pm
If you're not a long-time UNIX user you probably want to play with using a Linux VM (or two) to learn how X works across a network, and what you need to do to make it work these days (by default X normally doesn't listen on the network any more).

Some rough notes:

On the display machine, once you've enabled network listening (assume you're on a trusted network) you run "xhost +" to enable any network users to connect (due to the way X works this is a pretty big security hole, so only do it on a network you fully trust).

On another VM, at a console or SSH you can do something like "DISPLAY=<IP of display>:0 xterm" to pop up an xterm (choose whatever X program you like) on display 0 of the target machine.

Once you have that working, it should be more obvious how to make the analyzer work.

There are (or at least were) X server implementations for Windows, but I've not used one in a very long time, MacOS X also used to have an easily installable optional X server, but I've also not used it in a long time.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: gslick on April 29, 2019, 03:11:57 pm
One of the slightly non-obvious things with setting up the HP logic analyzers for remote use on an X Window System server is getting the logic analyzer specific font files installed on the server.

In the SYSTEM directory on the analyzer hard disk there should be two font files, LG165.BDF and SM165.BDF. Also there should be a README file which contains some hints on copying the font files to the server and using mkfontdir and xset +fp to point to server to the additional fonts.

Without the logic analyzer specific font files on the server most things will still work, although some things won't be display correctly.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: BloodyCactus on April 29, 2019, 05:06:53 pm
It can be quite a pain, as the current windows X system is different to the old one HP used. I got my 1670 running on modern ubuntu, but the screen was same size as screen on display, its workable but not by much more.

You will have issues with permissions and things on the linux side, from memory, fonts are an issue too. It uses an older X protocol that modern ubuntu distros didnt like much (and this was a few years ago!).
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: 0culus on April 29, 2019, 06:00:24 pm
If the OP has an old PC laying around, he could probably install an older distro on it and have more success. Of course I would only recommend doing this if 1) this machine and the logic analyzer don't have routes to the internet and 2) he has a trustworthy LAN. The former is easy to accomplish with either a firewall appliance or a segregated LAN that doesn't have any connection to an internet facing gateway.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: Tom Swift on April 30, 2019, 09:44:27 am
Here's how I set up my HP1660 on a Windows XP machine:

**** Connect to your HP1660 through X-Windows ****
I purchased a Vonets VAP11G-300 (AC adapter sold separately).  You must disconnect your wireless network card before plugging this into your network card RJ45 socket.
Open up your browser and go to: http://vonets.cfg (http://vonets.cfg) U:admin P:admin (you can change this), and connect to your network with it.
Unplug it from your computer and connect the RJ45 Ethernet connector to the HP1660.  You can turn your wifi back on.
... or if you like running Ethernet cable through your house.  Plug a network cable in to the analyser and the other end in to your router.

Download MobaXterm here: https://mobaxterm.mobatek.net/download.html (https://mobaxterm.mobatek.net/download.html)
Install and run.
Hover over the X-Server button.  If it hasn't started, click the button.  It will display that the server is running using whatever IP Address.
(Current DISPLAY=XXX.XXX.XXX.XXX:0.0)

In the HP1660.  Go to System / External I/O / LAN Settings:
LAN Port: LAN TP  (or LAN BNC if you plugged in one of those, I guess)
Analyser IP Address: 192.168.0.100, (you can change this to whatever you wish)
Gateway IP Address: 192.168.0.1, (this is the IP address of your router.)
Timeout, etc... leave alone.
Click Done.

You can verify it's working by pinging to that IP address.
In a command shell, (Hit Windows-R, type cmd and hit Enter), type ping 192.168.0.100 (or whatever you set your Analyser IP Address to)
It should receive pings from the analyser without timing out.

In the HP1660.  Go to System / External I/O / X-Window Settings:
Remote Display Internet (IP) Address:  Enter the IP Address from hovered X-Server button (Current DISPLAY=XXX.XXX.XXX.XXX:0.0)
Set the Display and Screen to 0. (or possibly to whatever that was shown in the hovered button.  It will most likely be 0.0)
Click Done.

In the HP1660.  Go to System / External I/O / X-Window:
Click Connect
MobaXterm will notify you that the HP1660 wishes to connect to it.
Click Yes
You're in.  Enjoy.
You must click the Disconnect button on the analyser before shutting down app.

**** FTP to the HP1660 ****
Press Windows-R and type: cmd.  Hit Enter.
Type ftp.  A FTP prompt will appear.
Type open 192.168.0.100 (or whatever you set your Analyser IP Address to)
It'll ask for a username.  Type data
You're in.  Use ls, cd, get... etc.
When your done.  Type close then exit

...or you can use Filezilla...

Host: IP Address of analyser
Username: data (if you want to fetch data from analyser), control (if you want to upload programs to it).
You're in.

**** Add Fonts to MobaXTerm ****
You will have to convert the .bdf fonts to .pcf.  The best way is to do it through Linux since it has functionality just for doing that.
Look up 'Add Linux subsystem to Windows 10'.  This will NOT make your machine a duel boot system.
In a Linux shell, run these two commands:
bdftopcf lg165.bdf > lg165.pcf
bdftopcf sm165.bdf > sm165.pcf

Copy lg165.pcf & sm165.pcf to c:\<user>\My Documents\MobaXTerm\slash\usr\share\fonts\misc\
Add these two lines to the fonts.dir file located at c:\<user>\My Documents\MobaXTerm\slash\usr\share\fonts\misc\:
lg165.pcf -Misc-Fixed-Medium-R-Normal--15-150-75-75-M-100-ISO8859-1
sm165.pcf -Misc-Fixed-Medium-R-Normal--14-120-75-75-M-80-ISO8859-1

Add the number of entries on top of file list by 2
Add these two lines to fonts.alias located at c:\<user>\My Documents\MobaXTerm\slash\usr\share\fonts\misc\:
lg165.pcf -Misc-Fixed-Medium-R-Normal--15-150-75-75-M-100-ISO8859-1
sm165.pcf -Misc-Fixed-Medium-R-Normal--14-120-75-75-M-80-ISO8859-1


Restart MobaXTerm and connect the analyser.  Should run fine without errors.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: swingbyte1 on May 02, 2019, 01:29:05 pm
Hi - I'm going to hijack the thread a bit :P I have one of these without the LAN port and would like to know if anyone knows whats involved in adding the port in? Does anyone have even a picture of the board or how it connects to the main board? I'm just wondering if there is any chance it may be possible to add this capability.
Cheers
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: fenugrec on December 19, 2022, 04:19:11 am
Hi - I'm going to hijack the thread a bit :P I have one of these without the LAN port and would like to know if anyone knows whats involved in adding the port in?

I stumbled accross this thread looking for that very information, and found that this fellow https://www.jamiecraig.com/hp1661cs-ethernet-interface/ (https://www.jamiecraig.com/hp1661cs-ethernet-interface/) already figured all that out ! Haven't tested yet, but seems like a fairly straightforward mod.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: tverbeure on December 27, 2023, 07:03:42 pm
Adding to this thread because it always came up first during Google searches.

I tried many variant to make it work on Linux the usual way: xhost +, xauth, messing around with /usr/bin/Xorg and /etc/gdm3/custom.conf on my Ubuntu 20.04 system, but nothing worked. Eventually I got remote X server control running with the socat utility. Detailed write-up is here: https://tomverbeure.github.io/2023/12/26/Controlling-an-HP-1670G-with-Your-Linux-PC-X-Server.html.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: fenugrec on December 27, 2023, 07:24:09 pm
Nice writeup @tverbeure.
I posted one for the hardware details of adding the LAN option for a more permanent solution than just flying wires ( https://qcte.ca/testeq/hp1660/ ) , but I only tried FTP connections. It should provide a few NFS shares too, did you try those ?

Using the remote X connection has security implications, I think you touch on that a bit... I guess restricting the port access to the specific IP of the LA should be reasonably safe ?

Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: tverbeure on December 27, 2023, 07:58:12 pm
Quote
I posted one for the hardware details of adding the LAN option for a more permanent solution than just flying wires ( https://qcte.ca/testeq/hp1660/ ) , but I only tried FTP connections.

Very nice! I'm happy mine came with all ports ready to go.

Quote
It should provide a few NFS shares too, did you try those ?

I tried, but so far I didn't have any luck getting it to work. I also have issues with FTP. It works on my Windows machine and my Ubuntu 18.04 machine (which is a different boot partition on the same Windows machine), but it doesn't work on my main Linux machine (Ubuntu 20.4) or on my Debian 12 virtual machine that runs on a Macbook. I can log in successfully, but as soon as I do any transaction (e.g. just doing 'dir'), FTP hangs forever. Weird...

Quote
Using the remote X connection has security implications, I think you touch on that a bit... I guess restricting the port access to the specific IP of the LA should be reasonably safe ?

I'm not too worried about it. There's a firewall between the outside world and my machines.  But I've updated the blog post to use a stricter filtering rule:

sudo ufw allow from 192.168.1.200 proto tcp to any port 6111

instead of:

sudo ufw allow 6111

I guess it will make an attacker's job a little bit harder, but if they manage to get on my network anyway, I assume they'll also know how to spoof their IP address.  ;)

I also think that the socat command limits security issues, in the sense that I only run it when I need to use the logic analyzer. When not running, the standard xhost restrictions apply, and they're set to blocking everything, including not allowing TCP/IP connections.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: colorado.rob on December 27, 2023, 08:10:15 pm
Quote
I tried, but so far I didn't have any luck getting it to work. I also have issues with FTP. It works on my Windows machine and my Ubuntu 18.04 machine (which is a different boot partition on the same Windows machine), but it doesn't work on my main Linux machine (Ubuntu 20.4) or on my Debian 12 virtual machine that runs on a Macbook. I can log in successfully, but as soon as I do any transaction (e.g. just doing 'dir'), FTP hangs forever. Weird...
This is almost certainly a firewall issue on the client machine or on the router between the client machine and the instrument. FTP requires clients to allow access from the server unless explicitly using PASV (passive) mode. The hang you are seeing when the server needs to send data is a key hint that this is the problem. In your FTP application, send the "pasv" command before sending any other commands.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: tverbeure on December 27, 2023, 08:54:37 pm
This is almost certainly a firewall issue on the client machine or on the router between the client machine and the instrument. FTP requires clients to allow access from the server unless explicitly using PASV (passive) mode. The hang you are seeing when the server needs to send data is a key hint that this is the problem. In your FTP application, send the "pasv" command before sending any other commands.

That what I thought as well. I've tried the following:


When I issue the PASV command, it get:
ftp> quote pasv
502 PASV command not implemented.

Opening up port 20 and 21 didn't help either.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: fenugrec on December 27, 2023, 09:52:48 pm
I just checked my settings in Filezilla (I'm thanking myself for saving it as a preset...), I had to select "Active only" (as you found, PASV is not supported), and also limit the number of simultaneous connections to 1.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: tverbeure on December 28, 2023, 05:52:19 am
UFW is definitely blocking FTP traffic:

[120802.397548] [UFW BLOCK] IN=wlp5s0 OUT= MAC=78:2b:46:be:5d:f7:00:10:83:7b:93:95:08:00 SRC=192.168.1.200 DST=192.168.1.51 LEN=44 TOS=0x00 PREC=0x00 TTL=255 ID=1895 PROTO=TCP SPT=20 DPT=50021 WINDOW=0 RES=0x00 SYN URGP=0

192.168.1.200 (source port 20) is the logic analyzer, 192.168.1.51 (dest port 50021) is the PC. The problem is that you can't filter on source ports with UFW (and I really don't want to use iptables...)

I can make FTP work when I do:

sudo ufw allow from 192.168.1.200

Not ideal from a security point of view but better than nothing...
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: alm on December 28, 2023, 07:19:02 pm
With active mode FTP, the server will make a second TCP connection to the client with source port 20 and a random port >1024 on the client. This is really annoying for the firewall. Back when FTP was common, firewalls firewall software had specific support for FTP where they inspected the traffic and detected when the server would open a connection, and temporarily allow that specific connection. Looks like this solution/hack (https://forums.raspberrypi.com/viewtopic.php?t=274706#p1665013) might work with ufw. A workaround is allowing all incoming TCP connections to port > 1024 with source port 20, though that's not water tight.

Passive mode moves the misery from the client to the server.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: tverbeure on December 29, 2023, 03:34:48 pm
Somebody on hacker news mentioned nf_conntrack_ftp: it automatically opens up port 20 when it detects ftp transactions.

Chances are that Ubuntu 18.04 has something like this enabled by default but 20.04 doesn’t. I’ll give that a try.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: alm on December 29, 2023, 03:57:44 pm
For more recent kernel versions you need to add an iptables rule for nf_conntrack_ftp to work (https://serverfault.com/a/887335). The Raspberry Pi forum post I linked to earlier shows how to do this with ufw.
Title: Re: HP1660 Logic Analyser and communicating through X Windows setup.
Post by: tverbeure on December 29, 2023, 06:58:47 pm
For more recent kernel versions you need to add an iptables rule for nf_conntrack_ftp to work (https://serverfault.com/a/887335). The Raspberry Pi forum post I linked to earlier shows how to do this with ufw.
Thanks! I've updated the blog post mentioning these 2 possible solutions.