HID: Add full support for Logitech Unifying receivers
Subsystems (2)
PATCH v4 1/1 HID: Add full support for Logitech Unifying receivers
From: Nestor Lopez Casado <[email protected]>
From: Nestor Lopez Casado <[email protected]>
With this driver, all the devices paired to a single Unifying receiver are exposed to user processes in separated /input/dev nodes.
Keyboards with different layouts can be treated differently, Multiplayer games on single PC (like home theater PC) can differentiate input coming from different kbds paired to the same receiver.
Up to now, when Logitech Unifying receivers are connected to a Linux based system, a single keyboard and a single mouse are presented to the HID Layer, even if the Unifying receiver can pair up to six compatible devices. The Unifying receiver by default multiplexes all incoming events (from multiple keyboards/mice) into these two.
---
Hi guys,
this is the v4 of the bus enumerator patch.
Since the v3:
- it corrects a kernel oops when starting gnome-panel (due to
a hid_report not given as a pointer in logi_dj_ll_input_event).
- I also added the function logi_dj_reset_resume to re-enable dj mode after coming from suspend to disk in case usb has been shut off.
Cheers,
Benjamin
drivers/hid/Kconfig | 9 + drivers/hid/Makefile | 1 + drivers/hid/hid-core.c | 2 + drivers/hid/hid-ids.h | 2 + drivers/hid/hid-logitech-dj.c | 913 +++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-logitech-dj.h | 123 ++++++ 6 files changed, 1050 insertions(+), 0 deletions(-) create mode 100644 drivers/hid/hid-logitech-dj.c create mode 100644 drivers/hid/hid-logitech-dj.h
drivers/hid/Kconfig +9 -0
@@ -231,6 +231,15 @@ config HID_LOGITECH ---help--- Support for Logitech devices that are not fully compliant with HID standard. +config HID_LOGITECH_DJ + tristate "Logitech Unifying receivers full support" + depends on HID_LOGITECH + default m + ---help--- + Say Y if you want support for Logitech Unifying receivers and devices. + Unifying receivers are capable of pairing up to 6 Logitech compliant + devices to the same receiver. + config LOGITECH_FF bool "Logitech force feedback support" depends on HID_LOGITECH
drivers/hid/Makefile +1 -0
@@ -44,6 +44,7 @@ obj-$(CONFIG_HID_KEYTOUCH) += hid-keytouch.o obj-$(CONFIG_HID_KYE) += hid-kye.o obj-$(CONFIG_HID_LCPOWER) += hid-lcpower.o obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o +obj-$(CONFIG_HID_LOGITECH_DJ) += hid-logitech-dj.o obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o
drivers/hid/hid-core.c +2 -0
@@ -1423,6 +1423,8 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL) }, + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) }, + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) },
drivers/hid/hid-ids.h +2 -0
@@ -440,6 +440,8 @@#define USB_DEVICE_ID_S510_RECEIVER_2 0xc517#define USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500 0xc512#define USB_DEVICE_ID_MX3000_RECEIVER 0xc513 +#define USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER 0xc52b +#define USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2 0xc532#define USB_DEVICE_ID_SPACETRAVELLER 0xc623#define USB_DEVICE_ID_SPACENAVIGATOR 0xc626#define USB_DEVICE_ID_DINOVO_DESKTOP 0xc704
drivers/hid/hid-logitech-dj.c new file +913 -0
913 lines not on this page · raw message
drivers/hid/hid-logitech-dj.h new file +123 -0
123 lines not on this page · raw message
Signature · 1 line
1.7.4.4
Quoted 4 lines · Benjamin Tissoires
From: Nestor Lopez Casado <[email protected]>
From: Nestor Lopez Casado <[email protected]>
Quoted 8 lines
With this driver, all the devices paired to a single Unifying receiver are exposed to user processes in separated /input/dev nodes.
Keyboards with different layouts can be treated differently, Multiplayer games on single PC (like home theater PC) can differentiate input coming from different kbds paired to the same receiver.
Nice. Does this mean I will be able to use the thumb-button of my M705 mouse in the near future?
(Someone asked the same question 1.5 years ago, but nothing happened till then:
http://thread.gmane.org/gmane.linux.kernel.input/11791 )
Signature · 1 line
Markus
Hi Markus,
Quoted 14 lines · Markus Trippelsdorf
Quoted 4 lines · Benjamin Tissoires
From: Nestor Lopez Casado <[email protected]>
From: Nestor Lopez Casado <[email protected]>
Quoted 8 lines
With this driver, all the devices paired to a single Unifying receiver are exposed to user processes in separated /input/dev nodes.
Keyboards with different layouts can be treated differently, Multiplayer games on single PC (like home theater PC) can differentiate input coming from different kbds paired to the same receiver.
Quoted 6 lines
Nice. Does this mean I will be able to use the thumb-button of my M705 mouse in the near future?
(Someone asked the same question 1.5 years ago, but nothing happened till then:
http://thread.gmane.org/gmane.linux.kernel.input/11791 )
This is quite weird. I was going to say that it will work, but with the M705 I've got at home,this thumb button doesn't work at all (anything is emitted from the usb, even with this driver). But I'm pretty sure I made it work with the one I got at work.
I'll give a try on Monday unless people at Logitech gave us the solution.
Cheers,
Benjamin
Quoted 4 lines
--
Markus
Hi Markus,
I got some information for you. Apparently, it won't be possible to enable this thumb button right now.
To enable it, the Windows driver put the mouse in a kind of debug mode that need to be handled properly, which is not the case as of today.
I was able to make it work at home because there were different series of M705, the latest sending the thumb button by default.
Sorry,
Benjamin
Quoted 40 lines · Benjamin Tissoires
Hi Markus,
Quoted 14 lines · Markus Trippelsdorf
Quoted 4 lines · Benjamin Tissoires
From: Nestor Lopez Casado <[email protected]>
From: Nestor Lopez Casado <[email protected]>
Quoted 8 lines
With this driver, all the devices paired to a single Unifying receiver are exposed to user processes in separated /input/dev nodes.
Keyboards with different layouts can be treated differently, Multiplayer games on single PC (like home theater PC) can differentiate input coming from different kbds paired to the same receiver.
Quoted 6 lines
Nice. Does this mean I will be able to use the thumb-button of my M705 mouse in the near future?
(Someone asked the same question 1.5 years ago, but nothing happened till then:
http://thread.gmane.org/gmane.linux.kernel.input/11791 )This is quite weird. I was going to say that it will work, but with the M705 I've got at home,this thumb button doesn't work at all (anything is emitted from the usb, even with this driver). But I'm pretty sure I made it work with the one I got at work.
I'll give a try on Monday unless people at Logitech gave us the solution.
Cheers,
BenjaminQuoted 4 lines
--
Markus
Quoted 4 lines · Benjamin Tissoires
I got some information for you. Apparently, it won't be possible to enable this thumb button right now.
To enable it, the Windows driver put the mouse in a kind of debug mode that need to be handled properly, which is not the case as of today.
Understood. But all we need to know is the magic bytes to send to the controller to enable the thumb-button. And because it works without problems under Windows, it shouldn't be impossible to implement in Linux. Maybe the Logitech guys could cook something up?
Thanks.
Signature · 1 line
Markus
Logitech M705: Thumb button (was Re: [PATCH v4] HID: Add full support for Logitech Unifying receivers)
In reply to Benjamin Tissoires[ Frantisek Fuka added to CC ]
Quoted 13 lines · Benjamin Tissoires
Quoted 6 lines
Quoted 5 lines
Nice. Does this mean I will be able to use the thumb-button of my M705 mouse in the near future?
(Someone asked the same question 1.5 years ago, but nothing happened till then: http://thread.gmane.org/gmane.linux.kernel.input/11791 )
Quoted 6 lines
This is quite weird. I was going to say that it will work, but with the M705 I've got at home,this thumb button doesn't work at all (anything is emitted from the usb, even with this driver). But I'm pretty sure I made it work with the one I got at work.
I'll give a try on Monday unless people at Logitech gave us the solution.
Quoted 7 lines
I got some information for you. Apparently, it won't be possible to enable this thumb button right now.
To enable it, the Windows driver put the mouse in a kind of debug mode that need to be handled properly, which is not the case as of today.I was able to make it work at home because there were different series of M705, the latest sending the thumb button by default.
Let me resurrect this 2 years old thread, as I have received multiple reports since then, stating that some revisions of M705 don't have working thumb button.
Question mostly to the Logitech guys: Nestor, Olivier, could you please provide us with the sequence that needs to be sent to (certain revisisons of) M705 to let enter the debug mode, making the thumb button actually emit a USB message?
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs
Re: Logitech M705: Thumb button (was Re: [PATCH v4] HID: Add full support for Logitech Unifying receivers)
Hi all,
Sorry it took me some time to answer.
I extended the Logitech HIDPP10 specification here:
https://drive.google.com/folderview?id=0BxbRzx7vEV7eWmgwazJ3NUFfQ28&usp=sharing
The document "Logitech_hidpp10_specification_draft_Unifying_devices_receivers.doc" now contains most of the relevant hidpp10 registers and notifications needed to interact with older Logitech devices that support hidpp10 as well as the Unifying receiver.
In particular I added the specifications for the registers that enable retrieving the FW version information for devices/receivers. This will become relevant below.
Cheers,
Nestor
Quoted 27 lines · Jiri Kosina
[ Frantisek Fuka added to CC ]
Quoted 13 lines · Benjamin Tissoires
Quoted 6 lines
Quoted 5 lines
Nice. Does this mean I will be able to use the thumb-button of my M705 mouse in the near future?
(Someone asked the same question 1.5 years ago, but nothing happened till then: http://thread.gmane.org/gmane.linux.kernel.input/11791 )
Quoted 6 lines
This is quite weird. I was going to say that it will work, but with the M705 I've got at home,this thumb button doesn't work at all (anything is emitted from the usb, even with this driver). But I'm pretty sure I made it work with the one I got at work.
I'll give a try on Monday unless people at Logitech gave us the solution.
Quoted 7 lines
I got some information for you. Apparently, it won't be possible to enable this thumb button right now.
To enable it, the Windows driver put the mouse in a kind of debug mode that need to be handled properly, which is not the case as of today.I was able to make it work at home because there were different series of M705, the latest sending the thumb button by default.
Quoted 8 lines
Let me resurrect this 2 years old thread, as I have received multiple reports since then, stating that some revisions of M705 don't have working thumb button.
Question mostly to the Logitech guys: Nestor, Olivier, could you please provide us with the sequence that needs to be sent to (certain revisisons of) M705 to let enter the debug mode, making the thumb button actually emit a USB message?
There are two versions of FW in the field:
1) Version 17.01.Build 0017.
This version reports the thumb button by default as HID button 6.
2) Version 17.00.Build 0015
This version does not report the thumb button by default.
It is possible to enable the M705 with FW 17.00.Build 0015 to send the thumb button as HID button 6 via HIDPP10 command. But this will have a (undesirable ?) side effect.
Once the button 6 is enabled, the buttons aside to the wheel (tilt buttons) will no longer be reported as AC pan HID usage, they will be reported as buttons 7 & 8. This might disrupt some users that rely on the mouse AC pan feature.
To enable HID button 6 reporting from thumb button we need to clear the bit 1 (Special button function) in register 0x01 on the M705 READ register: 10 IDX 81 01 r0 r1 r2
Clear Bit1: r0 &= 0xFD;
Write back register: 10 IDX 80 01 r0 r1 r2
IDX is the device index on the Unifying receiver.
Note that if the command is sent to all M705 devices, users that have the 17.01.Build 0017 will lose the Ac pan and will gain nothing.
Quoted 10 lines
Thanks,
--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Logitech M705: Thumb button (was Re: [PATCH v4] HID: Add full support for Logitech Unifying receivers)
Hi Nestor,
Quoted 6 lines · Nestor Lopez Casado
Hi all,
Sorry it took me some time to answer.
I extended the Logitech HIDPP10 specification here:
https://drive.google.com/folderview?id=0BxbRzx7vEV7eWmgwazJ3NUFfQ28&usp=sharing
Thanks :)
Quoted 19 lines
[...]
Quoted 8 lines
Let me resurrect this 2 years old thread, as I have received multiple reports since then, stating that some revisions of M705 don't have working thumb button.
Question mostly to the Logitech guys: Nestor, Olivier, could you please provide us with the sequence that needs to be sent to (certain revisisons of) M705 to let enter the debug mode, making the thumb button actually emit a USB message?
There are two versions of FW in the field:
1) Version 17.01.Build 0017.
This version reports the thumb button by default as HID button 6.2) Version 17.00.Build 0015
This version does not report the thumb button by default.
Quoted 7 lines
It is possible to enable the M705 with FW 17.00.Build 0015 to send the thumb button as HID button 6 via HIDPP10 command. But this will have a (undesirable ?) side effect.
Once the button 6 is enabled, the buttons aside to the wheel (tilt buttons) will no longer be reported as AC pan HID usage, they will be reported as buttons 7 & 8. This might disrupt some users that rely on the mouse AC pan feature.
This side effect can be solved by handling the magic sequence in the kernel, and do the mapping in the kernel also.
This would need to add a special driver for the M705 though. The good point is that both the firmware behave the same way when they are switched to the special mode, meaning that we don't need to check the build number and do the switch as soon as we see the M705 PID.
Quoted 7 lines
To enable HID button 6 reporting from thumb button we need to clear the bit 1 (Special button function) in register
0x01on the M705 READ register: 10 IDX 81 01 r0 r1 r2
Clear Bit1: r0 &=0xFD;
Write back register: 10 IDX 80 01 r0 r1 r2
Quoted 5 lines
IDX is the device index on the Unifying receiver.
Note that if the command is sent to all M705 devices, users that have the 17.01.Build 0017 will lose the Ac pan and will gain nothing.
For those who wants to try, I have set up a project [1] to implement part of the spec Nestor released.
I implemented various features: list devices paired to a receiver, pair/unpair a device, and toggle the button 6 on M705 mouse with the faulty firmware.
When switching mode for the M705, as Nestor said, we lose the AC panning ability until the correct remapping is done in the kernel.
Cheers,
Benjamin
Re: Logitech M705: Thumb button (was Re: [PATCH v4] HID: Add full support for Logitech Unifying receivers)
Quoted 11 lines · Benjamin Tissoires
For those who wants to try, I have set up a project [1] to implement part of the spec Nestor released. I implemented various features: list devices paired to a receiver, pair/unpair a device, and toggle the button 6 on M705 mouse with the faulty firmware. When switching mode for the M705, as Nestor said, we lose the AC panning ability until the correct remapping is done in the kernel.
Cheers,
Benjamin
Thanks for your work on this, Benjamin.
I have a followup question -- why not do this in the kernel completely though? I have actually been asked by Linus directly (so we'd rather do that :) ) to include pairing trigger as a sysfs toggle instead of having to use userspace utilitites, and it actually makes sense to me.
Are you aware of any particular reason to not have all that's provided by uLogitech in the kernel?
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs
Re: Logitech M705: Thumb button (was Re: [PATCH v4] HID: Add full support for Logitech Unifying receivers)
Quoted 12 lines · Jiri Kosina
Quoted 10 lines · Benjamin Tissoires
For those who wants to try, I have set up a project [1] to implement part of the spec Nestor released. I implemented various features: list devices paired to a receiver, pair/unpair a device, and toggle the button 6 on M705 mouse with the faulty firmware. When switching mode for the M705, as Nestor said, we lose the AC panning ability until the correct remapping is done in the kernel.
Cheers,
Benjamin
Quoted 8 lines
Quoted 1 line
Thanks for your work on this, Benjamin.
I have a followup question -- why not do this in the kernel completely though? I have actually been asked by Linus directly (so we'd rather do that :) ) to include pairing trigger as a sysfs toggle instead of having to use userspace utilitites, and it actually makes sense to me.
yep, the sysfs toggle for the pairing makes sense. In the same way, we should retrieve the actual name of the device instead of building a complex string "Logitech Unifying Device. Wireless PID:XXXX"... And for the M705, it really should be implemented in the kernel (I guess it will not be a lot of effort).
Quoted 3 lines
Are you aware of any particular reason to not have all that's provided by uLogitech in the kernel?
I'm afraid the very first reason is that we (Nestor or myself) don't have much allowed time to implement it properly in the kernel... :( Nestor is working on other projects, and for me, I did not had any customer requests for it in RHEL nor Fedora.
Cheers,
Benjamin
Quoted 46 lines · Benjamin Tissoires
From: Nestor Lopez Casado <[email protected]>
From: Nestor Lopez Casado <[email protected]>
With this driver, all the devices paired to a single Unifying receiver are exposed to user processes in separated /input/dev nodes.
Keyboards with different layouts can be treated differently, Multiplayer games on single PC (like home theater PC) can differentiate input coming from different kbds paired to the same receiver.
Up to now, when Logitech Unifying receivers are connected to a Linux based system, a single keyboard and a single mouse are presented to the HID Layer, even if the Unifying receiver can pair up to six compatible devices. The Unifying receiver by default multiplexes all incoming events (from multiple keyboards/mice) into these two.
Signed-off-by Nestor Lopez Casado <[email protected]>Signed-off-by Benjamin Tissoires <[email protected]>---
Hi guys,
this is the v4 of the bus enumerator patch.
Since the v3:
- it corrects a kernel oops when starting gnome-panel (due to
ahid_reportnot given as a pointer inlogi_dj_ll_input_event).
- I also added the functionlogi_dj_reset_resumeto re-enable dj mode after coming from suspend to disk in case usb has been shut off.Cheers,
Benjamindrivers/hid/Kconfig | 9 + drivers/hid/Makefile | 1 + drivers/hid/hid-core.c | 2 + drivers/hid/hid-ids.h | 2 + drivers/hid/hid-logitech-dj.c | 913 +++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-logitech-dj.h | 123 ++++++ 6 files changed, 1050 insertions(+), 0 deletions(-) create mode 100644 drivers/hid/hid-logitech-dj.c create mode 100644 drivers/hid/hid-logitech-dj.h
[ ... snip ... ]
drivers/hid/hid-logitech-dj.c line 4
Quoted 10 lines
drivers/hid/hid-logitech-dj.c new file +4
-0@@ -0,0 +1,913 @@ +/* +* HID driver for Logitech Unifying receivers +* +* Copyright (c) 2011 Logitech (c)
What is this double (c) about? (it is also in other files).
Quoted 7 lines
drivers/hid/hid-logitech-dj.c new file +7
-0+/* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. + +* +* This program is distributed in the hope that it will be useful,
drivers/hid/hid-logitech-dj.c line 23
Quoted 10 lines
drivers/hid/hid-logitech-dj.c new file +10
-0+* 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* Should you need to contact me, the author, you can do so by e-mail send +* your message to Nestor Lopez Casado <xnlopez at gmail com>
As the file is not copyrighted by a single person, but a company instead, perhaps this paragraph should rather be removed?
[ ... snip ... ]
Quoted 29 lines
drivers/hid/hid-logitech-dj.c new file +29
-0+static void logi_dj_recv_add_djhid_device (struct dj_receiver_dev *djrcv_dev, +struct dj_report *dj_report) +{ +/* Called in delayed work context */ +struct hid_device *djrcv_hdev = djrcv_dev->hdev; +struct usb_interface *intf =to_usb_interface (djrcv_hdev->dev.parent); +struct usb_device *usbdev =interface_to_usbdev (intf); +struct hid_device *dj_hiddev; +struct dj_device *dj_dev; +unsigned char tmpstr[20 ]; + +if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION ] & +SPFUNCTION_DEVICE_LIST_EMPTY ) { +dbg_hid ("%s: device list is empty\n" , __func__); +return ; + } + + dj_hiddev =hid_allocate_device (); +if (IS_ERR (dj_hiddev)) { +dev_err (&djrcv_hdev->dev,"%s: hid_allocate_device failed\n" , + __func__); +return ; + } + + dj_hiddev->ll_driver = &logi_dj_ll_driver; + dj_hiddev->hid_output_raw_report = logi_dj_output_hidraw_report; + + dj_hiddev->dev.parent = &djrcv_hdev->dev; + dj_hiddev->bus =BUS_USB ;
drivers/hid/hid-logitech-dj.c line 250
Quoted 10 lines
drivers/hid/hid-logitech-dj.c new file +10
-0+ dj_hiddev->vendor =le16_to_cpu (usbdev->descriptor.idVendor); + dj_hiddev->product =le16_to_cpu (usbdev->descriptor.idProduct); +snprintf (dj_hiddev->name,sizeof (dj_hiddev->name), +"Logitech Unifying Device. Wireless PID:%02x%02x" , + dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_MSB ], + dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_LSB ]); + +usb_make_path (usbdev, dj_hiddev->phys,sizeof (dj_hiddev->phys)); +snprintf (tmpstr,sizeof (tmpstr),":%d" , dj_report->device_index); +strlcat (dj_hiddev->phys, tmpstr,sizeof (dj_hiddev->phys));
Where does the guarantee of 20 chars being enough here come from, please?
Other than these minor things, I think the driver is ready to be merged. Thanks everyone for your work on this,
Signature · 2 lines
Jiri Kosina SUSE Labs
Quoted 7 lines · Jiri Kosina
Quoted 2 lines · Benjamin Tissoires
+ * Should you need to contact me, the author, you can do so by e-mail send
+ * your message to Nestor Lopez Casado <xnlopez at gmail com>As the file is not copyrighted by a single person, but a company instead, perhaps this paragraph should rather be removed?
More correctly, these 2 lines should be a patch to MAINTAINERS.