[Home]EMCDisplayOnWindows

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Background notes: this method is based on the X Window System (aka X11 or simply X) client/server model. The language of X11 is somewhat counterintuitive. The X11 client runs on the remote machine (the host running EMC in our case) and the X11 server runs on the local machine (the host running Microsoft Windows in our case). This method also depends on secure shell (SSH) technology for secure communications. The language of SSH is more intuitive. The SSH server (sshd) runs on the remote machine and the SSH client runs on the local machine.

Note: Although there are a few points in the following that are specific to Microsoft Windows, this method will work with any local machine possessing an X11 server and an SSH client, notably, an Apple Macintosh running OS/X.

Note: Several of the commands used here allow the use of either a numeric IP address or a symbolic hostname. Using the IP address is guaranteed to work. Using the symbolic name requires the presence of either an appropriately configured DNS server or an appropriate /etc/hosts file.

Step 1: install the necessary client and server programs

1a. install an X11 server on the local machine - I used Cygwin-X. Other choices such as the Hummingbird X11 server and X-Win32 work fine too.

For Cygwin-X, follow the directions at http://x.cygwin.org/

1b. make sure sshd is installed on the remote (EMC) machine

If it isn't, type apt-get install ssh if you're running a BDI installation. Otherwise use your system's package manager.

Note that, in most distributions, SSH generally comes with both client and server in the same package. Note also that the package may called OpenSSH for the obvious reason.

Step 2: test the SSH connection using an SSH client on your local machine. This could be a 3rd-party Microsoft Windows application such as PuTTY or Tera Term Pro with the TTSSH plugin. If you've installed the full cygwin environment, then from a cygwin prompt, type ssh -l your_emc_user_name {IP_address / hostname of EMC machine}. In any case, say yes when asked if you want to add the server's key to your known_hosts file. Enter your emc_user_password at the Password: prompt and you should find yourself looking at the command prompt as if you were sitting at the console of the remote machine.

If this works, then go on, otherwise fix the problem (sorry, can't be of much help here - see an ssh help page, use Google, etc. If you're running a firewall on either or both machines then don't forget to set each firewall to allow traffic from the other host.)

Step 3: Start the X11 Server on the local machine. The Cygwin folks have thoughtfully provided a Microsoft Windows batch file startxwin.bat (look in the cygwin subdirectory ./usr/X11R6/bin). You can invoke this batch file in any of the usual ways to start the server. Alternatively. you can invoke startx or do other X11-ish things from within the cygwin environment.

This should eventually result in an xterm being opened on your local machine (if you haven't changed the default configuration of Cygwin-X, that is). If not, then open a new xterm using whatever command is appropriate for your local machine.

Note: This next xhost command has proved to be necessary in tests with the BDI-4.30 installation running on the remote machine. It has proved not to be necessary in tests with Red Hat Enterprise Linux running on the remote machine. Both machines were running OpenSSH. Go figure.

From the xterm, type xhost +{IP_address / hostname of remote EMC machine}

Then, from the xterm, connect to the remote EMC machine using the following command: ssh -X -l your_emc_user_name {IP_address / hostname of remote EMC machine}

The -X option tells ssh to forward X11 packets from the remote machine.

Note: In some installations, using the -Y option instead of the -X option may be necessary, but try -X first.

Note: This next command to set the DISPLAY environment variable on the remote machine has proved to be necessary in tests with the BDI-4.30 installation running on the remote machine. It has proved not to be necessary in tests with Red Hat Enterprise Linux running on the remote machine. Both machines were running OpenSSH. Go figure.

From your new ssh shell (within the xterm), set the DISPLAY environment variable so that any programs you run on the remote EMC machine know where to send their display data:

export DISPLAY={IP_address / hostname of local machine}:0.0

Note: This is actually two shell commands combined; the syntax varies according to the command shell you're using on the remote machine.

Note: Neglecting to set the displaynumber according to the configuration of your local X11 server (in this case, the :0.0) can lead to the mysterious failure "Error: Can't open display: IP.OF.WIN.MACHINE" when you subsequently try to invoke a remote X-client process.

Now, you can run programs just as though you were at a terminal on the remote (EMC) machine.

Try it. For example, run kate:

kate &

After a small pause, a KDE Editor window should open on your local machine.

For a little fun, invoke xeyes on the remote machine and watch the graphics on your local machine track your mouse cursor around the desktop.

EMC can now be run on the remote machine with the EMC display continuously updating on your local machine:

cd /usr/local/emc && ./generic.run &

All done! wasn't that easy?

Final note: Please excuse the pedantic nature of the editorial changes. They stem from watching generations of X-newbies suffer through their first attempt to interconnect two machines.


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited December 9, 2005 5:37 am by Kreed (diff)
Search:
Published under a Creative Commons License