usbhotkey
Remap USB keyboards under X11
Home
Programming

Why not on MS Windows?

A port of usbhotkey to MS Windows is possible, but a lot of work. The following paragraphs summarise my research into this.

There are three options to get USB HID events into your software: libusb-win32, the native HID API, and the Autohotkey code. The following sections investigate pros and cons of each of these options.

Option 1: libusb-win32

libusb-win32 is a port of libusb to MS Windows. Once installed, one can use libhid just like under Linux or BSD. This would be the simplest solution regarding the programming effort.

However, it requires the end user to install an untrusted device driver. Working for an IT-wise very conservative company I know this is a killer criterion for a lot of user, including myself: I couldn't use my own tool at work.

Option 2: native HID API

Windows comes with an HID API that is rather simple to use: Events can be read from a file. Getting the name of this file and various information about it is accomplished by functions in hid.dll, which is part of each Windows installation. This way it is the simplest solution for developer and user.

The header files for these functions are part of the Windows Driver Kit (WDK), the successor to the Driver Development Kit. Download of the WDK requires a Windows Live ID (registration required) and separate registration for the download. I'm simply not willing to jump through these hoops to get one header file.

Volunteers, please email.

Option 3: copy from Autohotkey

Autohotkey catches regular Windows events and allows to generate new events from them. As Autohotkey is Open Source, I read the relevant portions. The code itself is an example on how to comment software. You could read just the comments and still know what's going on.

What would be accomplished by using usbhotkey's ruby interface with Autohotkey's event interface? Autohotkey with ruby instead of its own programming language. It is not worth the work required, because one usually writes one script. If you want the same layout on Linux and Windows, you have to write two. That's what I will do.

Contact


Get usbhotkey at SourceForge.net. Fast, secure and Free Open Source software downloads