Pairing Logitech Unifying Devices on GNU/Linux

A few weeks ago I bought new mouse and keyboard. Having limited USBs available, I preferred Logitech's new 'Unifying' ones. This unifying feature enables you to use more than one devices by pairing them with a single receiver.

After unboxing my new gear, I navigated to Logitech's web page to get information about unifying procedure. Logitech provides a small utility for pairing unifying devices, nice. However, in the list of available operating systems there is no GNU/Linux. It would be nice if Logitech provided required utility for Linux as well, however, being a part of GNU/Linux community is nicer, eh?

An awesome guy named Benjamin Tissoires written a small C program (licensed with GPL predictably) that enables pairing Logitech unifying devices with receiver and shared it on linux.kernel mailing list*. Isn't it great?

Here is the code:

Since WordPress messes with the code, I uploaded it as raw file. Click here to download it.

Assuming you have saved the file with name unifying_pair.c, you can build using command

$ gcc -o unifying_pair unifying_pair.c

One more thing you need to know before pairing is the location of your device under /dev/. In my case it was /dev/hidraw2 (actually i couldn't manage to find the difference between hidraw0, hidraw1 and hidraw2 but i just tried them all).

Then become root (or use sudo, doesn't matter),

# ./unifying_pair /dev/hidraw2

and turn your device on when the application tell you to do so, and you're done.

That's all folks! :)