Don't populate the const array led_names on the stack but instead make
it static. Makes the object code smaller by 79 bytes:
Before:
text data bss dec hex filename
19686 7952 256 27894 6cf6 drivers/hid/hid-lg-g15.o
After:
text data bss dec hex filename
19543 8016 256 27815 6ca7 drivers/hid/hid-lg-g15.o
(gcc version 10.2.0)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The Logitech G11 keyboard is a cheap variant of the G15 without the LCD
screen. It uses the same layout for its extra and macro keys (G1 - G18,
M1-M3, MR) and - from the input subsystem's perspective - behaves just
like the G15, so we can treat it as such.
Tested it with my own keyboard.
Signed-off-by: Fabian Schindlatz <fabian.schindlatz@fau.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
By default the G1-G12 keys on the Logitech gaming keyboards send
F1 - F12 when in "generic HID" mode.
The first thing the hid-lg-g15 driver does is disable this behavior.
We have received a bugreport that this does not work when the keyboard
is connected through an Aten KVM switch. Using a gaming keyboard with
a KVM is a bit weird setup, but still we can try to fail a bit more
gracefully here.
On the G510 keyboards the same USB-interface which is used for the gaming
keys is also used for the media-keys. Before this commit we would call
hid_hw_stop() on failure to disable the F# emulation and then exit the
probe method with an error code.
This not only causes us to not handle the gaming-keys, but this also
breaks the media keys which is a regression compared to the situation
when these keyboards where handled by the generic hidinput driver.
This commit changes the error handling to clear the hiddev drvdata
(to disable our .raw_event handler) and then returning from the probe
method with success.
The net result of this is that, when connected through a KVM, things
work as well as they did before the hid-lg-g15 driver was introduced.
Fixes: ad4203f5a2 ("HID: lg-g15: Add support for the G510 keyboards' gaming keys")
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1806321
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Add support for controlling the LEDs below the M1-M3 and MR keys
on the G510.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Note that the keyboard has a backlight on/off toggle button. If the
backlight is turned off through that button, then any changes we make
will be ignored and we cannot turn it back on again from the host.
To workaround this we write the last set RGB values when we receive an
event indicating that the backlight has been turned on again.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Add support for the gaming and LCD menu keys on the G510 keyboard.
Note this commit does not add support for the keyboard and LCD backlight
and the status LEDs, this is done in a follow up commit.
Note the G510 generates 4 different input reports on its second
(Consumer Keys) interface:
-input report 1 is standard bootclass keyboard input report, mirroring
normal keyboard interface
-input report 2 is consumer page keys
-input report 3 is gkeys, etc.
-input report 4 is LED status, single byte, bits:
bit 2: kbd and LCD backlight is *off* when set, toggled by the light key
bit 3: headphone mute LED
bit 4: mic mute LED
Input-report 1 we ignore since this is a duplicate report from the first
interface, report 2 is handled by the regular hid-input code. In this
commit we add handling for input report 3.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Add support for controlling the LEDs below the M1-M3 and MR keys.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Register a led_classdev for the keyboard backlight and another one for
the LCD backlight.
This commit also includes LED_BRIGHT_HW_CHANGED support, which together
with a desktop-environment which supports this, such as GNOME3 leads to
the kbd-backlight OSD being show with the new level when changing the
backlight setting through the hotkey on the keyboard.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Add a driver to stop the extra "G" keys from sending F1 - F12 instead
making them send KEY_GKEY# and also make the non-functional M1 - M3 and MR
keys and the non-functional buttons below the LCD panel properly generated
key events.
Note the connect_mask and gkeys_settings_output_report variables may seem
unnecessary since they are always set to the same value, these are there in
preparation of adding support for the G, M and LCD keys on the G510 kbd.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>