Channels ▼

Al Williams

Dr. Dobb's Bloggers

Remotely Possible

July 02, 2012

Back in April, our sage editor Andrew Binstock wrote about how he was running Microsoft's Visual Studio on his tablet. I have to confess that while I used to use Visual Studio for many hours each day, my recent work has been on small computers with correspondingly smaller tools. I do, however, enjoy being mobile with my tablet (and, since I am not one of the Apple faithful, it is an Android tablet).

I've recently been deploying some Linux embedded software on servers. I suspect this is a pretty common scenario — you want to sense or control something inside a data center and you simply hitch a ride on a server's Linux operating system.

The problem with these servers is they often don't have the familiar graphical front end software available. I've mentioned before that I still hang out on a command line more often than not, so simply doing an ssh into a remote box doesn't bother me. My windowing system of choice might as well be emacs or screen (or, actually, byoby instead of screen). As much as I always think the GUI is just a craze, even I don't want to go back to debugging or word processing at the text level, so sometimes even I want a GUI on my system.

For that matter, sometimes I want to do some development that requires a serial port or a USB-connected device on my desktop, but I'd like to work from the tablet from some remote location. My initial attempts at doing this have been frustrating because I run two large monitors with all the fancy window effects (if I'm going to have a windowing environment, it's going to look good, after all).

Turns out the answer to both problems is the same: virtualization. There are several ways to create virtual Linux machines inside real Linux machines. In my case, I used VirtualBox (for a variety of reasons). With a virtual machine created, I loaded a new operating system. For my desktop, I loaded a recent version of Kubuntu, but on the embedded servers I loaded one of the small Linux distributions that you often see put on a USB drive or a CDROM.

In either case, I stripped down the video features as much as possible. No fancy 3D effects or even wallpaper. I also had VirtualBox map the host operating system's filesystem (or, at least, an interesting part of it) into the guest operating system.

The tricky part is making the virtual machine start at about the same resolution as your tablet. Actually, you want it a bit smaller. Exactly how you do this depends on the virtualization software you are using, but for VirtualBox you can define a custom screen size with the following command:

VBoxManage setextradata "TabletBack" "CustomVideoMode1" "1200x900x16"

Obviously, you need to set the right VM name and the screen resolution you want. Then you need to boot the virtual operating system and set that same mode in the xorg.conf file. If you get it all right, then starting the virtual computer will result in a screen with the requested dimensions.

Of course, on the servers I didn't have a way to directly start the virtual machine. VirtualBox allows you to start a machine "headless":

vboxheadless -startvm TabletBack

This causes the machine's screen and keyboard to redirect to a remote desktop server on a port you specify in the machine's configuration. You can use any remote desktop software. Some software like krdc insists you have a user ID and password for your connections. If you have this situation, you need to set that option in VirtualBox with a line similar to this one:

vboxmanage setproperty vrdeauthlibrary "VBoxAuth"

You can also set up VirtualBox to give the virtual machine access to serial ports and USB ports. This is key if you expect to talk to I/O devices or, in the case of the desktop, development programmers or debuggers.

Now all that's left is to get access to the machine. From a network point of view, you might have to punch a hole in your server's firewalls (both local and to the public Internet). You also need some sort of remote viewer for your tablet. I tried a few and settled on the 2X client RDP available in the market (see Figure 1). It works well enough and is free. Remember, the virtual machine's screen is sized small and has limited video features, so performance is good compared to what you might have noticed if you tried a similar product on your full desktop.

Figure 1

If I am just remote accessing my development station, I find TeamViewer to work well (see Figure 2). It has support for almost everything, including Android tablets, and can even connect you via a web browser. I find it easier to use than the RDP clients with a few notable exceptions.

Figure 2

First, TeamViewer (on Linux) runs under Wine. So it isn't going to run on my servers, which don't have all the support to have GUI software running under Wine. Second, as a general solution, the Linux host and Android client still have a few bugs. For example, switching to a second monitor switches the display, but not the mouse (which stays on the primary monitor). Although that makes it virtually (no pun intended) unusable for my normal desktop, it isn't a problem for my stripped down virtual Linux box. That stripped down box, however, has access to my files and my devices.

Both of the viewers take a little getting used to. You can't just touch the screen the way you would for a native application (the 2X viewer has multiple mouse options, in fact). You move the mouse cursor using your finger as though the screen were a touchpad and then tap it to click. Each program has unique ways to handle scaling, scrolling, right clicks, and the like. I also noticed that TeamViewer didn't get along well with the Swype keyboard, so be prepared to experiment with different options.

My tablet can now log into a virtual machine, fire up an IDE or a debugger, and get real work done on my embedded systems. Adding a Bluetooth keyboard and mouse makes it even easier to get some real work done in, say, a hotel room.

I deliberately didn't write these as step-by-step instructions because it will vary based on your tablet device, your specific situation, and your personal preferences. The key idea is to stand up a virtual machine just for giving your tablet access to the files, tools, and devices you need. If you use the remote desktop access your server doesn't need a powerful graphics card or any real operator input/output devices.

I plan to work on my next embedded system exclusively from the beach!

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.