summaryrefslogtreecommitdiff
path: root/drivers/hid
AgeCommit message (Collapse)Author
2025-03-04HID: lenovo: silence unreachable code warningDan Carpenter
In theory, this code used to return 0 if CONFIG_ACPI_PLATFORM_PROFILE was disabled. It's not clear if that was a config which would actually boot so we've removed the CONFIG_ACPI_PLATFORM_PROFILE ifdef. But now the "return 0;" statement is unreachable and static checker tools complain. Delete it and pull the else statement in a tab to silence the checker warning and make the code a bit more clear. Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-03-04HID: lenovo: Fix to ensure the data as __le32 instead of u32Vishnu Sankar
Ensure that data is treated as __le32 instead of u32 before applying le32_to_cpu. This patch fixes the sparse warning "sparse: cast to restricted __le32". Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com> Signed-off-by: Vishnu Sankar <vsankar@lenovo.com> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202501101635.qJrwAOwf-lkp@intel.com/ Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-24HID: bpf: add a v6.11+ compatible BPF fixup for the XPPen ACK05 remoteBenjamin Tissoires
With v6.11+, we can actually call hid_hw_output_report() and put the device into raw mode, thus getting accurate events without being messed up. Technically we could do the same on v6.10, but given that wayland, gnome and KDE are still not capable of handling the dial, and that v6.10 is EOL, we can safely save a little bit of compilation by only allowing v6.11+. We can easily export the battery information to userspace by adding a dedicated report. However, we need to cheat on the kernel to force it not to query the battery by making the physical collection a stylus. The kernel will then only rely on the events it gets from the device. Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/133 Acked-by: Jiri Kosina <jkosina@suse.com> Link: https://patch.msgid.link/20250207-bpf-import-2025-02-07-v1-7-6048fdd5a206@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2025-02-24HID: bpf: new hid_bpf_async.h common headerBenjamin Tissoires
The purpose is to simplify the use of bpf_wq to defer blocking operations in a sleepable context. Compared to a more "classic" async approach, there is no sync mechanism to wait for the async to finish. The "simple" API is the following: ``` static int HID_BPF_ASYNC(async_fun)(struct hid_bpf_ctx *hctx) { bpf_printk("%s", __fun__); return 0; } SEC("syscall") int probe(struct hid_bpf_probe_args *ctx) { ctx->retval = HID_BPF_ASYNC_INIT(async_fun); return 0; } SEC(HID_BPF_DEVICE_EVENT) int BPF_PROG(event_handler, struct hid_bpf_ctx *hctx) { /* async_fun() can be called now, it's not a sleepable * function in this example */ async_fun(hctx); /* but we can also delay the call by 10 ms */ HID_BPF_ASYNC_DELAYED_CALL(async_fun, hctx, 10); return 0; } HID_BPF_OPS(xppen_ack05_remote) = { .hid_device_event = (void *)event_handler, }; ``` Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/133 Acked-by: Jiri Kosina <jkosina@suse.com> Link: https://patch.msgid.link/20250207-bpf-import-2025-02-07-v1-6-6048fdd5a206@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2025-02-24HID: bpf: import new kfunc from v6.10 & v6.11Benjamin Tissoires
These kfunc are all in v6.10 except for the hid_bpf_try_input_report() which will be in v6.11. Import their definition once now so we can make use of it. Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/114 Acked-by: Jiri Kosina <jkosina@suse.com> Link: https://patch.msgid.link/20250207-bpf-import-2025-02-07-v1-5-6048fdd5a206@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2025-02-24HID: bpf: add support for the XP-Pen Artist Pro 19 (gen2)Benjamin Tissoires
The device behaves the same than the 16" and 14" models, so let's just add support for it too. Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/145 Acked-by: Jiri Kosina <jkosina@suse.com> Link: https://patch.msgid.link/20250207-bpf-import-2025-02-07-v1-4-6048fdd5a206@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2025-02-24HID: bpf: Added updated Kamvas Pro 19 descriptorBenjamin Tissoires
This adds an updated HID descriptor for the Huion Kamvas Pro 19 that is present on newer firmware revisions, while also trying to keep compat with the older versions. Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/164 Signed-off-by: Aki Van Ness <aki@lethalbit.net> Acked-by: Jiri Kosina <jkosina@suse.com> Link: https://patch.msgid.link/20250207-bpf-import-2025-02-07-v1-3-6048fdd5a206@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2025-02-24HID: bpf: Suppress bogus F13 trigger on Sirius keyboard full fan shortcutBenjamin Tissoires
The TUXEDO Sirius 16 Gen1 and the TUXEDO Sirius 16 Gen2 Notebooks have an additional "fan" key next to F12. Pressing it alone sends a F14 key press which can be bound by user space. Pressing it while holding the FN key triggers two things: - The EC firmware locks the fan speed of the internal fans at 100% - F13 key press is registered which by default is already bound in xkb and desktop environments (e.g. in KDE Plasma it launches system settings) To avoid this unexpected double duty of the FN shortcut, this bpf program suppresses the F13 key press. Signed-off-by: Werner Sembach <wse@tuxedocomputers.com> Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/166 Acked-by: Jiri Kosina <jkosina@suse.com> Link: https://patch.msgid.link/20250207-bpf-import-2025-02-07-v1-2-6048fdd5a206@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2025-02-24HID: bpf: Add support for the default firmware mode of the Huion K20Benjamin Tissoires
This re-uses the same HID report descriptor that we also use for the tablet mode after switching the device. The keys send uniquely identifyable shortcuts so we can map those to buttons. However the dial and the button inside the dial send events on a different hidraw node and they are unreliable (e.g. the button does not get released reliably). So they're ignored in this patch, it's not worth the effort getting those to work correctly. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/158 Acked-by: Jiri Kosina <jkosina@suse.com> Link: https://patch.msgid.link/20250207-bpf-import-2025-02-07-v1-1-6048fdd5a206@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2025-02-19HID: intel-ish-hid: Fix use-after-free issue in ishtp_hid_remove()Zhang Lixu
The system can experience a random crash a few minutes after the driver is removed. This issue occurs due to improper handling of memory freeing in the ishtp_hid_remove() function. The function currently frees the `driver_data` directly within the loop that destroys the HID devices, which can lead to accessing freed memory. Specifically, `hid_destroy_device()` uses `driver_data` when it calls `hid_ishtp_set_feature()` to power off the sensor, so freeing `driver_data` beforehand can result in accessing invalid memory. This patch resolves the issue by storing the `driver_data` in a temporary variable before calling `hid_destroy_device()`, and then freeing the `driver_data` after the device is destroyed. Fixes: 0b28cb4bcb17 ("HID: intel-ish-hid: ISH HID client driver") Signed-off-by: Zhang Lixu <lixu.zhang@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-19HID: intel-ish-hid: Fix use-after-free issue in hid_ishtp_cl_remove()Zhang Lixu
During the `rmmod` operation for the `intel_ishtp_hid` driver, a use-after-free issue can occur in the hid_ishtp_cl_remove() function. The function hid_ishtp_cl_deinit() is called before ishtp_hid_remove(), which can lead to accessing freed memory or resources during the removal process. Call Trace: ? ishtp_cl_send+0x168/0x220 [intel_ishtp] ? hid_output_report+0xe3/0x150 [hid] hid_ishtp_set_feature+0xb5/0x120 [intel_ishtp_hid] ishtp_hid_request+0x7b/0xb0 [intel_ishtp_hid] hid_hw_request+0x1f/0x40 [hid] sensor_hub_set_feature+0x11f/0x190 [hid_sensor_hub] _hid_sensor_power_state+0x147/0x1e0 [hid_sensor_trigger] hid_sensor_runtime_resume+0x22/0x30 [hid_sensor_trigger] sensor_hub_remove+0xa8/0xe0 [hid_sensor_hub] hid_device_remove+0x49/0xb0 [hid] hid_destroy_device+0x6f/0x90 [hid] ishtp_hid_remove+0x42/0x70 [intel_ishtp_hid] hid_ishtp_cl_remove+0x6b/0xb0 [intel_ishtp_hid] ishtp_cl_device_remove+0x4a/0x60 [intel_ishtp] ... Additionally, ishtp_hid_remove() is a HID level power off, which should occur before the ISHTP level disconnect. This patch resolves the issue by reordering the calls in hid_ishtp_cl_remove(). The function ishtp_hid_remove() is now called before hid_ishtp_cl_deinit(). Fixes: f645a90e8ff7 ("HID: intel-ish-hid: ishtp-hid-client: use helper functions for connection") Signed-off-by: Zhang Lixu <lixu.zhang@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-19HID: google: fix unused variable warning under !CONFIG_ACPIYu-Chun Lin
As reported by the kernel test robot, the following warning occurs: >> drivers/hid/hid-google-hammer.c:261:36: warning: 'cbas_ec_acpi_ids' defined but not used [-Wunused-const-variable=] 261 | static const struct acpi_device_id cbas_ec_acpi_ids[] = { | ^~~~~~~~~~~~~~~~ The 'cbas_ec_acpi_ids' array is only used when CONFIG_ACPI is enabled. Wrapping its definition and 'MODULE_DEVICE_TABLE' in '#ifdef CONFIG_ACPI' prevents a compiler warning when ACPI is disabled. Fixes: eb1aac4c8744f75 ("HID: google: add support tablet mode switch for Whiskers") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202501201141.jctFH5eB-lkp@intel.com/ Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-19HID: google: don't include '<linux/pm_wakeup.h>' directlyWolfram Sang
The header clearly states that it does not want to be included directly, only via '<linux/(platform_)?device.h>'. Which is already present, so delete the superfluous include. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-19HID: nintendo: fix gencon button events mapRyan McClelland
This fixes the button event map to match the 3-button recommendation as well as the redundant 'z' in the button map events for the Sega MD/Gen 6 Button. Signed-off-by: Ryan McClelland <rymcclel@gmail.com> Reviewed-by: Daniel J. Ogorchock <djogorchock@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-18Hid: Intel-thc-hid: Intel-thc: Fix "dubious: !x | !y" issueEven Xu
Change to use "||" to make it more readable and avoid miss understanding. Signed-off-by: Even Xu <even.xu@intel.com> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202501292144.eFDq4ovr-lkp@intel.com Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-18HID: hid-universal-pidff: Fix spelling mistake "sucessfully" -> "successfully"Colin Ian King
There is a spelling mistake in a hid_info message. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Acked-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-18HID: appletb-kbd: Fix inconsistent indentation and pass -ENODEV to dev_err_probeAditya Garg
The following warnings were flagged by the kernel test robot: drivers/hid/hid-appletb-kbd.c:405 appletb_kbd_probe() warn: inconsistent indenting drivers/hid/hid-appletb-kbd.c:406 appletb_kbd_probe() warn: passing zero to 'dev_err_probe' This patch aims at fixing those warnings. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202502152006.fBBCdEr3-lkp@intel.com/ Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/linux-input/6263a1a2-4d50-41db-aa54-cfcb3e0523a4@stanley.mountain/ Fixes: 93a0fc489481 ("HID: hid-appletb-kbd: add support for automatic brightness control while using the touchbar") Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-18HID: hid-appletb-bl: fix incorrect error message for default brightnessAditya Garg
The error message responsible to show failure to set default backlight brightness incorrectly showed the intended brightness as off irrespective of what the user had set it. This patch intends to fix the same. Also, a small typo in MODULE_DESCRIPTION has been fixed. Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-18HID: hid-appletb-kbd: simplify logic used to switch between media and ↵Aditya Garg
function keys on pressing fn key This commit simplifies the logic in appletb_kbd_inp_event used for switching between the media and function keys on pressing the fn key. We now also prevent touching the kbd->saved_mode variable in case the esc key only mode is chosen. The following small fixes have also been done in this patch: - A small comment style error has been fixed - Fixed spelling in MODULE_DESCRIPTION - I have added myself to MODULE_AUTHOR Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-18HID: corsair-void: Update power supply values with a unified work handlerStuart Hayhurst
corsair_void_process_receiver can be called from an interrupt context, locking battery_mutex in it was causing a kernel panic. Fix it by moving the critical section into its own work, sharing this work with battery_add_work and battery_remove_work to remove the need for any locking Closes: https://bugzilla.suse.com/show_bug.cgi?id=1236843 Fixes: 6ea2a6fd3872 ("HID: corsair-void: Add Corsair Void headset family driver") Cc: stable@vger.kernel.org Signed-off-by: Stuart Hayhurst <stuart.a.hayhurst@gmail.com> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-11HID: pidff: Remove redundant call to pidff_find_special_keysTomasz Pakuła
Probably left out as a mistake after Anssi created the helper macro Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-11HID: pidff: Support device error response from PID_BLOCK_LOADTomasz Pakuła
If an error happens on the device, the driver will no longer fall into the trap of reading this status 60 times before it decides that this reply won't change to success/memory full. Greatly reduces communication overhead during device error situation. Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-11HID: pidff: Comment and code style updateTomasz Pakuła
Update comments to fully conform to the Linux comment styling. Define Linux infinite effect duration (0) as FF_INFINITE Chanage Oleg's name order Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-11HID: hid-universal-pidff: Add Asetek wheelbases supportTomasz Pakuła
Adds Asetek vendor id and product ids for: - Invicta - Forte - La Prima - Tony Kanaan v2: - Misc spelling fix in driver loaded info v3: - Chanage Oleg's name order Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-11HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAXTomasz Pakuła
As noted by Anssi some 20 years ago, pool report is sometimes messed up. This worked fine on many devices but casued oops on VRS DirectForce PRO. Here, we're making sure pool report is refetched before trying to access any of it's fields. While loop was replaced with a for loop + exit conditions were moved aroud to decrease the possibility of creating an infinite loop scenario. Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-11HID: Kconfig: Add LEDS_CLASS_MULTICOLOR dependency to HID_LOGITECHKate Hsuan
The test bot found an issue with building hid-lg-g15. All errors (new ones prefixed by >>): powerpc-linux-ld: drivers/hid/hid-lg-g15.o: in function `lg_g510_kbd_led_write': >> drivers/hid/hid-lg-g15.c:241:(.text+0x768): undefined reference to `led_mc_calc_color_components' powerpc-linux-ld: drivers/hid/hid-lg-g15.o: in function `lg_g15_register_led': >> drivers/hid/hid-lg-g15.c:686:(.text+0xa9c): undefined reference to `devm_led_classdev_multicolor_register_ext' Since multicolor LED APIs manage the keyboard backlight settings of hid-lg-g15, the LEDS_CLASS_MULTICOLOR dependency was added to HID_LOGITECH. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202502110032.VZ0J024X-lkp@intel.com/ Fixes: a3a064146c50 ("HID: hid-lg-g15: Use standard multicolor LED API") Signed-off-by: Kate Hsuan <hpa@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-10Merge tag 'hid-for-linus-2025021001' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid Pull HID fixes from Jiri Kosina: - build/dependency fixes for hid-lenovo and hid-intel-thc (Arnd Bergmann) - functional fixes for hid-corsair-void (Stuart Hayhurst) - workqueue handling and ordering fix for hid-steam (Vicki Pfau) - Gamepad mode vs. Lizard mode fix for hid-steam (Vicki Pfau) - OOB read fix for hid-thrustmaster (Tulio Fernandes) - fix for very long timeout on certain firmware in intel-ish-hid (Zhang Lixu) - other assorted small code fixes and device ID additions * tag 'hid-for-linus-2025021001' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: hid-steam: Don't use cancel_delayed_work_sync in IRQ context HID: hid-steam: Move hidraw input (un)registering to work HID: hid-thrustmaster: fix stack-out-of-bounds read in usb_check_int_endpoints() HID: apple: fix up the F6 key on the Omoton KB066 keyboard HID: hid-apple: Apple Magic Keyboard a3203 USB-C support samples/hid: fix broken vmlinux path for VMLINUX_BTF samples/hid: remove unnecessary -I flags from libbpf EXTRA_CFLAGS HID: topre: Fix n-key rollover on Realforce R3S TKL boards HID: intel-ish-hid: ipc: Add Panther Lake PCI device IDs HID: multitouch: Add NULL check in mt_input_configured HID: winwing: Add NULL check in winwing_init_led() HID: hid-steam: Fix issues with disabling both gamepad mode and lizard mode HID: ignore non-functional sensor in HP 5MP Camera HID: intel-thc: fix CONFIG_HID dependency HID: lenovo: select CONFIG_ACPI_PLATFORM_PROFILE HID: intel-ish-hid: Send clock sync message immediately after reset HID: intel-ish-hid: fix the length of MNG_SYNC_FW_CLOCK in doorbell HID: corsair-void: Initialise memory for psy_cfg HID: corsair-void: Add missing delayed work cancel for headset status
2025-02-10HID: hid-appletb-bl: use appletb_bl_brightness_map instead of magic numbers ↵Aditya Garg
to set default brightness This commit makes use of appletb_bl_brightness_map instead of using if statements and magic numbers to set default brightness, and thus simplifies the code. Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-10HID: hid-appletb-kbd: make struct attribute *appletb_kbd_attrs[] staticAditya Garg
This commit addresses the sparse warning flagged by the kernel test robot. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202502091105.ZsLoBSIh-lkp@intel.com/ Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-08HID: Enable playstation driver for PlayStation 5 controllersAlex Henrie
Without entries in the hid_have_special_driver table, PS5 controllers default to the hidraw driver instead of the hid-playstation driver. Signed-off-by: Alex Henrie <dhenrale@amazon.com> Acked-by: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-08HID: Enable playstation driver independently of sony driverAlex Henrie
PlayStation 4 controllers use the hid-playstation driver now, but they are still not included in the hid_have_special_driver table unless the hid-sony driver is enabled. Split up that section of the table so that hid-playstation works even in the absence of hid-sony. Fixes: 4f1f391869ee ("HID: sony: remove DualShock4 support.") Signed-off-by: Alex Henrie <dhenrale@amazon.com> Acked-by: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-07HID: core: Add reserved item tag for main itemsTatsuya S
For main items, separate warning of reserved item tag from warning of unknown item tag. This comes from 6.2.2.4 Main Items of Device Class Definition for HID 1.11 specification. Signed-off-by: Tatsuya S <tatsuya.s2862@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-07HID: hid-steam: Mutex cleanup in steam_set_lizard_mode()Vicki Pfau
Both branches of this if/else start with mutex_lock and end with mutex_unlock. This hoists the mutex lock/unlock outside of the if statement for simplicity. Signed-off-by: Vicki Pfau <vi@endrift.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-07HID: hid-steam: Don't use cancel_delayed_work_sync in IRQ contextVicki Pfau
Lockdep reported that, as steam_do_deck_input_event is called from steam_raw_event inside of an IRQ context, it can lead to issues if that IRQ occurs while the work to be cancelled is running. By using cancel_delayed_work, this issue can be avoided. The exact ordering of the work and the event processing is not super important, so this is safe. Fixes: cd438e57dd05 ("HID: hid-steam: Add gamepad-only mode switched to by holding options") Signed-off-by: Vicki Pfau <vi@endrift.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-07HID: hid-steam: Move hidraw input (un)registering to workVicki Pfau
Due to an interplay between locking in the input and hid transport subsystems, attempting to register or deregister the relevant input devices during the hidraw open/close events can lead to a lock ordering issue. Though this shouldn't cause a deadlock, this commit moves the input device manipulation to deferred work to sidestep the issue. Fixes: 385a4886778f6 ("HID: steam: remove input device when a hid client is running.") Signed-off-by: Vicki Pfau <vi@endrift.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-07HID: hid-thrustmaster: fix stack-out-of-bounds read in usb_check_int_endpoints()Tulio Fernandes
Syzbot[1] has detected a stack-out-of-bounds read of the ep_addr array from hid-thrustmaster driver. This array is passed to usb_check_int_endpoints function from usb.c core driver, which executes a for loop that iterates over the elements of the passed array. Not finding a null element at the end of the array, it tries to read the next, non-existent element, crashing the kernel. To fix this, a 0 element was added at the end of the array to break the for loop. [1] https://syzkaller.appspot.com/bug?extid=9c9179ac46169c56c1ad Reported-by: syzbot+9c9179ac46169c56c1ad@syzkaller.appspotmail.com Fixes: 50420d7c79c3 ("HID: hid-thrustmaster: Fix warning in thrustmaster_probe by adding endpoint check") Signed-off-by: Túlio Fernandes <tuliomf09@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-07HID: apple: fix up the F6 key on the Omoton KB066 keyboardAlex Henrie
The Omoton KB066 is an Apple A1255 keyboard clone (HID product code 05ac:022c). On both keyboards, the F6 key becomes Num Lock when the Fn key is held. But unlike its Apple exemplar, when the Omoton's F6 key is pressed without Fn, it sends the usage code 0xC0301 from the reserved section of the consumer page instead of the standard F6 usage code 0x7003F from the keyboard page. The nonstandard code is translated to KEY_UNKNOWN and becomes useless on Linux. The Omoton KB066 is a pretty popular keyboard, judging from its 29,058 reviews on Amazon at time of writing, so let's account for its quirk to make it more usable. By the way, it would be nice if we could automatically set fnmode to 0 for Omoton keyboards because they handle the Fn key internally and the kernel's Fn key handling creates undesirable side effects such as making F1 and F2 always Brightness Up and Brightness Down in fnmode=1 (the default) or always F1 and F2 in fnmode=2. Unfortunately I don't think there's a way to identify Bluetooth keyboards more specifically than the HID product code which is obviously inaccurate. Users of Omoton keyboards will just have to set fnmode to 0 manually to get full Fn key functionality. Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-07HID: hid-apple: Apple Magic Keyboard a3203 USB-C supportIevgen Vovk
Add Apple Magic Keyboard 2024 model (with USB-C port) device ID (0320) to those recognized by the hid-apple driver. Keyboard is otherwise compatible with the existing implementation for its earlier 2021 model. Signed-off-by: Ievgen Vovk <YevgenVovk@ukr.net> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-07HID: hid-appletb-kbd: add support for automatic brightness control while ↵Aditya Garg
using the touchbar On Windows, if there is no input by the user for 60 sec, the Touch Bar dims automatically, and after further 15 sec, it turns off. On receiving input, the Touch Bar resets the timer and goes back to full brightness. This patch implements the same functionality. Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-07HID: hid-appletb-kbd: add support for fn toggle between media and function modeAditya Garg
This patch adds support for the switching between the Media and Function keys on the touchbar by pressing the Fn key on Apple Internal Keyboard. Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-07HID: hid-appletb-kbd: add driver for the keyboard mode of Apple Touch BarsKerem Karabay
The Touch Bars found on x86 Macs support two USB configurations: one where the device presents itself as a HID keyboard and can display predefined sets of keys, and one where the operating system has full control over what is displayed. This commit adds a driver for the display functionality of the first configuration. Note that currently only T2 Macs are supported. This driver is based on previous work done by Ronald Tschalär <ronald@innovation.ch>. Signed-off-by: Kerem Karabay <kekrby@gmail.com> Co-developed-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-07HID: hid-appletb-bl: add driver for the backlight of Apple Touch BarsKerem Karabay
This commit adds a driver for the backlight of Apple Touch Bars on x86 Macs. Note that currently only T2 Macs are supported. This driver is based on previous work done by Ronald Tschalär <ronald@innovation.ch>. Signed-off-by: Kerem Karabay <kekrby@gmail.com> Co-developed-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-07HID: hid-lg-g15: Use standard multicolor LED APIKate Hsuan
Replace the custom "color" sysfs attribute with the standard multicolor LED API. This also removes the code for the custom "color" sysfs attribute, the "color" sysfs attribute was never documented so hopefully, it is not used by anyone. If we get complaints, we can re-add the "color" sysfs attribute as a compatibility wrapper setting the subleds intensity. Signed-off-by: Kate Hsuan <hpa@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-07HID: intel-thc-hid: Remove deprecated PCI API callsPhilipp Stanner
intel-thc-hid reintroduced the already deprecated PCI API functions pcim_iomap_table(), pcim_iomap_regions(), pcim_iounmap_regions(), none of which should be used anymore. Furthermore, calling managed (pcim_*) functions in remove() and probe() for cleanup is not necessary, since the managed functions clean up automatically. Replace / remove the deprecated functions. Fixes: 61bb2714dc3a1 ("HID: intel-thc-hid: intel-quicki2c: Add THC QuickI2C driver skeleton") Signed-off-by: Philipp Stanner <phasta@kernel.org> Reviewed-by: Even Xu <even.xu@intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-03HID: topre: Fix n-key rollover on Realforce R3S TKL boardsDaniel Brackenbury
Newer model R3* Topre Realforce keyboards share an issue with their older R2 cousins where a report descriptor fixup is needed in order for n-key rollover to work correctly, otherwise only 6-key rollover is available. This patch adds some new hardware IDs for the R3S 87-key keyboard and makes amendments to the existing hid-topre driver in order to change the correct byte in the new model. Signed-off-by: Daniel Brackenbury <daniel.brackenbury@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-03HID: intel-ish-hid: ipc: Add Panther Lake PCI device IDsZhang Lixu
Add device IDs of Panther Lake-H and Panther Lake-P into ishtp support list. Signed-off-by: Zhang Lixu <lixu.zhang@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-03HID: usbkbd: Fix the bit shift number for LED_KANAjunan
Since "LED_KANA" was defined as "0x04", the shift number should be "4". Signed-off-by: junan <junan76@163.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-03HID: multitouch: Add NULL check in mt_input_configuredCharles Han
devm_kasprintf() can return a NULL pointer on failure,but this returned value in mt_input_configured() is not checked. Add NULL check in mt_input_configured(), to handle kernel NULL pointer dereference error. Fixes: 479439463529 ("HID: multitouch: Correct devm device reference for hidinput input_dev name") Signed-off-by: Charles Han <hanchunchao@inspur.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-03HID: winwing: Add NULL check in winwing_init_led()Charles Han
devm_kasprintf() can return a NULL pointer on failure,but this returned value in winwing_init_led() is not checked. Add NULL check in winwing_init_led(), to handle kernel NULL pointer dereference error. Fixes: 266c990debad ("HID: Add WinWing Orion2 throttle support") Signed-off-by: Charles Han <hanchunchao@inspur.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2025-02-03HID: pidff: Factor out pool report fetch and remove excess declarationTomasz Pakuła
We only want to refetch the pool report during device init. Reset function is now called when uploading effects to an empty device so extract pool fetch to separate function and call it from init before autocenter check (autocenter check triggered reset during init). Remove a superfluous pointer declaration and assigment as well. Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Reviewed-by: Michał Kopeć <michal@nozomi.space> Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz> Tested-by: Paul Dino Jones <paul@spacefreak18.xyz> Tested-by: Cristóferson Bueno <cbueno81@gmail.com> Tested-by: Pablo Cisneros <patchkez@protonmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>