Linux Fu: X Command

Text-based Linux and Unix systems are easy to manipulate. The way the Unix I/O system works you can always fake keyboard input to another program and intercept its output. The whole system is made to work that way. Graphical X11 programs are another matter, though. Is there a way to control X11 programs like you control text programs? The answer to that question depends on exactly what you want to do, but the general answer is yes.

As usual for Linux and Unix, though, there are many ways to get to that answer. If you really want fine-grained control over programs, some programs offer control via a special mechanism known as D-Bus. This allows programs to expose data and methods that other programs can use. In a perfect world your target program will use D-Bus but that is now always the case. So today we’ll look more for control of arbitrary programs.

There are several programs that can control X windows in some way or another. There’s a tool called xdo that you don’t hear much about. More common is xdotool and I’ll show you an example of that. Also, wmctrl can perform some similar functions. There’s also autokey which is a subset of the popular Windows program AutoHotKey.

Continue reading “Linux Fu: X Command”

Linux Graphics Programming

There was a time when embedded system developers didn’t need to worry about graphics. When you have a PIC processor and two-line LCD, there isn’t much to learn. But if you are deploying Linux-based systems today, graphics are a real possibility. There are many options for doing Linux graphics including Wayland, X11, and frame buffers. Confused? This tutorial can help. The sections on Wayland and Mir are under construction, but that’s probably not what you are going to be using on a typical hacker project for the foreseeable future, anyway.

Of course, even inside those broad categories, you have multiple choices. If you are doing X11, for example, you can go low-level or pick any of a number of high-level libraries.

Continue reading “Linux Graphics Programming”

Complete IR Control

What can you do with an IR remote? How about anything? Maybe not. We’ll settle for issuing arbitrary commands and controlling tasks on our computer.

The first step in [Fungus]’s hack is straightforward: buy an IR receiver for a buck, plug it into an Arduino, and load up some IR-decoding code. If you haven’t done this before, you owe it to yourself to take some time now. Old IR remotes are very useful, and dead simple, to integrate into your projects.

But here comes the computer-control part. Rather than interpret the codes on the Arduino, the micro just sends them across the USB serial to a laptop. A relatively straightforward X11 program on the (Linux) computer listens for codes and does essentially anything a user with a mouse and keyboard could — that is to say, anything. Press keys, run programs, open webpages, anything. This is great for use with a laptop or desktop, but it’d also be a natural for an embedded Raspberry Pi setup as well.

Hacking the code to do your particular biddings is a simple exercise in monkey-patching. It’s like a minimal, hacked-together, USB version of LIRC, and we like it.

Thanks [CoolerVoid] for the tip!

Logic Analyzers And X11

logic

[Andrew] recently scored an awesome HP 1670A Deep Memory Logic Analyzer, lucky dog. Even though this machine was built in 1992, it was a top of the line device back in the day and had a few very interesting features. This logic analyzer also had a few networking ports implementing FTP, NFS, TCP/IP, and the X11 protocols over a 10Base2 (“thinlan”) and 10BaseT (“ethertwist” seriously, that’s what’s in the manual) connections. The X11 protocol interested [Andrew] so he set this logic analyzer up so he could use it via his Linux box.

X Windows is simply a way to display GUI interfaces over a network. While today we usually only see X Windows apps confined to the desktop, in the bad old days of *NIXes you had to pay for, running a GUI app over a network was considered the wave of the future. The Internet replaced this idea with a palimpsest of JavaScript, but we digress…

[Andrew]’s new toy didn’t support DHCP, so after inputting the IP address manually, he checked the host file – still the same after twenty years – and connected with his Linux Mint box. The result is a remote control panel for the ‘ol girl in a garish color scheme that violates all modern sensibilities.

Nexus one gets Linux

Considering how hackable the Nexus One is already, we can only imagine a whole new host of interesting things thanks to Ubuntu running on the device. [Max Lee] set his heart out on getting not just Ubuntu on the Nexus One, but also Debian, and he wrote a perfect install guide to help out those wanting to give it a shot.

He cheated a little bit by having Ubuntu run in the background while the X11 interface is simply VNCed, but he still did an awesome job with plenty of pictures and details to help you achieve Ubuntu on your Nexus One.

X11 on Android

x11

[ghostwalker] has put together instructions for running X11 on your Android device. This means you can run a full-blown Linux desktop environment on your phone. It requires you to already have a Debian shell on the phone, which we covered earlier. Instead of having to come up with a custom display driver, it’s hooked to a VNC server. You can connect to it using an Android VNC viewer on the phone or via any other VNC client. The how-to suggests either IceWM or the even lighter-weight LXDE for a window manager. You could potentially install Gnome or KDE, but we’d be surprised if it was any faster than dog slow. Let us know if you have any success with this and what you think the best use is.