Unifying Logitech Devices on Linux

I was recently given a Logitech K800 keyboard and a Logitech Performance Mouse MX, both of which are great devices. I picked them because wireless-ness is useful for ergonomic reasons, and they have rechargeable batteries, and you can attach them both to the same USB input, so you have fewer cables lying around.

Naturally, though, when I unboxed them I found out that you can only unify them to the same receiver with Windows-only software. There are a number of other features that are only usable with the Windows-only software, but I figured there would be a hardware sync process. Unfortunately, there's not a Logitech supported one.

There is, however, a community developed one! There's a short C program with a bunch of magic numbers which send commands to the device and cause it to unify with a new device. Unfortunately, the program comes with no directions, so I thought I'd post about how to do it. First, put the program in pairing_tool.c, as suggested in the post. Then, compile it with:

gcc -o pairing_tool pairing_tool.c

To run it, we need to figure out where the Logitech unifying receiver is. The program wants the hidraw device corresponding to the unifying receiver. To find this out, you can look in /sys/class/hidraw/hidraw*/device/uevent. In my case, the device is hidraw2, and the output looks like this:

smitten:~$ cat /sys/class/hidraw/hidraw2/device/uevent 
DRIVER=generic-usb
HID_ID=0003:0000046D:0000C52B
HID_NAME=Logitech USB Receiver
HID_PHYS=usb-0000:00:1a.0-1.4/input2
HID_UNIQ=
MODALIAS=hid:b0003v0000046Dp0000C52B

So, we can now unify the devices with the following command:

sudo ./pairing_tool /dev/hidraw2

And then power on your device as the tool tells you to. I think there's some timeout on this, because the first time I did it I waited a few minutes and then powered on the device, and it didn't work. So, have your device ready and do it seconds after you run the pairing tool, and it should all work fine. HTH!

reverbel @ 2012-05-12 16:23:15:

Worked like a charm on Ubuntu 12.04! Thank you!

al @ 2012-05-09 03:55:47:

posted your solution to the boards at Logitech http://forums.logitech.com/t5/Mice-and-Pointing-Devices/Unifying-and-linux/m-p/831753#M39963 adios, @

Mark @ 2012-05-02 10:49:50:

Thank you!

Mantrid @ 2012-05-02 00:03:36:

Works with openSUSE 12.1

pink-panther @ 2012-04-29 10:25:52:

Thank you, it worked on Ubuntu 11.10.

tycho @ 2012-04-28 21:01:47:

Hmm, it worked just fine for me on 11.10, so I'm not sure what to tell you. How did it fail?

neversetsun @ 2012-04-26 16:19:19:

I tried to connect 2 M215 to the same unifying receiver using this userspace tool with 3.0.0-17 of ubuntu 11.10. But I failed. The kernel shipped with 11.10 doesn't have hid-logitech-dj.c, is this driver also needed?

Peter @ 2012-04-18 04:19:21:

I just tried these instructions (on Ubuntu 10.04), and got the following error message: Error: 32 write: Broken pipe Any thoughts on why this is?

clach04 @ 2012-04-15 19:17:59:

I've collected a few tools for doing this at https://bitbucket.org/clach04/logitech-unifying-receiver-tools it includes the C one used above as well as a portable python version that should work on a Mac with PyUSB and libusb.

primos @ 2012-04-15 01:34:04:

Brilliant!!! Linux Mint 12 and about 1 min worth of my time :) and Logitech cannot do this because?????? Thanks for instructions!!

Gary Heard @ 2012-03-14 11:41:27:

Thank you for clear concise instructions. Worked brilliantly

from_finland @ 2012-02-28 17:58:31:

Thanks for the tip and software. Worked for me with first try running the software without even restarting keyboard many times. ansi-c compiled without any problems with gcc x86_64 as it should.

Aaron Lippold @ 2012-02-28 01:25:23:

Kudos to you! Thanks for writing up a great little howto. I was about to embark on this myself after finding a link to the program on the linux.kernel list on Google but then saw your page a few results down. I guess a little gui would be the next thing. Maybe I can see about working that. A

demon @ 2012-01-31 22:41:37:

@ding: Looks like the patch at the start of the thread has to do with allowing individual keyboards and mice attached via a Unifying receiver to appear to the kernel as separate HID devices. Looks like this utility should work without it, just multiple devices' events would show up via the same mouse/keyboard device node. (I wanted to get a Performance MX mouse, but I was hoping to get the Bluetooth version; looks like that isn't gonna happen, but this means that I can at least use the "Unifying" receiver as intended.)

Tehas @ 2012-01-28 02:18:29:

I didn't have luck looking through the uevent files. Instead, I went through the output from 'dmesg'. I plugged in the USB receiver and then ran dmesg | less. The last set of messages in the output indicated that I needed to use /dev/hidraw2. Thanks for documenting this.

Pavel @ 2012-01-25 20:06:07:

Thanks man. Really helped me out. In my case I was not able to find hiddraw device so I run the tool on all of them. Last one worked.

tycho @ 2012-01-12 21:48:31:

Nope, it doesn't (at least, not on my xubuntu kernel); I'd say the patch was already accepted. Just run the pairing tool and you're good to go.

ding @ 2011-12-30 10:06:42:

That's cool! So, this doesn't require any kernel patches for the extra mouse buttons? The mailing list thread you've linked to contains kernel patches in the first thread.