I’ve recently bought a PnF DUO Tigital Tablet Pen. Basically it’s a pen and a sensor which use ultrasonics to turn your screen into a touch screen. PnF provides supporting software for Mac and Windows, but not for Linux. In this article I discuss the pros and cons of using this product with Ubuntu, based on my own fiddling.
Does it Work?
The short answer: yes, with a little bit of set-up
The slightly longer answer:
- The DUO Pen sensor is a USB Human Interface Device. It behaves like an external tablet device, so it will work as a pointing device out of the box. Be warned, it will be initially uncalibrated, so the position of the pointer will not match where you’re actually holding the pen.
- The DUO Pen provides another USB endpoint (endpoint 3) which the Windows support software uses to send calibration details to the device. I haven’t decoded the exact signals sent to this endpoint, but basically, when you use this device on Windows, the sensor itself remembers the calibration details. This means that you may need to perform a calibration using Windows / Mac OS before you use it in Ubuntu.
- I couldn’t get the right-click functionality to work under Ubuntu. In Ubuntu, pressing the right-click button behaved exactly the same as left-clicking. Under Windows, right-clicking worked fine. I didn’t spend the time to figure out why.
Calibrating the DUO Pen
While playing around with my DUO Pen, I came across xinput_calibrator, which provides software calibration for touchscreen devices. It’s packaged for Debian/Ubuntu and source code is also provided. I built it from source and I found it refreshingly easy to build.
To use xinput_calibrator, first list all the pointing devices connected to the system:
$ ./xinput_calibrator --list
Then run xinput_calibrator with the device you wish to calibrate, selected from the list.
$ ./xinput_calibrator --device "HID 1b28:4617"
The thing to be careful of here is this: if the hardware calibration of the DUO Pen is such that your pointer can never reach the edges of your screen, no amount of software calibration will solve your problem. You’ll need to change the hardware calibration either by using a Windows / Mac computer, or by writing a driver for calibrating the device.
Using the Windows Support Software
I’ve only done the calibration on Windows, so I can’t comment on what it’s like on a Mac.
If your computer is set up to dual boot, I imagine that you could attach the sensor to your screen, boot to Windows, calibrate the device, then boot to Linux and everything would work just fine. In my case, I calibrated my Ubuntu desktop computer using my Windows-booted laptop. I attached the sensor to my desktop monitor but plugged it into my laptop. Then after launching the calibration program, I measured (with a ruler) the positions of the points where it asked me to touch. I scaled these to the size of my desktop screen, and created a graphic in Inkscape to help me to press the right points. After calibrating in this way, I still had to use xinput_calibrator on Ubuntu to get the calibration right.
A word of warning about the hardware calibration: if your sensor is very close to but not quite parallel to the side of the screen, it’s possible for there to be some points on the screen which the sensor can’t unambiguously triangulate the position of. If you use the Windows software to calibrate the device for a configuration like this, the pen will stop working as a pointing device. If this happens, simply adjust the position of the sensor (move it a bit further from the screen and straighten it if possible), and perform the calibration again and it will start working.
Cracking the Code
If any of you are adventurous enough, you could write calibration software for Linux. Or you might just want to record the messages which your particular calibration sends to the device so you can replay them to the device from within Linux. In either case, you’ll need visibility of the communication between the Windows driver and the USB device.
The resource I found most useful in this regard was an article by Jesper Thomschütz (Jespersaur) on reverse engineering the Windows USB driver for the Luxeed LED keyboard. This article was particularly relevant because the DUO Pen is a Human Interface Device so, like the Luxeed LED keyboard, using a Windows virtual machine and intercepting its packets in Linux will probably not work (I didn’t actually try it).
In his article, Jesper said that he couldn’t get any useful data using USBSnoop, but SnoopyPro worked for him. I had the opposite experience. I couldn’t get SnoopyPro working, but USBSnoop worked quite well, though things did not quite work the way that the howto document described. My notes:
- My DUO Pen had a vendor id of 0x1b28 and a product id of 0x4617. So in USBSnoop, it appears as “
- I found that after first running the software, selecting the device and clicking “Install”, I had to restart the computer before the capturing would work.
- The howto describes having to click “Install” and “Replug” every time you plug the device in, and “Uninstall” and “Replug” after unplugging it. I found I simply had to physically unplug the device, delete the log file, and physically replug it.
The howto document for USBSnoop also contains instructions on replaying in Linux USB data which was captured in Windows. I haven’t attempted this part of the howto myself.
The PnF DUO Digital Tablet Pen works ok under Ubuntu, but you may need a Windows or Mac computer to perform the initial calibration.