Difference between revisions of "Logitech Unifying Receiver"

From ArchWiki
Jump to: navigation, search
m (safer typo-resistant add-to-group command)
m (OS X is now called macOS)
 
(11 intermediate revisions by 9 users not shown)
Line 3: Line 3:
 
The [http://www.logitech.com/349/6072 Logitech Unifying Receiver] is a wireless receiver that can connect up to six compatible wireless mice and keyboards to your computer.
 
The [http://www.logitech.com/349/6072 Logitech Unifying Receiver] is a wireless receiver that can connect up to six compatible wireless mice and keyboards to your computer.
 
The input device that comes with the receiver is already paired with it and should work out of the box through plug and play.
 
The input device that comes with the receiver is already paired with it and should work out of the box through plug and play.
Logitech officially supports pairing of additional devices just through their Windows software.
+
Logitech officially supports pairing of additional devices just through their Windows and macOS software.
 
Pairing on Linux is supported by [https://lkml.org/lkml/2011/9/22/367 a small program from Benjamin Tissoires]. That tool does not provide any feedback though. Other developers have built more complete pairing tools that give feedback and allow unpairing as well.
 
Pairing on Linux is supported by [https://lkml.org/lkml/2011/9/22/367 a small program from Benjamin Tissoires]. That tool does not provide any feedback though. Other developers have built more complete pairing tools that give feedback and allow unpairing as well.
  
 
[https://lekensteyn.nl/logitech-unifying.html ltunify] is a command-line C program that can perform pairing, unpairing and listing of devices. [http://pwr.github.io/Solaar/ Solaar] is a graphical Python program that integrates in your system tray and allows you to configure additional features of your input device such as swapping the functionality of Fn keys.
 
[https://lekensteyn.nl/logitech-unifying.html ltunify] is a command-line C program that can perform pairing, unpairing and listing of devices. [http://pwr.github.io/Solaar/ Solaar] is a graphical Python program that integrates in your system tray and allows you to configure additional features of your input device such as swapping the functionality of Fn keys.
  
==Installation==
+
== Installation ==
  
===From AUR===
+
Benjamin's program can directly be installed from AUR: {{AUR|pairing_tool}}.
  
Benjamin's program can directly be installed from AUR: [https://aur.archlinux.org/packages.php?ID=58261 pairingtool].
+
Solaar is also available from the AUR: {{AUR|solaar}}. At installation the Solaar package is creating the group plugdev. After installation add you user to the plugdev group ({{ic|# gpasswd -a $USER plugdev}}) to use Solaar as non-root user.
  
Solaar is also available from the AUR: [https://aur.archlinux.org/packages/solaar/ solaar]. At installation the Solaar package is creating the group plugdev. After installation add you user to the plugdev group ({{ic|gpasswd -a $USER plugdev}}) to use Solaar as non-root user.
+
ltunify is now also available from the AUR: {{AUR|ltunify-git}}. Create the plugdev group before installation and add yourself to it (to avoid the need of running ltunify as root). After installation, you can edit the file {{ic|/etc/udev/rules.d/42-logitech-unify-permissions.rules}} to change the device group (the default group is plugdev).
  
ltunify is now also available from the AUR: [https://aur.archlinux.org/packages/ltunify-git/ ltunify-git]. Create the plugdev group before installation and add yourself to it (to avoid the need of running ltunify as root). After installation, you can edit the file /etc/udev/rules.d/42-logitech-unify-permissions.rules to change the device group (the default group is plugdev).
+
== Usage ==
  
===ltunify (manual)===
+
pairingtool can only be used for pairing and does not provide feedback, it also needs to know the device name for pairing. ltunify and Solaar can detect the receiver automatically.
There is now an AUR package available : [https://aur.archlinux.org/packages/ltunify-git/ ltunify-git]. You can either install it directly or build it manually :
+
 
+
{{bc|
+
# pacman -S gcc
+
$ git clone https://git.lekensteyn.nl/ltunify.git && cd ltunify
+
$ make ltunify
+
$ make install-home
+
}}
+
The last step will copy the ltunify program to {{ic|$HOME/bin/ltunify}}. You can skip that step and install it to {{ic|/usr/local/bin}} if you prefer that.
+
 
+
To avoid running the program as root, copy udev/42-logitech-unify-permissions.rules to {{ic|/etc/udev/rules.d/}} and adjust the group inside the file if necessary.
+
 
+
===pairingtool (manual)===
+
 
+
If you want, you can also compile the source-code manually.
+
 
+
At first make sure that a C compiler is installed on your system:
+
# pacman -S gcc
+
 
+
Afterwards copy and paste the following code to a local file, for example ''pairing_tool.c'':
+
 
+
/*
+
* Copyright 2011 Benjamin Tissoires
+
*
+
* This program is free software: you can redistribute it and/or modify
+
* it under the terms of the GNU General Public License as published by
+
* the Free Software Foundation, either version 3 of the License, or
+
* (at your option) any later version.
+
*
+
* This program is distributed in the hope that it will be useful,
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+
* GNU General Public License for more details.
+
*
+
* You should have received a copy of the GNU General Public License
+
* along with this program.  If not, see .
+
*/
+
+
#include <linux/input.h>
+
#include <linux/hidraw.h>
+
#include <sys/ioctl.h>
+
#include <fcntl.h>
+
#include <unistd.h>
+
#include <stdio.h>
+
#include <errno.h>
+
+
#define USB_VENDOR_ID_LOGITECH                  (__u32)0x046d
+
#define USB_DEVICE_ID_UNIFYING_RECEIVER        (__s16)0xc52b
+
#define USB_DEVICE_ID_UNIFYING_RECEIVER_2      (__s16)0xc532
+
+
int main(int argc, char **argv)
+
{
+
        int fd;
+
        int res;
+
        struct hidraw_devinfo info;
+
        char magic_sequence[] = {0x10, 0xFF, 0x80, 0xB2, 0x01, 0x00, 0x00};
+
+
        if (argc == 1) {
+
                errno = EINVAL;
+
                perror("No hidraw device given");
+
                return 1;
+
        }
+
+
        /* Open the Device with non-blocking reads. */
+
        fd = open(argv[1], O_RDWR|O_NONBLOCK);
+
+
        if (fd < 0) {
+
                perror("Unable to open device");
+
                return 1;
+
        }
+
+
        /* Get Raw Info */
+
        res = ioctl(fd, HIDIOCGRAWINFO, &info);
+
        if (res < 0) {
+
                perror("error while getting info from device");
+
        } else {
+
                if (info.bustype != BUS_USB ||
+
                    info.vendor != USB_VENDOR_ID_LOGITECH ||
+
                    (info.product != USB_DEVICE_ID_UNIFYING_RECEIVER &&
+
                    info.product != USB_DEVICE_ID_UNIFYING_RECEIVER_2)) {
+
                        errno = EPERM;
+
                        perror("The given device is not a Logitech "
+
                                "Unifying Receiver");
+
                        return 1;
+
                }
+
        }
+
+
        /* Send the magic sequence to the Device */
+
        res = write(fd, magic_sequence, sizeof(magic_sequence));
+
        if (res < 0) {
+
                printf("Error: %d\n", errno);
+
                perror("write");
+
        } else if (res == sizeof(magic_sequence)) {
+
                printf("The receiver is ready to pair a new device.\n"
+
                "Switch your device on to pair it.\n");
+
        } else {
+
                errno = ENOMEM;
+
                printf("write: %d were written instead of %ld.\n", res,
+
                        sizeof(magic_sequence));
+
                perror("write");
+
        }
+
        close(fd);
+
        return 0;
+
}
+
  
Afterwards the code has to be compiled into the executable file ''pairing_tool'':
+
=== ltunify ===
$ gcc -o pairing_tool pairing_tool.c
+
 
+
==Usage==
+
pairingtool can only be used for pairing and does not provide feedback, it also needs to know the device name for pairing. ltunify and Solaar can detect the receiver automatically.
+
  
===ltunify===
 
 
Examples on unpairing a device, pairing a new device and showing a list of all devices:
 
Examples on unpairing a device, pairing a new device and showing a list of all devices:
  
Line 143: Line 34:
 
  idx=1  Mouse  M525
 
  idx=1  Mouse  M525
  
===Solaar===
+
=== Solaar ===
 +
 
 
Solaar has a GUI and CLI. Example CLI pairing session:
 
Solaar has a GUI and CLI. Example CLI pairing session:
  
Line 153: Line 45:
 
  $ solaar-cli show
 
  $ solaar-cli show
 
  -: Unifying Receiver [/dev/hidraw0:08D89AA6] with 1 devices
 
  -: Unifying Receiver [/dev/hidraw0:08D89AA6] with 1 devices
  1: Wireless Mouse M525 [M525:DAFA335E]  
+
  1: Wireless Mouse M525 [M525:DAFA335E]
 +
 
 +
To disable autostart of Solaar, remove {{ic|/etc/xdg/autostart/solaar.desktop}}.
 +
 
 +
=== pairingtool ===
  
===pairingtool===
 
 
To find the device that the receiver has, therefore take a look at the outputs of  
 
To find the device that the receiver has, therefore take a look at the outputs of  
 
  $ ls -l /sys/class/hidraw/hidraw*/device/driver | awk -F/ '/receiver/{print $5}'
 
  $ ls -l /sys/class/hidraw/hidraw*/device/driver | awk -F/ '/receiver/{print $5}'
Line 161: Line 56:
  
 
Now switch off the device that you want to pair (if it was on) and execute your compiled program with the appropriate device as argument:
 
Now switch off the device that you want to pair (if it was on) and execute your compiled program with the appropriate device as argument:
  # ./pairing_tool /dev/hidraw0
+
  # pairing_tool /dev/hidraw0
 
  The receiver is ready to pair a new device.
 
  The receiver is ready to pair a new device.
 
  Switch your device on to pair it (you have thirty seconds to do so).
 
  Switch your device on to pair it (you have thirty seconds to do so).
 
Now switch on the device you want to pair. After a few seconds your new device should work properly.
 
Now switch on the device you want to pair. After a few seconds your new device should work properly.
  
==Known Problems==
+
== Known Problems ==
===Wrong device (pairing tool only)===
+
 
 +
=== Wrong device (pairing tool only) ===
 +
 
 
On some systems there is more than one device that has the same name. In that case you will receive the following error message when the wrong device is choosen:
 
On some systems there is more than one device that has the same name. In that case you will receive the following error message when the wrong device is choosen:
 
  # pairing_tool /dev/hidraw1
 
  # pairing_tool /dev/hidraw1
 
  Error: 32
 
  Error: 32
 
  write: Broken pipe
 
  write: Broken pipe
===Keyboard Layout via xorg.conf===
+
 
 +
=== Keyboard layout via xorg.conf ===
 +
 
 
With kernel 3.2 the Unifying Receiver got its own kernel module ''hid_logitech_dj'' which does not work flawlessly together with keyboard layout setting set via [[Xorg#Keyboard settings|xorg.conf]].
 
With kernel 3.2 the Unifying Receiver got its own kernel module ''hid_logitech_dj'' which does not work flawlessly together with keyboard layout setting set via [[Xorg#Keyboard settings|xorg.conf]].
 
A temporary workaround is to use {{Pkg|xorg-setxkbmap}} and set the layout manually. For example for a German layout with no deadkeys one has to execute:
 
A temporary workaround is to use {{Pkg|xorg-setxkbmap}} and set the layout manually. For example for a German layout with no deadkeys one has to execute:
 
  $ setxkbmap -layout de -variant nodeadkeys
 
  $ setxkbmap -layout de -variant nodeadkeys
To automate this process one could add this line to [[xinitrc]].
+
To automate this process one could add this line to [[xinitrc]] or the according [[autostart]] file of your windows manager respectively desktop environment.
 +
 
 +
=== Logitech touchpad keyboard K400r with unifying receiver M325 ===
 +
The Logitech keyboard K400r with integrated touchpad comes with Logitech unifying receiver M325 so the above mentioned about the keyboard layout will apply here too.
 +
 
 +
Also the integrated touchpad is recognized as 'pointer' instead of 'touchpad' so you cannot use the [[Touchpad Synaptics]] drivers.
 +
Two finger horizontal scrolling and tapclick will work but in order to have a middle mouse button emulated you will have to add
 +
 
 +
{{hc|/etc/X11/xorg.conf.d/10-evdev.conf|<nowiki>
 +
Section "InputClass"
 +
        Identifier "evdev pointer catchall"
 +
        MatchIsPointer "on"
 +
        MatchDevicePath "/dev/input/event*"
 +
        Driver "evdev"
 +
        Option "Emulate3Buttons" "true"
 +
EndSection
 +
</nowiki>}}
 +
 
 +
to your evdev.conf.
 +
Now third button is emulated by pressing both buttons simultaneously.
 +
 
 +
 
 +
=== Solaar 'Permission denied' ===
 +
 
 +
Is it possible to have the error:
 +
$ solaar-cli show
 +
solaar-cli: error: [Errno 13] Permission denied: '/dev/hidraw2'
 +
In this case, you can physically remove the Unifying Receiver and re-insert it, and re-run the command (as described in the second point of installation part on the official site [https://pwr.github.io/Solaar/installation.html]).
 +
 
 +
=== Wireless Keyboard doesn't work while booting (can't enter luks passphrase) ===
 +
 
 +
While booting it's impossible to input anything with a Logitech wireless Keyboard (e. g. Logitech MK700).
 +
The cause of the problem is the own hid module for Logitech devices since Kernel 3.2.
 +
 
 +
To fix the problem, just add "hid-logitech-hidpp" to MODULES in /etc/mkinitcpio.conf like this:
 +
MODULES="hid-logitech-hidpp"
 +
and recreate the initrd for the kernel.
 +
$ mkinitcpio -p linux

Latest revision as of 11:36, 20 September 2016

The Logitech Unifying Receiver is a wireless receiver that can connect up to six compatible wireless mice and keyboards to your computer. The input device that comes with the receiver is already paired with it and should work out of the box through plug and play. Logitech officially supports pairing of additional devices just through their Windows and macOS software. Pairing on Linux is supported by a small program from Benjamin Tissoires. That tool does not provide any feedback though. Other developers have built more complete pairing tools that give feedback and allow unpairing as well.

ltunify is a command-line C program that can perform pairing, unpairing and listing of devices. Solaar is a graphical Python program that integrates in your system tray and allows you to configure additional features of your input device such as swapping the functionality of Fn keys.

Installation

Benjamin's program can directly be installed from AUR: pairing_toolAUR.

Solaar is also available from the AUR: solaarAUR. At installation the Solaar package is creating the group plugdev. After installation add you user to the plugdev group (# gpasswd -a $USER plugdev) to use Solaar as non-root user.

ltunify is now also available from the AUR: ltunify-gitAUR. Create the plugdev group before installation and add yourself to it (to avoid the need of running ltunify as root). After installation, you can edit the file /etc/udev/rules.d/42-logitech-unify-permissions.rules to change the device group (the default group is plugdev).

Usage

pairingtool can only be used for pairing and does not provide feedback, it also needs to know the device name for pairing. ltunify and Solaar can detect the receiver automatically.

ltunify

Examples on unpairing a device, pairing a new device and showing a list of all devices:

$ ltunify unpair mouse
Device 0x01 Mouse successfully unpaired
$ ltunify pair
Please turn your wireless device off and on to start pairing.
Found new device, id=0x01 Mouse
$ ltunify list
Devices count: 1
Connected devices:
idx=1   Mouse   M525

Solaar

Solaar has a GUI and CLI. Example CLI pairing session:

$ solaar-cli unpair mouse
Unpaired 1: Wireless Mouse M525 [M525:DAFA335E]
$ solaar-cli pair
Pairing: turn your new device on (timing out in 20 seconds).
Paired device 1: Wireless Mouse M525 [M525:DAFA335E]
$ solaar-cli show
-: Unifying Receiver [/dev/hidraw0:08D89AA6] with 1 devices
1: Wireless Mouse M525 [M525:DAFA335E]

To disable autostart of Solaar, remove /etc/xdg/autostart/solaar.desktop.

pairingtool

To find the device that the receiver has, therefore take a look at the outputs of

$ ls -l /sys/class/hidraw/hidraw*/device/driver | awk -F/ '/receiver/{print $5}'

This will show the names of your receiver, for example hidraw0.

Now switch off the device that you want to pair (if it was on) and execute your compiled program with the appropriate device as argument:

# pairing_tool /dev/hidraw0
The receiver is ready to pair a new device.
Switch your device on to pair it (you have thirty seconds to do so).

Now switch on the device you want to pair. After a few seconds your new device should work properly.

Known Problems

Wrong device (pairing tool only)

On some systems there is more than one device that has the same name. In that case you will receive the following error message when the wrong device is choosen:

# pairing_tool /dev/hidraw1
Error: 32
write: Broken pipe

Keyboard layout via xorg.conf

With kernel 3.2 the Unifying Receiver got its own kernel module hid_logitech_dj which does not work flawlessly together with keyboard layout setting set via xorg.conf. A temporary workaround is to use xorg-setxkbmap and set the layout manually. For example for a German layout with no deadkeys one has to execute:

$ setxkbmap -layout de -variant nodeadkeys

To automate this process one could add this line to xinitrc or the according autostart file of your windows manager respectively desktop environment.

Logitech touchpad keyboard K400r with unifying receiver M325

The Logitech keyboard K400r with integrated touchpad comes with Logitech unifying receiver M325 so the above mentioned about the keyboard layout will apply here too.

Also the integrated touchpad is recognized as 'pointer' instead of 'touchpad' so you cannot use the Touchpad Synaptics drivers. Two finger horizontal scrolling and tapclick will work but in order to have a middle mouse button emulated you will have to add

/etc/X11/xorg.conf.d/10-evdev.conf
Section "InputClass"
        Identifier "evdev pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        Option "Emulate3Buttons" "true"
EndSection

to your evdev.conf. Now third button is emulated by pressing both buttons simultaneously.


Solaar 'Permission denied'

Is it possible to have the error:

$ solaar-cli show
solaar-cli: error: [Errno 13] Permission denied: '/dev/hidraw2'

In this case, you can physically remove the Unifying Receiver and re-insert it, and re-run the command (as described in the second point of installation part on the official site [1]).

Wireless Keyboard doesn't work while booting (can't enter luks passphrase)

While booting it's impossible to input anything with a Logitech wireless Keyboard (e. g. Logitech MK700). The cause of the problem is the own hid module for Logitech devices since Kernel 3.2.

To fix the problem, just add "hid-logitech-hidpp" to MODULES in /etc/mkinitcpio.conf like this:

MODULES="hid-logitech-hidpp"

and recreate the initrd for the kernel.

$ mkinitcpio -p linux