Fixing the August LP107T presentation pointer in Linux.

The problem

Before my first major conference as a PhD student I was looking for a cheap presentation pointer. After a little searching I bought the August LP107T because it’s cheap, has a built-in timer and claims full Linux compatability.

Unfortunately this last part isn’t quite true: kernel update 2.6.37 introduced support for the Yurex leg shake sensor which uses the same Vendor ID and Product ID as the pointer, overwriting the original driver.

There is an old bug report for this here but it still isn’t fixed as far as I can tell.

lp_107t_buttons.jpg New button maps for the LP107T (can be changed).

Kernel patching

In the bug report they mention that a kernel patch was merged into Linux v3.1-rc1 which must have been discontinued; the pointer doesn’t work out of the box on v3.8.0-25-generic that I’m running now.

Since I’m no Linux pro I don’t want to start compiling my own kernel but luckily there’s an alternative.

Building a userspace driver

After a few hours of research I found my alternative: a userspace driver for the pointer.

From my very limited understanding, a userspace driver is a regular program that interfaces with the operating system. By contrast a kernel driver involves fiddling with the inner-workings of the operating system and recompiling the kernel.

I used Wireshark to see the signals send by the device then libusb and ioctl to capture the USB signals and translate them to keyboard presses. Keyboard codes can be found by writing less /usr/include/linux/input.h in the terminal.

Interestingly the reset button changes the return values of all the buttons, meaning that you could use it to toggle between two different modes of functionality. I didn’t bother to do this for my implementation so if you press reset by accident then press it again to return to normal.

The finished product

I ended up with a fairly short piece of code that does three things.

  1. Take control of the USB device from Linux.
  2. Create a new virtual keyboard and map the pointer buttons to keyboard presses.
  3. Listen for a button press and send the appropriate keyboard signal.

You can find the source code in a zip file here.

Using the driver

To compile the driver you first need to get libusb, open a terminal and type

sudo apt-get install libusb-1.0.0-dev.

When this is complete you can compile the source code with

g++ -o august_lp107t_driver.o august_lp107t_driver.cpp `pkg-config --libs libusb-1.0`.

Finally plug in the device and run the compiled code

sudo ./august_lp107t_driver.o.

Once it has finished setting up the virtual keyboard you should see the message Keybaord setup complete, listening for action… after which you can start using the remote.

lp_107t_usage.jpg Successfully using the new LP107T driver.

If the device is unused for 5 minutes then the driver automatically releases the USB device, this can be changed on line 224 of the source code to any length of time. To stop the driver earlier than this simply press Ctrl+C whilst it is running. Doing this won’t release the device properly so you need to remove the USB key and plug it back in before restarting the driver if you want to use the remote again.

Licensing

The source code is released under a slightly modified BSD license, meaning that you can do whatever you want with it.

Let me know what you think in the comments below!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s