HID: ayaneo-flip-kb: Add driver for keyboard backlight
PATCH 1/1 HID: ayaneo-flip-kb: Add driver for keyboard backlight
The AYANEO Flip KB has a built-in SiGma Micro USB keyboard (1c4f:007c) with two HID interfaces: a boot keyboard and a vendor-defined one that carries an 8-byte Feature Report (ID 0x41) controlling the RGB backlight. hid-generic binds both, and the backlight is not exposed to the OS.
Add a driver that exposes the backlight as a multicolor LED class device, ayaneo:rgb:kbd_backlight. The report layout was determined by experiments on real hardware:
byte 1-3: blue, red, green
byte 4: firmware effect select (1 = static; 2 and 3 select
rainbow and breathing, which are not used here)
byte 5: 0 = off, 1 = on
byte 6-7: constants 0x41, 0x5a
There is no separate brightness field, so brightness is applied by scaling the color bytes. GetFeature does not reflect the current state and is not used.
Turning the backlight off keeps sending the configured color with mode=off rather than all zeroes, so that the keyboard's own Fn+Space toggle keeps working afterwards. The LED is marked LED_RETAIN_AT_SHUTDOWN so unbinding the driver does not blank it.
Both interfaces are bound to this driver so hid-generic stays away; the boot keyboard interface is started unchanged.
Tested on an AYANEO Flip KB: color and brightness changes through sysfs and UPower, Fn+Space toggling, behavior after reboot, and a third-party LED client (HueSync).
--- drivers/hid/Kconfig | 12 +++ drivers/hid/Makefile | 1 + drivers/hid/hid-ayaneo-flip-kb.c | 171 +++++++++++++++++++++++++++++++ drivers/hid/hid-ids.h | 1 + 4 files changed, 185 insertions(+) create mode 100644 drivers/hid/hid-ayaneo-flip-kb.c
drivers/hid/Kconfig +12 -0
@@ -205,6 +205,18 @@ config HID_AUREAL help Support for Aureal Cy se W-01RN Remote Controller and other Aureal derived remotes. +config HID_AYANEO_FLIP_KB + tristate "AYANEO Flip KB keyboard backlight" + depends on USB_HID + depends on LEDS_CLASS_MULTICOLOR + help + Support for the RGB backlight of the AYANEO Flip KB's built-in + keyboard. The backlight is exposed as a multicolor LED class + device. + + To compile this driver as a module, choose M here: the + module will be called hid-ayaneo-flip-kb. + config HID_BELKIN tristate "Belkin Flip KVM and Wireless keyboard" help
drivers/hid/Makefile +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_HID_APPLETB_KBD) += hid-appletb-kbd.o obj-$(CONFIG_HID_CREATIVE_SB0540) += hid-creative-sb0540.o obj-$(CONFIG_HID_ASUS) += hid-asus.o obj-$(CONFIG_HID_AUREAL) += hid-aureal.o +obj-$(CONFIG_HID_AYANEO_FLIP_KB) += hid-ayaneo-flip-kb.o obj-$(CONFIG_HID_BELKIN) += hid-belkin.o obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o obj-$(CONFIG_HID_BIGBEN_FF) += hid-bigbenff.o
drivers/hid/hid-ayaneo-flip-kb.c new file +171 -0
171 lines not on this page · raw message
drivers/hid/hid-ids.h +1 -0
@@ -1309,6 +1309,7 @@#define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD 0x0002#define USB_DEVICE_ID_SIGMA_MICRO_USB_MOUSE 0x0034#define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD2 0x0059 +#define USB_DEVICE_ID_SIGMA_MICRO_AYANEO_FLIP_KB 0x007c#define USB_VENDOR_ID_SIGMATEL 0x066F#define USB_DEVICE_ID_SIGMATEL_STMP3780 0x3780
Signature · 1 line
2.54.0 (Apple Git-157)
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] HID: ayaneo-flip-kb: spurious error log in flip_kb_probe() - [Low] HID: ayaneo-flip-kb: missing…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Low] HID: ayaneo-flip-kb: spurious error log in flip_kb_probe()
- [Low] HID: ayaneo-flip-kb: missing HID_CONNECT_DRIVER in flip_kb_probe()
--
commit 9c851b9f20ca56279eed558bac4b9d796257c299
Author: Hijae Song <[email protected]>
HID: ayaneo-flip-kb: Add driver for keyboard backlight
This commit adds a HID driver exposing the RGB keyboard backlight of the AYANEO Flip KB as a multicolor LED class device.
Quoted 5 lines
drivers/hid/hid-ayaneo-flip-kb.c new file +0
-0
[ ... ]
Quoted 7 lines
drivers/hid/hid-ayaneo-flip-kb.c new file +7
-0+static int flip_kb_probe (struct hid_device *hdev,const struct hid_device_id *id) +{ +struct flip_kb *kb; +int ret, i; + + ret =hid_parse (hdev); +if (ret)
drivers/hid/hid-ayaneo-flip-kb.c line 109
Quoted 10 lines
drivers/hid/hid-ayaneo-flip-kb.c new file +10
-0+return ret; + +/* +* Both interfaces match this driver, which keeps hid-generic from +* binding to them, so the boot keyboard interface must be started +* normally and left alone. +*/ +if (!hid_validate_values (hdev,HID_FEATURE_REPORT ,FLIP_KB_REPORT_ID , +0 ,1 )) +return hid_hw_start (hdev,HID_CONNECT_DEFAULT );
[Severity: Low]
Does calling hid_validate_values() here log a spurious error every time the boot keyboard interface is probed?
hid_validate_values() logs hid_err(hid, "missing %s %u\n", ...) whenever the requested report ID is absent, so probing the boot keyboard interface always emits a false error message. Also, if the vendor interface has a malformed report 0x41 descriptor, hid_validate_values() returns NULL and causes flip_kb_probe() to treat it as the boot keyboard interface instead of failing probe.
Quoted 15 lines
drivers/hid/hid-ayaneo-flip-kb.c new file +15
-0+ + kb =devm_kzalloc (&hdev->dev,sizeof (*kb),GFP_KERNEL ); +if (!kb) +return -ENOMEM ; + + kb->hdev = hdev; +hid_set_drvdata (hdev, kb); + + kb->subled[0 ].color_index =LED_COLOR_ID_RED ; + kb->subled[1 ].color_index =LED_COLOR_ID_GREEN ; + kb->subled[2 ].color_index =LED_COLOR_ID_BLUE ; +for (i =0 ; i <3 ; i++) + kb->subled[i].intensity =255 ; + + kb->mc_led.subled_info = kb->subled;
drivers/hid/hid-ayaneo-flip-kb.c line 134
Quoted 10 lines
drivers/hid/hid-ayaneo-flip-kb.c new file +10
-0+ kb->mc_led.num_colors =3 ; + kb->mc_led.led_cdev.name ="ayaneo:rgb:" LED_FUNCTION_KBD_BACKLIGHT ; + kb->mc_led.led_cdev.max_brightness =255 ; +/* Keep the backlight lit across driver unbind instead of blanking it. */ + kb->mc_led.led_cdev.flags =LED_RETAIN_AT_SHUTDOWN ; + kb->mc_led.led_cdev.brightness_set_blocking = flip_kb_brightness_set; + + ret =hid_hw_start (hdev,HID_CONNECT_DEFAULT ); +if (ret) +return ret;
[Severity: Low]
Will hid_hw_start() fail with -ENODEV on the backlight interface when both CONFIG_HIDRAW and CONFIG_USB_HIDDEV are disabled?
Because the vendor-defined interface has no input application usages and flip_kb_driver has no .raw_event callback, hid_connect() finds hdev->claimed == 0 when hidraw and hiddev are disabled and returns -ENODEV ("device has no listeners, quitting"), preventing the LED device from registering. Passing HID_CONNECT_DEFAULT | HID_CONNECT_DRIVER (or HID_CONNECT_DRIVER) marks the interface claimed by the driver.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 26 lines · Hijae Song
The AYANEO Flip KB has a built-in SiGma Micro USB keyboard (1c4f:007c) with two HID interfaces: a boot keyboard and a vendor-defined one that carries an 8-byte Feature Report (ID
0x41) controlling the RGB backlight. hid-generic binds both, and the backlight is not exposed to the OS.Add a driver that exposes the backlight as a multicolor LED class device, ayaneo:rgb:kbd_backlight. The report layout was determined by experiments on real hardware:
byte 1-3: blue, red, green
byte 4: firmware effect select (1 = static; 2 and 3 select
rainbow and breathing, which are not used here)
byte 5: 0 = off, 1 = on
byte 6-7: constants0x41,0x5aThere is no separate brightness field, so brightness is applied by scaling the color bytes. GetFeature does not reflect the current state and is not used.
Turning the backlight off keeps sending the configured color with mode=off rather than all zeroes, so that the keyboard's own Fn+Space toggle keeps working afterwards. The LED is marked
LED_RETAIN_AT_SHUTDOWNso unbinding the driver does not blank it.
Quoted 6 lines
Both interfaces are bound to this driver so hid-generic stays away; the boot keyboard interface is started unchanged.
Tested on an AYANEO Flip KB: color and brightness changes through sysfs and UPower, Fn+Space toggling, behavior after reboot, and a third-party LED client (HueSync).
Hi,
I do not have the bandwidth to review this driver, but I will leave some broad strokes feedback.
The name of the driver cannot be -flip-kb. You need to make sure it is generic enough to match most Ayaneo devices. There are 4 flip devices if I recall. Adding a driver for a single one is a tough sell. Also this does not control the joysticks LEDs, so naming it ayaneo flip kb is not appropriate. It is a niche device line, they do not sell a lot of units and the form factor is not what most users prefer.
If this is an actual keyboard product on the market and Ayaneo is sourcing the part for their device (it seems so, SiGma Micro appears to make keyboard ICs), look-up similar devices and kernel drivers. One might exist already. If not, and provided that Ayaneo did not modify the backlight protocol, rename the driver appropriately to sigma something, move it to the appropriate location if there is one, such as the led subsystem, and match other backlight driver conventions.
Provided the latter is the case and we can make a Sigma micro driver, I will also try to review the driver, as it is more valuable than just Ayaneo Flip devices
Best,
Antheas
Quoted 237 lines
Signed-off-by Hijae Song <[email protected]>--- drivers/hid/Kconfig | 12 +++ drivers/hid/Makefile | 1 + drivers/hid/hid-ayaneo-flip-kb.c | 171 +++++++++++++++++++++++++++++++ drivers/hid/hid-ids.h | 1 + 4 files changed, 185 insertions(+) create mode 100644 drivers/hid/hid-ayaneo-flip-kb.cdrivers/hid/Kconfig +12
-0@@ -205,6 +205,18 @@ config HID_AUREAL help Support for Aureal Cy se W-01RN Remote Controller and other Aureal derived remotes. +config HID_AYANEO_FLIP_KB + tristate "AYANEO Flip KB keyboard backlight" + depends on USB_HID + depends on LEDS_CLASS_MULTICOLOR + help + Support for the RGB backlight of the AYANEO Flip KB's built-in + keyboard. The backlight is exposed as a multicolor LED class + device. + + To compile this driver as a module, choose M here: the + module will be called hid-ayaneo-flip-kb. + config HID_BELKIN tristate "Belkin Flip KVM and Wireless keyboard" helpdrivers/hid/Makefile +1
-0@@ -35,6 +35,7 @@ obj-$(CONFIG_HID_APPLETB_KBD) += hid-appletb-kbd.o obj-$(CONFIG_HID_CREATIVE_SB0540) += hid-creative-sb0540.o obj-$(CONFIG_HID_ASUS) += hid-asus.o obj-$(CONFIG_HID_AUREAL) += hid-aureal.o +obj-$(CONFIG_HID_AYANEO_FLIP_KB) += hid-ayaneo-flip-kb.o obj-$(CONFIG_HID_BELKIN) += hid-belkin.o obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o obj-$(CONFIG_HID_BIGBEN_FF) += hid-bigbenff.odrivers/hid/hid-ayaneo-flip-kb.c new file +171
-0@@ -0,0 +1,171 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* HID driver for the AYANEO Flip KB's built-in keyboard backlight +* +* The keyboard enumerates as a SiGma Micro USB HID device with two +* interfaces: a plain boot keyboard and a vendor-defined one carrying a +* Feature Report (ID 0x41) that controls the RGB backlight. The layout +* of that report was determined by testing on real hardware: +* +* byte 0: report ID (0x41) +* byte 1: blue +* byte 2: red +* byte 3: green +* byte 4: firmware effect select (0 = keep previous report, 1 = static +* color, 2 = rainbow cycle, 3 = breathing, other tested values +* behave like 1); this driver only ever asks for static color +* byte 5: mode, 0 = off, 1 = on (other tested values behave like 1) +* byte 6: fixed 0x41 +* byte 7: fixed 0x5a +* +* Copyright (c) 2026 Hijae Song +*/ + +#include <linux/cleanup.h> +#include <linux/hid.h> +#include <linux/led-class-multicolor.h> +#include <linux/leds.h> +#include <linux/module.h> +#include <linux/slab.h> + +#include "hid-ids.h" + +#define FLIP_KB_REPORT_ID 0x41 +#define FLIP_KB_REPORT_SIZE 8 +#define FLIP_KB_MODE_OFF 0 +#define FLIP_KB_MODE_STATIC 1 +#define FLIP_KB_EFFECT_STATIC 1 + +struct flip_kb { +struct hid_device *hdev; +struct led_classdev_mc mc_led; +struct mc_subled subled[3 ]; +}; + +static int flip_kb_send (struct hid_device *hdev,u8 r,u8 g,u8 b,u8 mode) +{ + u8 *buf __free(kfree) = kzalloc(FLIP_KB_REPORT_SIZE, GFP_KERNEL); +int ret; + +if (!buf) +return -ENOMEM ; + + buf[0 ] =FLIP_KB_REPORT_ID ; + buf[1 ] = b; + buf[2 ] = r; + buf[3 ] = g; + buf[4 ] =FLIP_KB_EFFECT_STATIC ; + buf[5 ] = mode; + buf[6 ] =0x41 ; + buf[7 ] =0x5a ; + + ret =hid_hw_raw_request (hdev,FLIP_KB_REPORT_ID , buf, +FLIP_KB_REPORT_SIZE ,HID_FEATURE_REPORT , +HID_REQ_SET_REPORT ); +return ret <0 ? ret :0 ; +} + +static int flip_kb_brightness_set (struct led_classdev *led_cdev, +enum led_brightness brightness) +{ +struct led_classdev_mc *mc_led =lcdev_to_mccdev (led_cdev); + struct flip_kb *kb = container_of(mc_led, struct flip_kb, mc_led); + +if (brightness) { +led_mc_calc_color_components (mc_led, brightness); +return flip_kb_send (kb->hdev, kb->subled[0 ].brightness, + kb->subled[1 ].brightness, kb->subled[2 ].brightness, +FLIP_KB_MODE_STATIC ); + } + +/* +* An all-zero color combined with mode=off makes the keyboard's +* own Fn+Space toggle stop responding until a non-zero report is +* sent again. mode=off already blanks the backlight regardless of +* the color bytes, so send the configured intensities unscaled +* instead of collapsing them to zero. +*/ +return flip_kb_send (kb->hdev, kb->subled[0 ].intensity, + kb->subled[1 ].intensity, kb->subled[2 ].intensity, +FLIP_KB_MODE_OFF ); +} + +static int flip_kb_probe (struct hid_device *hdev,const struct hid_device_id *id) +{ +struct flip_kb *kb; +int ret, i; + + ret =hid_parse (hdev); +if (ret) +return ret; + +/* +* Both interfaces match this driver, which keeps hid-generic from +* binding to them, so the boot keyboard interface must be started +* normally and left alone. +*/ +if (!hid_validate_values (hdev,HID_FEATURE_REPORT ,FLIP_KB_REPORT_ID , +0 ,1 )) +return hid_hw_start (hdev,HID_CONNECT_DEFAULT ); + + kb =devm_kzalloc (&hdev->dev,sizeof (*kb),GFP_KERNEL ); +if (!kb) +return -ENOMEM ; + + kb->hdev = hdev; +hid_set_drvdata (hdev, kb); + + kb->subled[0 ].color_index =LED_COLOR_ID_RED ; + kb->subled[1 ].color_index =LED_COLOR_ID_GREEN ; + kb->subled[2 ].color_index =LED_COLOR_ID_BLUE ; +for (i =0 ; i <3 ; i++) + kb->subled[i].intensity =255 ; + + kb->mc_led.subled_info = kb->subled; + kb->mc_led.num_colors =3 ; + kb->mc_led.led_cdev.name ="ayaneo:rgb:" LED_FUNCTION_KBD_BACKLIGHT ; + kb->mc_led.led_cdev.max_brightness =255 ; +/* Keep the backlight lit across driver unbind instead of blanking it. */ + kb->mc_led.led_cdev.flags =LED_RETAIN_AT_SHUTDOWN ; + kb->mc_led.led_cdev.brightness_set_blocking = flip_kb_brightness_set; + + ret =hid_hw_start (hdev,HID_CONNECT_DEFAULT ); +if (ret) +return ret; + + ret =led_classdev_multicolor_register (&hdev->dev, &kb->mc_led); +if (ret) +hid_hw_stop (hdev); + +return ret; +} + +static void flip_kb_remove (struct hid_device *hdev) +{ +struct flip_kb *kb =hid_get_drvdata (hdev); + +/* Unregister the LED before the transport goes away. */ +if (kb) +led_classdev_multicolor_unregister (&kb->mc_led); + +hid_hw_stop (hdev); +} + +static const struct hid_device_id flip_kb_devices[] = { + {HID_USB_DEVICE (USB_VENDOR_ID_SIGMA_MICRO , +USB_DEVICE_ID_SIGMA_MICRO_AYANEO_FLIP_KB ) }, + { } +}; +MODULE_DEVICE_TABLE (hid, flip_kb_devices); + +static struct hid_driver flip_kb_driver = { + .name ="ayaneo-flip-kb" , + .id_table = flip_kb_devices, + .probe = flip_kb_probe, + .remove = flip_kb_remove, +}; +module_hid_driver (flip_kb_driver); + +MODULE_AUTHOR ("Hijae Song <[email protected]>" ); +MODULE_DESCRIPTION ("HID driver for the AYANEO Flip KB keyboard backlight" ); +MODULE_LICENSE ("GPL" );drivers/hid/hid-ids.h +1
-1@@ -1309,6 +1309,7 @@#define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD 0x0002#define USB_DEVICE_ID_SIGMA_MICRO_USB_MOUSE 0x0034#define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD2 0x0059 +#define USB_DEVICE_ID_SIGMA_MICRO_AYANEO_FLIP_KB 0x007c#define USB_VENDOR_ID_SIGMATEL 0x066F#define USB_DEVICE_ID_SIGMATEL_STMP3780 0x3780 --2.54.0 (Apple Git-157)
Hi Antheas,
Thanks for the feedback.
Quoted 3 lines
If this is an actual keyboard product on the market and Ayaneo is sourcing the part for their device, look-up similar devices and kernel drivers.
I checked. hid-sigmamicro only fixes the 0x0059 report descriptor, and I found no SiGma Micro backlight driver on lore.
Quoted 2 lines
The name of the driver cannot be -flip-kb. You need to make sure it is generic enough to match most Ayaneo devices.
1c4f:007c also appears on the AYANEO Slide in hhd-dev/hwinfo, with the same vendor interface (report ID 0x41, 7-byte feature report). I only have a Flip KB, so I can only test the byte layout there.
Matias's hid-ayaneo already claims 1c4f:0002 behind a DMI check for AYANEO 3. Would you prefer that I add 007c backlight support to hid-ayaneo once it is merged, or keep a separate driver named after the chip? I lean towards hid-ayaneo, since the Slide may work the same way, but I would like your view first.
I will also fix the two sashiko comments in v2.
Thanks,
Hijae
Quoted 19 lines · Hijae Song
Hi Antheas,
Thanks for the feedback.
Quoted 3 lines
If this is an actual keyboard product on the market and Ayaneo is sourcing the part for their device, look-up similar devices and kernel drivers.
I checked. hid-sigmamicro only fixes the
0x0059report descriptor, and I found no SiGma Micro backlight driver on lore.Quoted 2 lines
The name of the driver cannot be -flip-kb. You need to make sure it is generic enough to match most Ayaneo devices.
1c4f:007c also appears on the AYANEO Slide in hhd-dev/hwinfo, with the same vendor interface (report ID
0x41, 7-byte feature report). I only have a Flip KB, so I can only test the byte layout there.
Quoted 5 lines
Matias's hid-ayaneo already claims 1c4f:0002 behind a DMI check for AYANEO 3. Would you prefer that I add 007c backlight support to hid-ayaneo once it is merged, or keep a separate driver named after the chip? I lean towards hid-ayaneo, since the Slide may work the same way, but I would like your view first.
Mmmm so Ayaneo does not have a vid and may trample the pid of another device. That is not good. There is no guarantee this led profile is used by a different vendor.
There are two options:
- Adding the keyboard to the hid-ayaneo driver
- This would happen after it merges
- There is 0 common logic between the rgb device and the keyboard device
- Driver registers a different led sysfs ABI and has convoluted
dmi handling
- The driver would devolve
- Adding a scoped driver for the keyboard
- You can start now
- Can tightly scope to keyboard device
- name can be hid-ayaneo-kbd unless other vendor is found
I would tend towards the latter. hid-ayaneo has plenty of work to merge. The controller firmware is quite unstable. Even my implementation in userspace is buggy. But that's fine... Windows is buggy too.
I have two comments for your current version:
- remove all flip kbd references, name AYANEO_KBD
- use brightness values of 0 and 1, no scaling. DEs know how to
handle these values by toggling.
- another option is 0-3, which looks nicer, but let's not get too
deep into this
- use devm to register the led structure, drop remove entry point.
Use devm prior to starting the device so that register code stays with initialization
- check if led subsystem is appropriate. I am not sure of the
correct place. If not, current location is fine
- initialize host values to ff ff ff so on first write we get a nice
white color
- if there is only one effect, brightness 0 is off. Do not add an
effect handler
With 2-3 revisions this should be good to go. While at it, try to find a Slide user
Best,
Antheas
Quoted 5 lines
I will also fix the two sashiko comments in v2.
Thanks,
Hijae
Quoted 48 lines · Antheas Kapenekakis
Quoted 19 lines · Hijae Song
Hi Antheas,
Thanks for the feedback.
Quoted 3 lines
If this is an actual keyboard product on the market and Ayaneo is sourcing the part for their device, look-up similar devices and kernel drivers.
I checked. hid-sigmamicro only fixes the
0x0059report descriptor, and I found no SiGma Micro backlight driver on lore.Quoted 2 lines
The name of the driver cannot be -flip-kb. You need to make sure it is generic enough to match most Ayaneo devices.
1c4f:007c also appears on the AYANEO Slide in hhd-dev/hwinfo, with the same vendor interface (report ID
0x41, 7-byte feature report). I only have a Flip KB, so I can only test the byte layout there.Quoted 5 lines
Matias's hid-ayaneo already claims 1c4f:0002 behind a DMI check for AYANEO 3. Would you prefer that I add 007c backlight support to hid-ayaneo once it is merged, or keep a separate driver named after the chip? I lean towards hid-ayaneo, since the Slide may work the same way, but I would like your view first.
Mmmm so Ayaneo does not have a vid and may trample the pid of another device. That is not good. There is no guarantee this led profile is used by a different vendor.
There are two options:
- Adding the keyboard to the hid-ayaneo driver
- This would happen after it merges
- There is 0 common logic between the rgb device and the keyboard device
- Driver registers a different led sysfs ABI and has convoluted
dmi handling
- The driver would devolve
- Adding a scoped driver for the keyboard
- You can start now
- Can tightly scope to keyboard device
- name can be hid-ayaneo-kbd unless other vendor is foundI would tend towards the latter. hid-ayaneo has plenty of work to merge. The controller firmware is quite unstable. Even my implementation in userspace is buggy. But that's fine... Windows is buggy too.
Quoted 15 lines
I have two comments for your current version:
- remove all flip kbd references, nameAYANEO_KBD
- use brightness values of 0 and 1, no scaling. DEs know how to
handle these values by toggling.
- another option is 0-3, which looks nicer, but let's not get too
deep into this
- use devm to register the led structure, drop remove entry point.
Use devm prior to starting the device so that register code stays with initialization
- check if led subsystem is appropriate. I am not sure of the
correct place. If not, current location is fine
- initialize host values to ff ff ff so on first write we get a nice
white color
- if there is only one effect, brightness 0 is off. Do not add an
effect handler
Ah yes, if the device supports Fn+Space, for this driver to merge you need to send the correct hw notify and have at least KDE report the cycling correctly. You will also need to read the values currently in the device instead of hardcoding them. If it is a feature report, a get_report should return current values
I am not sure what your current comment means about sending 0 breaking the toggle.
Best,
Antheas
Quoted 11 lines
With 2-3 revisions this should be good to go. While at it, try to find a Slide user
Best,
AntheasQuoted 5 lines
I will also fix the two sashiko comments in v2.
Thanks,
Hijae
Quoted 66 lines · Antheas Kapenekakis
Quoted 48 lines · Antheas Kapenekakis
Quoted 19 lines · Hijae Song
Hi Antheas,
Thanks for the feedback.
Quoted 3 lines
If this is an actual keyboard product on the market and Ayaneo is sourcing the part for their device, look-up similar devices and kernel drivers.
I checked. hid-sigmamicro only fixes the
0x0059report descriptor, and I found no SiGma Micro backlight driver on lore.Quoted 2 lines
The name of the driver cannot be -flip-kb. You need to make sure it is generic enough to match most Ayaneo devices.
1c4f:007c also appears on the AYANEO Slide in hhd-dev/hwinfo, with the same vendor interface (report ID
0x41, 7-byte feature report). I only have a Flip KB, so I can only test the byte layout there.Quoted 5 lines
Matias's hid-ayaneo already claims 1c4f:0002 behind a DMI check for AYANEO 3. Would you prefer that I add 007c backlight support to hid-ayaneo once it is merged, or keep a separate driver named after the chip? I lean towards hid-ayaneo, since the Slide may work the same way, but I would like your view first.
Mmmm so Ayaneo does not have a vid and may trample the pid of another device. That is not good. There is no guarantee this led profile is used by a different vendor.
There are two options:
- Adding the keyboard to the hid-ayaneo driver
- This would happen after it merges
- There is 0 common logic between the rgb device and the keyboard device
- Driver registers a different led sysfs ABI and has convoluted
dmi handling
- The driver would devolve
- Adding a scoped driver for the keyboard
- You can start now
- Can tightly scope to keyboard device
- name can be hid-ayaneo-kbd unless other vendor is foundI would tend towards the latter. hid-ayaneo has plenty of work to merge. The controller firmware is quite unstable. Even my implementation in userspace is buggy. But that's fine... Windows is buggy too.
Quoted 15 lines
I have two comments for your current version:
- remove all flip kbd references, nameAYANEO_KBD
- use brightness values of 0 and 1, no scaling. DEs know how to
handle these values by toggling.
- another option is 0-3, which looks nicer, but let's not get too
deep into this
- use devm to register the led structure, drop remove entry point.
Use devm prior to starting the device so that register code stays with initialization
- check if led subsystem is appropriate. I am not sure of the
correct place. If not, current location is fine
- initialize host values to ff ff ff so on first write we get a nice
white color
- if there is only one effect, brightness 0 is off. Do not add an
effect handler
Quoted 8 lines
Ah yes, if the device supports Fn+Space, for this driver to merge you need to send the correct hw notify and have at least KDE report the cycling correctly. You will also need to read the values currently in the device instead of hardcoding them. If it is a feature report, a
get_reportshould return current valuesI am not sure what your current comment means about sending 0 breaking the toggle.
Ok got it. Make intensity take values of 0 and 1, and use those for the mode byte. Do not scale intensities. Always send what is programmed currently. Implement the readback correctly and see if the device notifies you when brightness changes. If it does, use hw notify (as other drivers do) to notify userspace and have them read the new value.
Antheas
Quoted 14 lines
Best,
AntheasQuoted 11 lines
With 2-3 revisions this should be good to go. While at it, try to find a Slide user
Best,
AntheasQuoted 5 lines
I will also fix the two sashiko comments in v2.
Thanks,
Hijae