Logitech G-series drivers
Hello.
I would like to submit to your attention for inclusion in the mainline kernel a series of drivers for a set of Logitech keybord devices. I forked the sources under a GPL/GPLv2 license and performed maintenance and stabilization work on them.
The repository I am working on is at
Short description of the modules and files:
- hid-g110 - Logitech G110 (tested)
- hid-g13 - Logitech G13 (tested)
- hid-g15v2 - Logitech G15, version 2 (tested)
- hid-g19 - Logitech G19 (tested)
- hid-g15 - Logitech G15 (not tested)
- hid-g510 - Logitech G510 - not ready
- hid-gcore - common functions for other modules
- hid-gfb - framebuffer implementation for on-device displays
- hid-ids.h - product IDs
I would like the opinion of a kernel developer on the possibility of including these drivers in the kernel. If the answer is favorable, I will prepare a series of patches against the kernel's master branch and work towards them being accepted.
Thank you.
Hi Ciprian,
Adding linux-input and Jiri (HID maintainer) to CC.
Quoted 23 lines · On Sun, 15 Feb 2015 23:17:27 +0200 Ciprian Ciubotariu wrote:
I would like to submit to your attention for inclusion in the mainline kernel a series of drivers for a set of Logitech keybord devices. I forked the sources under a GPL/GPLv2 license and performed maintenance and stabilization work on them.
The repository I am working on is at
Short description of the modules and files:
- hid-g110 - Logitech G110 (tested)
- hid-g13 - Logitech G13 (tested)
- hid-g15v2 - Logitech G15, version 2 (tested)
- hid-g19 - Logitech G19 (tested)- hid-g15 - Logitech G15 (not tested)
- hid-g510 - Logitech G510 - not ready- hid-gcore - common functions for other modules
- hid-gfb - framebuffer implementation for on-device displays
-hid-ids.h- product IDs
Quoted 6 lines
I would like the opinion of a kernel developer on the possibility of including these drivers in the kernel. If the answer is favorable, I will prepare a series of patches against the kernel's master branch and work towards them being accepted.
From a quick look at your github tree the drivers are prepared for
building out-of-tree.
Did you check for older work on Logitech keyboards that has been proposed on linux-input list some time ago and what is currently present in Linus' tree?
An overview of the features covered by the drivers would help understand what the new drivers add (and the differences between all the covered keyboard variants).
There seem to be individual drivers for each keyboard type. Are the features so different that distinct drivers are needed or can the drivers be unified?
If you would like to get the drivers merged please create patches against upstream tree, eventually starting with support for the keyboard you own, adding support for the other keyboards in separate patches.
You could also split your patch based on feature support.
It might be worth exploring the option to organize the driver(s) as a MFD (multi-function-device) device.
Bruno
Hi. Only now I realized you wrote some instructions. Below are my (quite lengthy) responses.
Quoted 3 lines · On Thursday 19 February 2015 10:48:27 Bruno Prémont wrote:
Hi Ciprian,
Adding linux-input and Jiri (HID maintainer) to CC.
Should I register myself on the linux-input mailing list as well?
Quoted 29 lines · On Sun, 15 Feb 2015 23:17:27 +0200 Ciprian Ciubotariu wrote:
Quoted 18 lines
I would like to submit to your attention for inclusion in the mainline kernel a series of drivers for a set of Logitech keybord devices. I forked the sources under a GPL/GPLv2 license and performed maintenance and stabilization work on them.
The repository I am working on is at
Short description of the modules and files:
- hid-g110 - Logitech G110 (tested)
- hid-g13 - Logitech G13 (tested)
- hid-g15v2 - Logitech G15, version 2 (tested)
- hid-g19 - Logitech G19 (tested)- hid-g15 - Logitech G15 (not tested)
- hid-g510 - Logitech G510 - not readyQuoted 8 lines
- hid-gcore - common functions for other modules
- hid-gfb - framebuffer implementation for on-device displays
-hid-ids.h- product IDsI would like the opinion of a kernel developer on the possibility of including these drivers in the kernel. If the answer is favorable, I will prepare a series of patches against the kernel's master branch and work towards them being accepted.
Quoted 6 lines
From a quick look at your github tree the drivers are prepared for building out-of-tree.
Did you check for older work on Logitech keyboards that has been proposed on linux-input list some time ago and what is currently present in Linus' tree?
Yes, I have checked the tree. The mailing list archives recorded some related activity in 2010, but no patches were applied to the kernel tree.
Quoted 4 lines
An overview of the features covered by the drivers would help understand what the new drivers add (and the differences between all the covered keyboard variants).
I. From the user perspective, all G-series keyboards have
(1) A set of "macro" keys and a set of support keys (macro set selection,
menu navigation and such).
(2) Some devices present an LCD, which is either monochrome or color.
(3) All have LEDs that allow changing the (3a) keyboard illumination
intensity and color, (3b) the backlight of the macro set selection keys, as well (3c) as the backlight of the LCD.
II. Hardware
The hardware presents these extra keys on a separate USB device. G110 and G19 use a separate endpoint for some of the keys, while other models use just HID reports. All seem to use a custom bit-flag format to report the key status, but I am not a HID expert - maybe it is standard. However, all these keys are dead without these drivers.
The LEDs are controlled via hid reports, but the calculus of the fields differs on some models (G110 needs some weird maths).
The LCD framebuffer can be written to via USB interrupt/bulk endpoints depending on the model. hid-gfb.c implements the LCD matrix via the kernel's FB API. The LCD backlight can only be controlled independently on G19, and is mapped to LED devices by hid-g19.
III. Driver code
The driver code can be understood starting from the probe functions for each model. The probe functions allocate a common structure via hid-gcore.c, and use the gdata member for model-custom information. Each probe function adds the appropriate LED-class devices, using functions in hid-gcore.c. Same goes for input devices, sysfs attributes and possibly framebuffer devices (via hid- gfb.c).
Device initialization goes through a series of stages, which can be read via a bitfield in some reports. After this is completed, the gXX_raw_event function defers to gXX_raw_event_process_input, which reports input events. For G110 and G19 we also have gXX_ep1_read and gXX_ep1_urb_completion, which handle the extra keys. gXX_led_.... keys handle LED brightness via sysfs.
The gfb_probe function in hid-gfb.c is started by the main driver in monochrome or color mode, depending on model. It allocates a backbuffer for user interaction, and writes it via an bulk/interrupt USB endpoint to the device. The USB writes are performed using a certain frequency using FB_DEFERRED_IO (see gfb_fb_deferred_io, gfb_update and gfb_fb_send). The rest manages framebuffer operations and userspace access.
Quoted 3 lines
There seem to be individual drivers for each keyboard type. Are the features so different that distinct drivers are needed or can the drivers be unified?
Some of my work was to start refactoring the set of copy-pasted drivers into a common functions module (hid-gcore). The LCDs use a common protocol, which was already isolated in hid-gfb.
Perhaps the LEDs API could be unified, but the hardware protocol would still differ between models. The probe functions also seem similar, but I'll have to check for subtle differences before attempting to unify them. More work could be done in this direction.
However, I think that at this stage attempting to completely unify the drivers would make the code more unreadable. Maybe after some more refactoring.
Also, I am unsure if such an unification is compatible with Logitech's newer G- series models (G710 etc), since they seem to change things in hardware at will between models.
Quoted 7 lines
If you would like to get the drivers merged please create patches against upstream tree, eventually starting with support for the keyboard you own, adding support for the other keyboards in separate patches.
You could also split your patch based on feature support.
While I am typing on the G19 right now, I have only tested G110, G13, G15v2 and they seem stable. I lack the G15 model, and G510 is not yet working.
To summarize, this submission is about devices g110, g13, g15v2 and g19, all tested by me and working.
I have prepared a patch for the kernel tree, rebased into a single commit. I can split it per-device, but I don't know how to split the changes to Kconfig, hid-ids.h and hid-core.c so that each patch can be applied independently (because the changes would overlap).
The Kconfig made me wonder if I should (a) activate the dependent code in the kernel (for instance the FB or LEDS_CLASS etc), or (b) deactivate the feature from the driver and advise users in the help text.
I have followed the Documentation/SubmitChecklist guide to check the code for style problems, checked it with sparse and cross-compiled it for ARM and PPC64. The incremental changes can be reviewed at https://github.com/CMoH/lg4l
Quoted 3 lines
It might be worth exploring the option to organize the driver(s) as a MFD (multi-function-device) device.
I have looked at the list of MFD devices with make menuconfig, but I have not seen any input devices there. Perhaps a radio, and mostly PMICs of various sorts.
These are rather HID input devices with some extra custom goodies (extra keys, LEDs and LCDs). The implementation is also based on the HID bus.
I don't have any preference though.
Quoted 2 lines
Bruno
Thank you for your interest!
--
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
PATCH 1/1 Add drivers for Logitech G110, G13, G15v2 and G19
New modules:
- hid-gcore - common functions
- hid-gfb - framebuffer implementation - hid-g110 - G110 driver - hid-g13 - G13 driver
- hid-g15v2 - G15 v2 driver
- hid-g19 - G19 driver
Add Kconfig options for each driver, and a main menu option which is responsible for hid-gcore. hid-gfb is only selected when individual drivers need it.
Add product IDs to hid-ids.h, and blacklist them for hid-generic.
--- drivers/hid/Kconfig | 81 +++++ drivers/hid/Makefile | 8 + drivers/hid/hid-core.c | 4 + drivers/hid/hid-g110.c | 789 +++++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-g13.c | 783 ++++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-g15v2.c | 721 +++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-g19.c | 882 ++++++++++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-gcore.c | 398 ++++++++++++++++++++++ drivers/hid/hid-gcore.h | 74 ++++ drivers/hid/hid-gfb.c | 751 +++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-gfb.h | 54 +++ drivers/hid/hid-ids.h | 7 + 12 files changed, 4552 insertions(+) create mode 100644 drivers/hid/hid-g110.c create mode 100644 drivers/hid/hid-g13.c create mode 100644 drivers/hid/hid-g15v2.c create mode 100644 drivers/hid/hid-g19.c create mode 100644 drivers/hid/hid-gcore.c create mode 100644 drivers/hid/hid-gcore.h create mode 100644 drivers/hid/hid-gfb.c create mode 100644 drivers/hid/hid-gfb.h
drivers/hid/Kconfig +81 -0
@@ -451,6 +451,87 @@ config LOGIWHEELS_FF - Logitech MOMO/MOMO 2 - Logitech Formula Force EX +config HID_LOGITECH_GSERIES + tristate "Logitech G-Series devices" + depends on HID + depends on USB + select NEW_LEDS + select LEDS_CLASS + help + Support for Logitech G-Series devices. + + This option allows you to choose from a list of Logitech G-series devices. + If your keyboard has an LCD display, you will have to enable framebuffer + support (CONFIG_FB) to see it here. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-gcore. + +config LOGITECH_GFB + tristate + depends on HID_LOGITECH_GSERIES + depends on FB + select FB_DEFERRED_IO + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select FB_SYS_FOPS + # select LCD_CLASS_DEVICE + # select BACKLIGHT_CLASS_DEVICE + # select BACKLIGHT_LCD_SUPPORT + +config LOGITECH_G110 + tristate "Logitech G110 keyboard" + depends on HID_LOGITECH_GSERIES + help + Say Y here if you have a Logitech G110 keyboard. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-g110. + +config LOGITECH_G13 + tristate "Logitech G13 keyboard" + depends on HID_LOGITECH_GSERIES + depends on FB + select LOGITECH_GFB + help + Say Y here if you have a Logitech G13 keyboard. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-g13. + +config LOGITECH_G15V2 + tristate "Logitech G15 Version 2 keyboard" + depends on HID_LOGITECH_GSERIES + depends on FB + select LOGITECH_GFB + help + Say Y here if you have a Logitech G15 Version 2 keyboard. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-g15v2. + +config LOGITECH_G19 + tristate "Logitech G19 keyboard" + depends on HID_LOGITECH_GSERIES + depends on FB + select LOGITECH_GFB + help + Say Y here if you have a Logitech G19 keyboard. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-g19. + config HID_MAGICMOUSE tristate "Apple Magic Mouse/Trackpad multi-touch support" depends on HID
drivers/hid/Makefile +8 -0
@@ -107,3 +107,11 @@ obj-$(CONFIG_USB_MOUSE) += usbhid/ obj-$(CONFIG_USB_KBD) += usbhid/ obj-$(CONFIG_I2C_HID) += i2c-hid/ + + +obj-$(CONFIG_HID_LOGITECH_GSERIES) += hid-gcore.o +obj-$(CONFIG_LOGITECH_GFB) += hid-gfb.o +obj-$(CONFIG_LOGITECH_G110) += hid-g110.o +obj-$(CONFIG_LOGITECH_G13) += hid-g13.o +obj-$(CONFIG_LOGITECH_G15V2) += hid-g15v2.o +obj-$(CONFIG_LOGITECH_G19) += hid-g19.o
drivers/hid/hid-core.c +4 -0
@@ -1856,6 +1856,10 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL) }, + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G110) }, + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G13) }, + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G15V2_LCD) }, + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G19_LCD) }, { 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) }, #if IS_ENABLED(CONFIG_HID_LOGITECH_DJ)
drivers/hid/hid-g110.c new file +789 -0
789 lines not on this page · raw message
drivers/hid/hid-g13.c new file +783 -0
783 lines not on this page · raw message
drivers/hid/hid-g15v2.c new file +721 -0
721 lines not on this page · raw message
drivers/hid/hid-g19.c new file +882 -0
599 lines not on this page · raw message
drivers/hid/hid-gcore.c new file +398 -0
398 lines not on this page · raw message
drivers/hid/hid-gcore.h new file +74 -0
74 lines not on this page · raw message
drivers/hid/hid-gfb.c new file +751 -0
751 lines not on this page · raw message
drivers/hid/hid-gfb.h new file +54 -0
54 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.0.5
Part of the diff is not shown here. View the raw message.
Re: [PATCH] Add drivers for Logitech G110, G13, G15v2 and G19
Quoted 5 lines · Ciprian Ciubotariu
New modules:
- hid-gcore - common functions- hid-gfb - framebuffer implementation - hid-g110 - G110 driver - hid-g13 - G13 driver
Quoted 8 lines
- hid-g15v2 - G15 v2 driver
- hid-g19 - G19 driverAdd
Kconfigoptions for each driver, and a main menu option which is responsible for hid-gcore. hid-gfb is only selected when individual drivers need it.Add product IDs to
hid-ids.h, and blacklist them for hid-generic.
No Signed-off-by?
Apparently Alistair Buxton, Rick L Vinyard Jr, and Thomas Berger were involved with this code too. There's no mention of them in the commit explanation. They're also not CC-ed.
A few trivialities follow. And a question about the license of one of these drivers.
Quoted 37 lines
drivers/hid/Kconfig | 81 +++++ drivers/hid/Makefile | 8 + drivers/hid/hid-core.c | 4 + drivers/hid/hid-g110.c | 789 +++++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-g13.c | 783 ++++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-g15v2.c | 721 +++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-g19.c | 882 ++++++++++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-gcore.c | 398 ++++++++++++++++++++++ drivers/hid/hid-gcore.h | 74 ++++ drivers/hid/hid-gfb.c | 751 +++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-gfb.h | 54 +++ drivers/hid/hid-ids.h | 7 + 12 files changed, 4552 insertions(+) create mode 100644 drivers/hid/hid-g110.c create mode 100644 drivers/hid/hid-g13.c create mode 100644 drivers/hid/hid-g15v2.c create mode 100644 drivers/hid/hid-g19.c create mode 100644 drivers/hid/hid-gcore.c create mode 100644 drivers/hid/hid-gcore.h create mode 100644 drivers/hid/hid-gfb.c create mode 100644 drivers/hid/hid-gfb.hdrivers/hid/Kconfig +7
-0@@ -451,6 +451,87 @@ config LOGIWHEELS_FF - Logitech MOMO/MOMO 2 - Logitech Formula Force EX +config HID_LOGITECH_GSERIES + tristate "Logitech G-Series devices" + depends on HID + depends on USB + select NEW_LEDS + select LEDS_CLASS + help
drivers/hid/Kconfig config LOGIWHEELS_FF · line 470
Quoted 10 lines
drivers/hid/Kconfig +10
-0+ Support for Logitech G-Series devices. + + This option allows you to choose from a list of Logitech G-series devices. + If your keyboard has an LCD display, you will have to enable framebuffer + support (CONFIG_FB) to see it here. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-gcore.
Please indent the help text bit more (ie, add two spaces, like the help texts of the rest of the added entries have).
drivers/hid/Kconfig config LOGIWHEELS_FF · line 483
Quoted 13 lines
drivers/hid/Kconfig +13
-0+ +config LOGITECH_GFB + tristate + depends on HID_LOGITECH_GSERIES + depends on FB + select FB_DEFERRED_IO + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select FB_SYS_FOPS + # select LCD_CLASS_DEVICE + # select BACKLIGHT_CLASS_DEVICE + # select BACKLIGHT_LCD_SUPPORT
Why did you add these comments?
Quoted 54 lines
drivers/hid/Kconfig +51
-0+ +config LOGITECH_G110 + tristate "Logitech G110 keyboard" + depends on HID_LOGITECH_GSERIES + help + Say Y here if you have a Logitech G110 keyboard. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-g110. + +config LOGITECH_G13 + tristate "Logitech G13 keyboard" + depends on HID_LOGITECH_GSERIES + depends on FB + select LOGITECH_GFB + help + Say Y here if you have a Logitech G13 keyboard. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-g13. + +config LOGITECH_G15V2 + tristate "Logitech G15 Version 2 keyboard" + depends on HID_LOGITECH_GSERIES + depends on FB + select LOGITECH_GFB + help + Say Y here if you have a Logitech G15 Version 2 keyboard. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-g15v2. + +config LOGITECH_G19 + tristate "Logitech G19 keyboard" + depends on HID_LOGITECH_GSERIES + depends on FB + select LOGITECH_GFB + help + Say Y here if you have a Logitech G19 keyboard. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-g19. + config HID_MAGICMOUSE tristate "Apple Magic Mouse/Trackpad multi-touch support" depends on HID
[...]
Quoted 24 lines
drivers/hid/hid-g19.c new file +18
-0@@ -0,0 +1,882 @@ +/*************************************************************************** +* Copyright (C) 2010 by Alistair Buxton * +* [email protected] * +* based on hid-g13.c * +* * +* 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 2 of the License, or * +* (at your option) any later version. * +* * +* This driver 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 software. If not see <http://www.gnu.org/licenses/>. * +***************************************************************************/
[...]
drivers/hid/hid-g19.c line 882
Quoted 5 lines
drivers/hid/hid-g19.c new file +5
-0+MODULE_DESCRIPTION ("Logitech G19 HID Driver" ); +MODULE_AUTHOR ("Alistair Buxton ([email protected])" ); +MODULE_AUTHOR ("Thomas Berger ([email protected])" ); +MODULE_AUTHOR ("Ciubotariu Ciprian ([email protected])" ); +MODULE_LICENSE ("GPL v2" );
This means GPL v2 only. The comment header has or later. Which is right?
Thanks,
Paul Bolle
Re: [PATCH] Add drivers for Logitech G110, G13, G15v2 and G19
Quoted 9 lines · On Saturday 21 February 2015 18:21:20 Paul Bolle wrote:
Quoted 8 lines · Ciprian Ciubotariu
New modules:
- hid-gcore - common functions- hid-gfb - framebuffer implementation - hid-g110 - G110 driver - hid-g13 - G13 driver- hid-g15v2 - G15 v2 driver
- hid-g19 - G19 driver
Quoted 7 lines
Quoted 5 lines
Add
Kconfigoptions for each driver, and a main menu option which is responsible for hid-gcore. hid-gfb is only selected when individual drivers need it.Add product IDs to
hid-ids.h, and blacklist them for hid-generic.No Signed-off-by?
I'll make sure to add it on the next PATCH version.
Quoted 4 lines
Apparently Alistair Buxton, Rick L Vinyard Jr, and Thomas Berger were involved with this code too. There's no mention of them in the commit explanation. They're also not CC-ed.
The driver moved around with a lot of people contributing small changes. Some (including myself) chose to add a MODULE_AUTHOR line, but others didn't. While I can list all contributors from the git fork I found, I am sure I won't be able to track those before the git fork.
What is the appropriate follow-up? Add all contributors to MODULE_AUTHOR? Leave them as is? Which ones should be CC'ed?
Quoted 36 lines
A few trivialities follow. And a question about the license of one of these drivers.
Quoted 32 lines
drivers/hid/Kconfig | 81 +++++ drivers/hid/Makefile | 8 + drivers/hid/hid-core.c | 4 + drivers/hid/hid-g110.c | 789 +++++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-g13.c | 783 ++++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-g15v2.c | 721 +++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-g19.c | 882 ++++++++++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-gcore.c | 398 ++++++++++++++++++++++ drivers/hid/hid-gcore.h | 74 ++++ drivers/hid/hid-gfb.c | 751 +++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-gfb.h | 54 +++ drivers/hid/hid-ids.h | 7 + 12 files changed, 4552 insertions(+) create mode 100644 drivers/hid/hid-g110.c create mode 100644 drivers/hid/hid-g13.c create mode 100644 drivers/hid/hid-g15v2.c create mode 100644 drivers/hid/hid-g19.c create mode 100644 drivers/hid/hid-gcore.c create mode 100644 drivers/hid/hid-gcore.h create mode 100644 drivers/hid/hid-gfb.c create mode 100644 drivers/hid/hid-gfb.hdrivers/hid/Kconfig +0
-0@@ -451,6 +451,87 @@ config LOGIWHEELS_FF - Logitech MOMO/MOMO 2 - Logitech Formula Force EX
Quoted 11 lines
Quoted 11 lines
drivers/hid/Kconfig +10
-0+config HID_LOGITECH_GSERIES + tristate "Logitech G-Series devices" + depends on HID + depends on USB + select NEW_LEDS + select LEDS_CLASS + help + Support for Logitech G-Series devices. + + This option allows you to choose from a list of Logitech G-seriesdevices. + If your keyboard has an LCD display, you will have to
enable
Quoted 9 lines
drivers/hid/Kconfig config LOGIWHEELS_FF · line 470
Quoted 6 lines
framebuffer + support (
CONFIG_FB) to see it here.drivers/hid/Kconfig +5
-0+ + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-gcore.Please indent the help text bit more (ie, add two spaces, like the help texts of the rest of the added entries have).
Will do.
Quoted 16 lines
Quoted 4 lines
drivers/hid/Kconfig +3
-0+ +config LOGITECH_GFB + tristatedrivers/hid/Kconfig config LOGIWHEELS_FF · line 483
Quoted 10 lines
drivers/hid/Kconfig +10
-0+ depends on HID_LOGITECH_GSERIES + depends on FB + select FB_DEFERRED_IO + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select FB_SYS_FOPS + # select LCD_CLASS_DEVICE + # select BACKLIGHT_CLASS_DEVICE + # select BACKLIGHT_LCD_SUPPORTWhy did you add these comments?
Leftovers. Thanks for pointing them out.
Quoted 59 lines
Quoted 56 lines
drivers/hid/Kconfig +51
-0+ +config LOGITECH_G110 + tristate "Logitech G110 keyboard" + depends on HID_LOGITECH_GSERIES + help + Say Y here if you have a Logitech G110 keyboard. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-g110. + +config LOGITECH_G13 + tristate "Logitech G13 keyboard" + depends on HID_LOGITECH_GSERIES + depends on FB + select LOGITECH_GFB + help + Say Y here if you have a Logitech G13 keyboard. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-g13. + +config LOGITECH_G15V2 + tristate "Logitech G15 Version 2 keyboard" + depends on HID_LOGITECH_GSERIES + depends on FB + select LOGITECH_GFB + help + Say Y here if you have a Logitech G15 Version 2 keyboard. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-g15v2. + +config LOGITECH_G19 + tristate "Logitech G19 keyboard" + depends on HID_LOGITECH_GSERIES + depends on FB + select LOGITECH_GFB + help + Say Y here if you have a Logitech G19 keyboard. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called hid-g19. + config HID_MAGICMOUSE tristate "Apple Magic Mouse/Trackpad multi-touch support" depends on HID[...]
Quoted 15 lines
Quoted 7 lines
drivers/hid/hid-g19.c new file +1
-0@@ -0,0 +1,882 @@ +/************************************************************************ Quoted 8 lines
*** + * Copyright (C) 2010 by Alistair Buxton *
+ * [email protected] *
+ * based onhid-g13.c*
+ * *
+ * 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 2 of
the License, or * + * (at your option) any later version.
*
Quoted 3 lines
Quoted 3 lines
+ * *
+ * This driver is distributed in the hope that it will be useful, but
* + * WITHOUT ANY WARRANTY; without even the implied warranty of
*
Quoted 10 lines
Quoted 8 lines
+ * 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 software. If not see
<http://www.gnu.org/licenses/>. * +
*************************************************************************
**/[...]
Quoted 8 lines
drivers/hid/hid-g19.c line 882
Quoted 5 lines
drivers/hid/hid-g19.c new file +5
-0+MODULE_DESCRIPTION ("Logitech G19 HID Driver" ); +MODULE_AUTHOR ("Alistair Buxton ([email protected])" ); +MODULE_AUTHOR ("Thomas Berger ([email protected])" ); +MODULE_AUTHOR ("Ciubotariu Ciprian ([email protected])" ); +MODULE_LICENSE ("GPL v2" );This means GPL v2 only. The comment header has or later. Which is right?
I have contacted the author of that change, and he reverted the line to MODULE_LICENSE("GPL").
https://github.com/CMoH/lg4l/commit/957cfd1e17b55dea4bcd4ec70fb4e53ebd52d149
Quoted 10 lines
Thanks,
Paul Bolle
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Add drivers for Logitech G110, G13, G15v2 and G19
Quoted 5 lines · Ciprian Ciubotariu
Quoted 3 lines · On Saturday 21 February 2015 18:21:20 Paul Bolle wrote:
Apparently Alistair Buxton, Rick L Vinyard Jr, and Thomas Berger were involved with this code too. There's no mention of them in the commit explanation. They're also not CC-ed.
Quoted 7 lines
The driver moved around with a lot of people contributing small changes. Some (including myself) chose to add a
MODULE_AUTHORline, but others didn't. While I can list all contributors from the git fork I found, I am sure I won't be able to track those before the git fork.What is the appropriate follow-up? Add all contributors to
MODULE_AUTHOR? Leave them as is? Which ones should be CC'ed?
It depends, I think, on what Jiri is comfortable with for the HID tree. And I can't read Jiri's mind.
Personally I would add a line or two to the commit explanation detailing how this patch ended up in your tree. And CC-ing the people previously working on this patch will cost you next to nothing, so I'd do that too.
Paul Bolle
Quoted 9 lines · On Sat, 21 February 2015 Ciprian Ciubotariu <[email protected]> wrote:
Hi. Only now I realized you wrote some instructions. Below are my (quite lengthy) responses.
Quoted 3 lines · On Thursday 19 February 2015 10:48:27 Bruno Prémont wrote:
Hi Ciprian,
Adding linux-input and Jiri (HID maintainer) to CC.
Should I register myself on the linux-input mailing list as well?
That's up to you, though it would help catching possibly relevant threads affecting input devices or (later) Logitech devices you care about.
Quoted 7 lines
Quoted 4 lines · On Sun, 15 Feb 2015 23:17:27 +0200 Ciprian Ciubotariu wrote:
Did you check for older work on Logitech keyboards that has been proposed on linux-input list some time ago and what is currently present in Linus' tree?
Yes, I have checked the tree. The mailing list archives recorded some related activity in 2010, but no patches were applied to the kernel tree.
Reviewing the work that happened back then and at least considering the comments made at that time will help you get the code into a better shape.
That's about the time when I wrote picolcd driver, using the proposed Logitech driver as a starting point.
Quoted 23 lines
Quoted 3 lines
An overview of the features covered by the drivers would help understand what the new drivers add (and the differences between all the covered keyboard variants).
I. From the user perspective, all G-series keyboards have
(1) A set of "macro" keys and a set of support keys (macro set selection,
menu navigation and such).(2) Some devices present an LCD, which is either monochrome or color.
(3) All have LEDs that allow changing the (3a) keyboard illumination
intensity and color, (3b) the backlight of the macro set selection keys, as well (3c) as the backlight of the LCD.II. Hardware
The hardware presents these extra keys on a separate USB device. G110 and G19 use a separate endpoint for some of the keys, while other models use just HID reports. All seem to use a custom bit-flag format to report the key status, but I am not a HID expert - maybe it is standard. However, all these keys are dead without these drivers.
Quoted 7 lines
The LEDs are controlled via hid reports, but the calculus of the fields differs on some models (G110 needs some weird maths).
The LCD framebuffer can be written to via USB interrupt/bulk endpoints depending on the model.
hid-gfb.cimplements the LCD matrix via the kernel's FB API. The LCD backlight can only be controlled independently on G19, and is mapped to LED devices by hid-g19.
This is rather important information for explaining your choice of splitting up the code.
You may want to extend this, eventually putting it into a file under Documentation/
Giving a clear overview of how the various features are presented on USB/HID side for each driver definitely helps.
This should also help you decide if unification is reasonable or just requires too much glue-code to translate different HW implementations.
Quoted 13 lines
III. Driver code
<snip>
Quoted 5 lines
If you would like to get the drivers merged please create patches against upstream tree, eventually starting with support for the keyboard you own, adding support for the other keyboards in separate patches.
You could also split your patch based on feature support.While I am typing on the G19 right now, I have only tested G110, G13, G15v2 and they seem stable. I lack the G15 model, and G510 is not yet working.
Quoted 7 lines
To summarize, this submission is about devices g110, g13, g15v2 and g19, all tested by me and working.
I have prepared a patch for the kernel tree, rebased into a single commit. I can split it per-device, but I don't know how to split the changes to
Kconfig,hid-ids.handhid-core.cso that each patch can be applied independently (because the changes would overlap).
Splitting per-device is one way. More interesting for review would be splitting by feature:
- base input driver handling the "dead" keys
- adding LEDs
- adding LCD fb/backlight
- adding other goodies
Proposing the patches in a series where later patches depend on previous ones is the normal way of operating.
Quoted 3 lines
The
Kconfigmade me wonder if I should (a) activate the dependent code in the kernel (for instance the FB orLEDS_CLASSetc), or (b) deactivate the feature from the driver and advise users in the help text.
For those wanting to trip down their kernels in size having the option to reduce feature set via Kconfig options is welcome.
If you select dependencies (you can only properly do so when selecting config options that have no dependencies) or have your options show up/default on them is up to you.
Quoted 9 lines
Quoted 2 lines
It might be worth exploring the option to organize the driver(s) as a MFD (multi-function-device) device.
I have looked at the list of MFD devices with make menuconfig, but I have not seen any input devices there. Perhaps a radio, and mostly PMICs of various sorts.
These are rather HID input devices with some extra custom goodies (extra keys, LEDs and LCDs). The implementation is also based on the HID bus.
If I had to redo picolcd driver now I would give MFD a try. When I have enough time to do so I may very well convert it driver.
The big advantage I see in MFD drivers is that the separate functions can live in their respective areas in kernel code tree so they don't get skipped when core/class code get API changes.
Bruno
--
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
Quoted 55 lines · On Saturday 21 February 2015 22:57:28 Bruno Prémont wrote:
Quoted 7 lines · On Sat, 21 February 2015 Ciprian Ciubotariu <[email protected]> wrote:
Quoted 4 lines · On Sun, 15 Feb 2015 23:17:27 +0200 Ciprian Ciubotariu wrote:
Did you check for older work on Logitech keyboards that has been proposed on linux-input list some time ago and what is currently present in Linus' tree?
Yes, I have checked the tree. The mailing list archives recorded some related activity in 2010, but no patches were applied to the kernel tree.
Reviewing the work that happened back then and at least considering the comments made at that time will help you get the code into a better shape.
That's about the time when I wrote picolcd driver, using the proposed Logitech driver as a starting point.
Quoted 27 lines
Quoted 3 lines
An overview of the features covered by the drivers would help understand what the new drivers add (and the differences between all the covered keyboard variants).
I. From the user perspective, all G-series keyboards have
(1) A set of "macro" keys and a set of support keys (macro set selection,
menu navigation and such).
(2) Some devices present an LCD, which is either monochrome or color.
(3) All have LEDs that allow changing the (3a) keyboard illumination
intensity and color, (3b) the backlight of the macro set selection keys, as
well (3c) as the backlight of the LCD.II. Hardware
The hardware presents these extra keys on a separate USB device. G110 and G19 use a separate endpoint for some of the keys, while other models use just HID reports. All seem to use a custom bit-flag format to report the key status, but I am not a HID expert - maybe it is standard. However, all these keys are dead without these drivers.
Quoted 7 lines
The LEDs are controlled via hid reports, but the calculus of the fields differs on some models (G110 needs some weird maths).
The LCD framebuffer can be written to via USB interrupt/bulk endpoints depending on the model.
hid-gfb.cimplements the LCD matrix via the kernel's FB API. The LCD backlight can only be controlled independently on G19, and is mapped to LED devices by hid-g19.This is rather important information for explaining your choice of splitting up the code.
You may want to extend this, eventually putting it into a file underDocumentation/
Quoted 5 lines
Giving a clear overview of how the various features are presented on USB/HID side for each driver definitely helps.
This should also help you decide if unification is reasonable or just requires too much glue-code to translate different HW implementations.
I'll transcribe this to a file.
Quoted 30 lines
Quoted 15 lines
III. Driver code
<snip>
Quoted 5 lines
If you would like to get the drivers merged please create patches against upstream tree, eventually starting with support for the keyboard you own, adding support for the other keyboards in separate patches.
You could also split your patch based on feature support.While I am typing on the G19 right now, I have only tested G110, G13, G15v2
and they seem stable. I lack the G15 model, and G510 is not yet working.Quoted 7 lines
To summarize, this submission is about devices g110, g13, g15v2 and g19, all tested by me and working.
I have prepared a patch for the kernel tree, rebased into a single commit. I can split it per-device, but I don't know how to split the changes to
Kconfig,hid-ids.handhid-core.cso that each patch can be applied independently (because the changes would overlap).Splitting per-device is one way. More interesting for review would be splitting by feature:
- base input driver handling the "dead" keys
- adding LEDs
- adding LCD fb/backlight
- adding other goodies
Quoted 2 lines
Proposing the patches in a series where later patches depend on previous ones is the normal way of operating.
This would require simulating such a path to the current state of the code. In reality I inherited the code with all the features, fixed the bugs and refactored it for submission here.
However, see discussion below on the MFD issue. Performing this separation might make the code quite readable, even as a single patch.
Quoted 21 lines
Quoted 4 lines
The
Kconfigmade me wonder if I should (a) activate the dependent code in the kernel (for instance the FB orLEDS_CLASSetc), or (b) deactivate the feature from the driver and advise users in the help text.For those wanting to trip down their kernels in size having the option to reduce feature set via
Kconfigoptions is welcome.
If you select dependencies (you can only properly do so when selecting config options that have no dependencies) or have your options show up/default on them is up to you.Quoted 9 lines
Quoted 2 lines
It might be worth exploring the option to organize the driver(s) as a MFD (multi-function-device) device.
I have looked at the list of MFD devices with make menuconfig, but I have not seen any input devices there. Perhaps a radio, and mostly PMICs of various sorts.
These are rather HID input devices with some extra custom goodies (extra keys, LEDs and LCDs). The implementation is also based on the HID bus.
Quoted 6 lines
If I had to redo picolcd driver now I would give MFD a try. When I have enough time to do so I may very well convert it driver.
The big advantage I see in MFD drivers is that the separate functions can live in their respective areas in kernel code tree so they don't get skipped when core/class code get API changes.
I see. I can change the driver so that hid-gfb is in drivers/video/fbdev. The LEDs vs. input parts are harder to separate, but I can see a hid-gleds.c in drivers/leds. Both of them would be hidden though, and used as support code from the main driver(s).
However, I cannot follow the reasons to put the main HID driver into drivers/mfd. Wouldn't picolcd break kernel builds if it wouldn't be updated on core/class API changes? Also, the keyboard device presents itself fully functional, as opposed to a PMIC where hardware connectivity determines which features are actually usable.
I also got clarified on how to implement the LCD_BACKLIGHT part for the G19. Thanks for pointing me towards picolcd.
The only question is... do I do all this on my github repository as an out-of- tree module? And next after a while I come back to LKML with a new version?
Or do I try to clean the patch for the drivers in this shape and continue on directly on the kernel tree?
How should I proceed?
Thanks,
Ciprian
Quoted 8 lines
Bruno
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/