summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-apple.c
AgeCommit message (Collapse)Author
2024-02-13HID: apple: remove unused members from struct apple_sc_backlightJiri Slaby (SUSE)
The backlight members in struct apple_sc_backlight are unused. They were added in commit 9018eacbe623 (HID: apple: Add support for keyboard backlight on certain T2 Macs.), but never used. As this is not a struct to communicate with the HW, remove these. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Paul Pawlowski <paul@mrarm.io> Cc: Aun-Ali Zaidi <admin@kodeit.net> Cc: Aditya Garg <gargaditya08@live.com> Cc: Jiri Kosina <jikos@kernel.org> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2023-12-12HID: apple: Add "hfd.cn" and "WKB603" to the list of non-apple keyboardsYan Jun
JingZao(京造) WKB603 keyboard is a rebranded product of Jamesdonkey RS2 keyboard, identified as "hfd.cn WKB603" in wired mode, "WKB603" in bluetooth mode. Adding them to the list of non-apple keyboards fixes function key. Signed-off-by: Yan Jun <jerrysteve1101@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2023-11-21HID: apple: add Jamesdonkey and A3R to non-apple keyboards listYihong Cao
Jamesdonkey A3R keyboard is identified as "Jamesdonkey A3R" in wired mode, "A3R-U" in wireless mode and "A3R" in bluetooth mode. Adding them to non-apple keyboards fixes function key. Signed-off-by: Yihong Cao <caoyihong4@outlook.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-08-16HID: apple: Add "Hailuck" to the list of non-apple keyboardsNils Tonnaett
Powzan keyboards KB750 and KB770 identify as "Hailuck Co.,Ltd USB Keyboard". Adding "Hailuck" to the list of non-apple keyboards fixes function keys for these models. Signed-off-by: Nils Tonnaett <ntonnatt@ccrma.stanford.edu> Reviewed-by: Rahul Rameshbabu <sergeantsagara@protonmail.com Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-06-09HID: apple: Option to swap only left side mod keysLasse Brun
On the Keychron K8 keyboard, and probably others, the right side keys should not be swapped to maintain PC layout. Swapping the right side keys moves 'Super' before 'Alt gr' which is not intended by the default Keychron layout or the ISO layout. Signed-off-by: Lasse Brun <bruners@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-04-13HID: apple: Set the tilde quirk flag on the Geyser 3Alex Henrie
I was finally able to obtain a MacBook1,1 to test and I've now confirmed that it has the tilde key quirk as well: Product Model Year System CPU Shape Labels Country Quirky ============================================================================ 05ac:0218 A1181 2006 MacBook1,1 T2500 ISO British 13 Yes Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Link: https://lore.kernel.org/r/20230404024829.13982-1-alexhenrie24@gmail.com Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2023-04-13HID: apple: explicitly include linux/leds.hThomas Weißschuh
Instead of relying on an accidental, transitive inclusion of linux/leds.h use it directly. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20230215-power_supply-leds-hid-v1-4-35b6f1dcee8a@weissschuh.net Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2023-03-10HID: apple: Set the tilde quirk flag on the Geyser 4 and laterAlex Henrie
I recently tested several old MacBooks and as far as I can tell, all MacBooks that have an ISO keyboard have the tilde key quirk: Product Model Year System CPU Shape Labels Country Quirky ============================================================================ 05ac:021b A1181 2006 MacBook2,1 T5600 ISO British 13 Yes 05ac:021b A1181 2007 MacBook2,1 T7200 ISO Québécois 13 Yes 05ac:0229 A1181 2007 MacBook4,1 T8300 ANSI Usonian 33 No 05ac:022a A1181 2007 MacBook4,1 T8100 ISO English 13 Yes 05ac:022a A1181 2007 MacBook5,2 P7350 ISO Québécois 13 Yes 05ac:0237 A1278 2008 MacBook5,1 P7350 ISO Dutch 13 Yes 05ac:0237 A1278 2009 MacBook5,5 P7550 ISO British 13 Yes The model number and year are from the laptop case. Since Apple printed the same model and year on many different laptops, the system name (as reported in the SMBIOS tables) and CPU form a more precise identifier. Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-11-14HID: apple: Swap Control and Command keys on Apple keyboardsAditya Garg
This patch allows users to swap the control and command keys. This can be useful for the Mac users who are used to using Command instead of Control in macOS for various commonly used shortcuts. Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-11-02HID: apple: enable APPLE_ISO_TILDE_QUIRK for the keyboards of Macs with the ↵Kerem Karabay
T2 chip The iso_layout parameter must be manually set to get the driver to swap KEY_102ND and KEY_GRAVE. This patch eliminates the need to do that. This is safe to do, as Macs with keyboards that do not need the quirk will keep working the same way as the value of hid->country will be different than HID_COUNTRY_INTERNATIONAL_ISO. This was tested by one person with a Mac with the WELLSPRINGT2_J152F keyboard with a layout that does not require the quirk to be set. Signed-off-by: Kerem Karabay <kekrby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-11-02HID: apple: fix key translations where multiple quirks attempt to translate ↵Kerem Karabay
the same key The hid-apple driver does not support chaining translations or dependencies on other translations. This creates two problems: 1 - In Non-English keyboards of Macs, KEY_102ND and KEY_GRAVE are swapped and the APPLE_ISO_TILDE_QUIRK is used to work around this problem. The quirk is not set for the Macs where these bugs happen yet (see the 2nd patch for that), but this can be forced by setting the iso_layout parameter. Unfortunately, this only partially works. KEY_102ND gets translated to KEY_GRAVE, but KEY_GRAVE does not get translated to KEY_102ND, so both of them end up functioning as KEY_GRAVE. This is because the driver translates the keys as if Fn was pressed and the original is sent if it is not pressed, without any further translations happening on the key[#463]. KEY_GRAVE is present at macbookpro_no_esc_fn_keys[#195], so this is what happens: - KEY_GRAVE -> KEY_ESC (as if Fn is pressed) - KEY_GRAVE is returned (Fn isn't pressed, so translation is discarded) - KEY_GRAVE -> KEY_102ND (this part is not reached!) ... 2 - In case the touchbar does not work, the driver supports sending Escape when Fn+KEY_GRAVE is pressed. As mentioned previously, KEY_102ND is actually KEY_GRAVE and needs to be translated before this happens. Normally, these are the steps that should happen: - KEY_102ND -> KEY_GRAVE - KEY_GRAVE -> KEY_ESC (Fn is pressed) - KEY_ESC is returned Though this is what happens instead, as dependencies on other translations are not supported: - KEY_102ND -> KEY_ESC (Fn is pressed) - KEY_ESC is returned This patch fixes both bugs by ordering the translations correctly and by making the translations continue and not return immediately after translating a key so that chained translations work and translations can depend on other ones. This patch also simplifies the implementation of the swap_fn_leftctrl option a little bit, as it makes it simply use a normal translation instead adding extra code to translate a key to KEY_FN[#381]. This change wasn't put in another patch as the code that translates the Fn key needs to be changed because of the changes in the patch, and those changes would be discarded with the next patch anyway (the part that originally translates KEY_FN to KEY_LEFTCTRL needs to be made an else-if branch of the part that transltes KEY_LEFTCTRL to KEY_FN). Note: Line numbers (#XYZ) are for drivers/hid/hid-apple.c at commit 20afcc462579 ("HID: apple: Add "GANSS" to the non-Apple list"). Note: These bugs are only present on Macs with a keyboard with no dedicated escape key and a non-English layout. Signed-off-by: Kerem Karabay <kekrby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-07-22HID: apple: Add "GANSS" to the non-Apple listHilton Chain
While using the name "SONiX USB DEVICE" for wired mode, my GANSS keyboard uses "GANSS" for bluetooth mode as well, so adding this to the list. Signed-off-by: Hilton Chain <hako@ultrarare.space> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-06-08HID: apple: Properly handle function keys on non-Apple keyboardHilton Chain
This commit extends fa33382c7f74 ("HID: apple: Properly handle function keys on Keychron keyboards") by adding an array of known non-Apple keyboards' device names, and the function apple_is_non_apple_keyboard() to identify and create exception for them. Signed-off-by: Hilton Chain <hako@ultrarare.space> Reviewed-by: Bryan Cain <bryancain3@gmail.com> Tested-by: Bryan Cain <bryancain3@gmail.com> Reviewed-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-05-11HID: apple: Properly handle function keys on Keychron keyboardsBryan Cain
Keychron's C-series and K-series of keyboards copy the vendor and product IDs of an Apple keyboard, but only behave like that device when set to "Mac" mode. In "Windows" mode, the Fn key doesn't generate a scancode, so it's impossible to use the F1-F12 keys when fnmode is set to its default value of 1. To fix this, make fnmode default to the new value of 3, which behaves like fnmode=2 for Keychron keyboards and like fnmode=1 for actual Apple keyboards. This way, Keychron devices are fully usable in both "Windows" and "Mac" modes, while behavior is unchanged for everything else. Signed-off-by: Bryan Cain <bryancain3@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Tested-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-02-16HID: apple: Add fn mapping for MacBook Pros with Touch BarAditya Garg
This patch adds the Fn mapping for keyboards on certain T2 Macs. [jkosina@suse.cz: rebase on top of apple_setup_input() refactoring] Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-02-16HID: apple: Add necessary IDs and configuration for T2 Macs.Aun-Ali Zaidi
This patch adds the necessary IDs and configuration for Macs with the T2 Security chip. Signed-off-by: Aun-Ali Zaidi <admin@kodeit.net> Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-02-16HID: apple: Add support for keyboard backlight on certain T2 Macs.Paul Pawlowski
This patch introduces the requisite plumbing for supporting keyboard backlight on T2-attached, USB exposed models. The quirk mechanism was used to reuse the existing hid-apple driver. Signed-off-by: Paul Pawlowski <paul@mrarm.io> Signed-off-by: Aun-Ali Zaidi <admin@kodeit.net> Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-02-16HID: apple: Report Magic Keyboard 2021 with fingerprint reader battery over USBJosé Expósito
Like the Apple Magic Keyboard 2015, when connected over USB, the 2021 version with fingerprint reader registers 2 different interfaces. One of them is used to report the battery level. However, unlike when connected over Bluetooth, the battery level is not reported automatically and it is required to fetch it manually. Add the APPLE_RDESC_BATTERY quirk to fix the battery report descriptor and manually fetch the battery level. Tested with the ANSI variant of the keyboard with and without numpad. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-02-16HID: apple: Report Magic Keyboard 2021 battery over USBJosé Expósito
Like the Apple Magic Keyboard 2015, when connected over USB, the 2021 version registers 2 different interfaces. One of them is used to report the battery level. However, unlike when connected over Bluetooth, the battery level is not reported automatically and it is required to fetch it manually. Add the APPLE_RDESC_BATTERY quirk to fix the battery report descriptor and manually fetch the battery level. Tested with the ANSI, ISO and JIS variants of the keyboard. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-02-16HID: apple: Magic Keyboard 2015 FN key mappingJosé Expósito
The Magic Keyboard 2015 function key mapping was not present and the default mapping was used. While this worked for most keys, the F5 and F6 keys were sending KEY_KBDILLUMDOWN and KEY_KBDILLUMUP; however, the keyboard is not backlited. Add a custom translation table for the keyboard leaving F5 and F6 unassigned to mimic the default behavior on macOS. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-02-16HID: apple: Magic Keyboard first generation FN key mappingJosé Expósito
The function key mapping for the Magic Keyboard first generation (2007, 2009 and 2011 aluminum wireless models) was not present and the default one was used instead. This caused two main issues: - The F5 and F6 keys were sending KEY_KBDILLUMDOWN and KEY_KBDILLUMUP; however, the keyboard is not backlited. - The keyboard has the APPLE_NUMLOCK_EMULATION quirk with F6 set as the KEY_NUMLOCK key by "powerbook_numlock_keys". However, because F6 was mapped to KEY_KBDILLUMUP by the default mapping it was not possible to switch the numlock status. This means that, if numlock was enabled on session startup, it was not possible to disable it without connecting another keyboard. Add a custom translation table for the device leaving F5 unassigned and using F6 as the KEY_NUMLOCK key. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-02-16HID: apple: Refactor key translation setupJosé Expósito
The code used to map the apple_key_translation structs is duplicated. Extract it to a common function. Refactor, no functional changes. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-01-21HID: apple: Set the tilde quirk flag on the Wellspring 5 and laterAlex Henrie
Markus reports that his 2011 MacBook with a German ISO keyboard (USB product code 05ac:0246, HID country code 13) has the tilde key quirk. Seeing as all of the standalone Apple ISO keyboards since about 2008 have the quirk, it seems reasonable to assume that once the integrated laptop keyboards started having the quirk, they likewise never stopped having it. Reported-by: Markus Wageringel <markus.wageringel@gmail.com> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-01-06HID: apple: Add Magic Keyboard 2021 with fingerprint reader FN key mappingJosé Expósito
Use the function key table introduced for the Magic Keyboard 2021 without fingerprint reader in the models with fingerprint reader and/or numpad. Tested with the ANSI variant of the keyboard with and without numpad. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-01-06HID: apple: Add 2021 magic keyboard FN key mappingBenjamin Berg
The new 2021 apple models have a different FN key assignment. Add a new translation table and use that for the 2021 magic keyboard. Signed-off-by: Benjamin Berg <bberg@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-01-06HID: apple: Add 2021 Magic Keyboard with number padAlex Henrie
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-01-06HID: apple: Add 2021 Magic Keyboard with fingerprint readerAlex Henrie
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Tested-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-11-19HID: apple: Report Magic Keyboard battery over USBJosé Expósito
When connected over USB, the Apple Magic Keyboard 2015 registers 3 different interfaces. One of them is used to report the battery level. However, unlike when connected over Bluetooth, the battery level is not reported automatically and it is required to fetch it manually. Add a new quirk to fix the battery report descriptor and a timer to fetch the battery level. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-11-19HID: apple: Use BIT to define quirksJosé Expósito
Replace the existing quirk hardcoded values with the BIT macro in order to simplify including new quirks. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-11-19HID: apple: Do not reset quirks when the Fn key is not foundJosé Expósito
When a keyboard without a function key is detected, instead of removing all quirks, remove only the APPLE_HAS_FN quirk. Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-11-05Merge branch 'for-5.16/apple' into for-linusJiri Kosina
- support for 2021 Magic Keyboard (Alex Henrie) - tidle key quirk handling improvement (Alex Henrie)
2021-10-19HID: apple: Bring back flag for Apple tilde key quirkAlex Henrie
Some Apple ISO keyboards have a quirk where the backtick/tilde key is swapped with the less-than/greater-than key. Unfortunately, there is no perfectly reliable way to detect whether a keyboard has the quirk or not, but the quirk appears to only be present on models that support Bluetooth, and the affected keyboards usually report country code 13 in the HID descriptor. Therefore, the best we can do is to change /sys/module/hid_apple/parameters/iso_layout to a ternary: 0 = Not ISO or ISO and not quirky 1 = ISO and quirky -1 = Guess based on product ID and country code Table of keyboards that José, Julian and I have tested: Product Model Shape Labels Bus Country Quirky ========================================================= 05ac:0201 M2452 ANSI Usonian USB 0 No 05ac:020b A1048 ANSI Usonian USB 0 No 05ac:020c A1048 ISO Québécois USB 13 No 05ac:0221 A1243 ISO Norwegian USB 13 No 05ac:0221 A1243 ISO Portuguese USB 13 No 05ac:0221 A1243 ISO Swedish USB 13 No 05ac:0221 A1243 ISO Swiss USB 13 No 05ac:022c A1255 ANSI Usonian BT 33 No 05ac:022d A1255 ISO Hebrew BT 13 Yes 05ac:022d A1255 ISO Québécois BT 13 Yes 05ac:022d A1255 ISO Spanish BT 13 Yes 05ac:023a A1314 ISO Russian BT 13 Yes 05ac:023a A1314 ISO Swiss BT 13 Yes 05ac:024f A1243 ANSI Usonian USB 0 No 05ac:0250 A1243 ISO British USB 13 No 05ac:0250 A1243 ISO German USB 13 No 05ac:0250 A1243 ISO Italian USB 13 No 05ac:0250 A1243 ISO Québécois USB 13 No 05ac:0251 A1243 JIS Japanese USB 15 No 05ac:0255 A1314 ANSI Usonian BT 33 No 05ac:0255 A1314 ANSI Taiwanese BT 33 No 05ac:0255 A1314 ANSI Thai BT 33 No 05ac:0256 A1314 ISO Arabic BT 13 Yes 05ac:0256 A1314 ISO French BT 13 Yes 05ac:0256 A1314 ISO German BT 13 Yes 05ac:0256 A1314 ISO Norwegian BT 13 Yes 05ac:0256 A1314 ISO Spanish BT 13 Yes 05ac:0256 A1314 ISO Swiss BT 13 Yes 05ac:0257 A1314 JIS Japanese BT 15 No 05ac:0267 A1644 ANSI Usonian USB 33 No 004c:0267 A1644 ANSI Usonian BT 0 No 05ac:0267 A1644 ISO British USB 13 Yes 004c:0267 A1644 ISO British BT 0 Yes 05ac:0267 A1644 ISO Finnish USB 13 Yes 004c:0267 A1644 ISO Finnish BT 0 Yes 05ac:0267 A1644 ISO Québécois USB 13 Yes 004c:0267 A1644 ISO Québécois BT 0 Yes 05ac:0267 A1644 ISO Spanish USB 13 Yes 004c:0267 A1644 ISO Spanish BT 0 Yes 05ac:0267 A1644 ISO Swiss USB 13 Yes 004c:0267 A1644 ISO Swiss BT 0 Yes 05ac:0267 A1644 JIS Japanese USB 15 No 004c:0267 A1644 JIS Japanese BT 0 No 05ac:029c A2450 ANSI Usonian USB 33 No 004c:029c A2450 ANSI Usonian BT 0 No 05ac:029c A2450 ISO Spanish USB 13 Yes 004c:029c A2450 ISO Spanish BT 0 Yes 05ac:029c A2450 JIS Japanese USB 15 No 004c:029c A2450 JIS Japanese BT 0 No Reported-by: José Expósito <jose.exposito89@gmail.com> Tested-by: José Expósito <jose.exposito89@gmail.com> Tested-by: Julian Weigt <juw@posteo.de> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-10-19HID: apple: Add support for the 2021 Magic KeyboardAlex Henrie
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-10-19HID: apple: Rename MAGIC_KEYBOARD_ANSI to MAGIC_KEYBOARD_2015Alex Henrie
The ANSI, ISO, and JIS variants of this keyboard all have the same product ID. Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-09-22HID: apple: Eliminate obsolete IR receiver quirksAlexander F. Lent
This code has been dead since 2013, when the appleir driver was added by commit 9a4a5574ce42 ("HID: appleir: add support for Apple ir devices"), removing Apple IR receivers from this driver. No other Apple devices use these quirks, so drop them. Signed-off-by: Alexander F. Lent <lx@xanderlent.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-09-15HID: apple: Fix logical maximum and usage maximum of Magic Keyboard JISMizuho Mori
Apple Magic Keyboard(JIS)'s Logical Maximum and Usage Maximum are wrong. Below is a report descriptor. 0x05, 0x01, /* Usage Page (Desktop), */ 0x09, 0x06, /* Usage (Keyboard), */ 0xA1, 0x01, /* Collection (Application), */ 0x85, 0x01, /* Report ID (1), */ 0x05, 0x07, /* Usage Page (Keyboard), */ 0x15, 0x00, /* Logical Minimum (0), */ 0x25, 0x01, /* Logical Maximum (1), */ 0x19, 0xE0, /* Usage Minimum (KB Leftcontrol), */ 0x29, 0xE7, /* Usage Maximum (KB Right GUI), */ 0x75, 0x01, /* Report Size (1), */ 0x95, 0x08, /* Report Count (8), */ 0x81, 0x02, /* Input (Variable), */ 0x95, 0x05, /* Report Count (5), */ 0x75, 0x01, /* Report Size (1), */ 0x05, 0x08, /* Usage Page (LED), */ 0x19, 0x01, /* Usage Minimum (01h), */ 0x29, 0x05, /* Usage Maximum (05h), */ 0x91, 0x02, /* Output (Variable), */ 0x95, 0x01, /* Report Count (1), */ 0x75, 0x03, /* Report Size (3), */ 0x91, 0x03, /* Output (Constant, Variable), */ 0x95, 0x08, /* Report Count (8), */ 0x75, 0x01, /* Report Size (1), */ 0x15, 0x00, /* Logical Minimum (0), */ 0x25, 0x01, /* Logical Maximum (1), */ here is a report descriptor which is parsed one in kernel. see sys/kernel/debug/hid/<dev>/rdesc 05 01 09 06 a1 01 85 01 05 07 15 00 25 01 19 e0 29 e7 75 01 95 08 81 02 95 05 75 01 05 08 19 01 29 05 91 02 95 01 75 03 91 03 95 08 75 01 15 00 25 01 06 00 ff 09 03 81 03 95 06 75 08 15 00 25 [65] 05 07 19 00 29 [65] 81 00 95 01 75 01 15 00 25 01 05 0c 09 b8 81 02 95 01 75 01 06 01 ff 09 03 81 02 95 01 75 06 81 03 06 02 ff 09 55 85 55 15 00 26 ff 00 75 08 95 40 b1 a2 c0 06 00 ff 09 14 a1 01 85 90 05 84 75 01 95 03 15 00 25 01 09 61 05 85 09 44 09 46 81 02 95 05 81 01 75 08 95 01 15 00 26 ff 00 09 65 81 02 c0 00 Position 64(Logical Maximum) and 70(Usage Maximum) are 101. Both should be 0xE7 to support JIS specific keys(ろ, Eisu, Kana, |) support. position 117 is also 101 but not related(it is Usage 65h). There are no difference of product id between JIS and ANSI. They are same 0x0267. Signed-off-by: Mizuho Mori <morimolymoly@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-09-01Merge branch 'for-5.15/apple' into for-linusJiri Kosina
- Support proper EV_MSC emissions to hid-apple (Vincent Lefevre)
2021-07-28HID: apple: Add missing scan code event for keys handled by hid-appleVincent Lefevre
When an EV_KEY event is generated by hid-apple due to special key mapping, the usual associated scan code event (EV_MSC) is missing. This issue can be seen with the evtest utility. Add the scan code event for these special keys. BugLink: https://bugs.debian.org/757356 Co-developed-by: Daniel Lin <ephemient@gmail.com> Signed-off-by: Daniel Lin <ephemient@gmail.com> Signed-off-by: Vincent Lefevre <vincent@vinc17.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-07-28HID: apple: Add support for Keychron K1 wireless keyboardHaochen Tong
The Keychron K1 wireless keyboard has a set of Apple-like function keys and an Fn key that works like on an Apple bluetooth keyboard. It identifies as an Apple Alu RevB ANSI keyboard (05ac:024f) over USB and BT. Use hid-apple for it so the Fn key and function keys work correctly. Signed-off-by: Haochen Tong <i@hexchain.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2020-08-17HID: apple: Add support for Matias wireless keyboardBALATON Zoltan
The Matias Wireless keyboard has an Apple like layout and identifies as ISO RevB Alu keyboard. Use hid-apple for it so Fn key and media control functions work as expected. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2020-06-24HID: apple: Disable Fn-key key-re-mapping on clone keyboardsHans de Goede
The Maxxter KB-BT-001 Bluetooth keyboard, which looks somewhat like the Apple Wireless Keyboard, is using the vendor and product IDs (05AC:0239) of the Apple Wireless Keyboard (2009 ANSI version) <sigh>. But its F1 - F10 keys are marked as sending F1 - F10, not the special functions hid-apple.c maps them too; and since its descriptors do not contain the HID_UP_CUSTOM | 0x0003 usage apple-hid looks for for the Fn-key, apple_setup_input() never gets called, so F1 - F6 are mapped to key-codes which have not been set in the keybit array causing them to not send any events at all. The lack of a usage code matching the Fn key in the clone is actually useful as this allows solving this problem in a generic way. This commits adds a fn_found flag and it adds a input_configured callback which checks if this flag is set once all usages have been mapped. If it is not set, then assume this is a clone and clear the quirks bitmap so that the hid-apple code does not add any special handling to this keyboard. This fixes F1 - F6 not sending anything at all and F7 - F12 sending the wrong codes on the Maxxter KB-BT-001 Bluetooth keyboard and on similar clones. Cc: Joao Moreno <mail@joaomoreno.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2020-05-15HID: apple: Swap the Fn and Left Control keys on Apple keyboardsfree5lot
This patch allows users to swap the Fn and left Control keys on all Apple keyboards: internal (e.g. Macbooks) and external (both wired and wireless). The patch adds a new hid-apple module param: swap_fn_leftctrl (off by default). Signed-off-by: Zakhar Semenov <mail@free5lot.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2020-02-12HID: apple: Add support for recent firmware on Magic KeyboardsMansour Behabadi
Magic Keyboards with more recent firmware (0x0100) report Fn key differently. Without this patch, Fn key may not behave as expected and may not be configurable via hid_apple fnmode module parameter. Signed-off-by: Mansour Behabadi <mansour@oxplot.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2019-09-04HID: apple: Fix stuck function keys when using FNJoao Moreno
This fixes an issue in which key down events for function keys would be repeatedly emitted even after the user has raised the physical key. For example, the driver fails to emit the F5 key up event when going through the following steps: - fnmode=1: hold FN, hold F5, release FN, release F5 - fnmode=2: hold F5, hold FN, release F5, release FN The repeated F5 key down events can be easily verified using xev. Signed-off-by: Joao Moreno <mail@joaomoreno.com> Co-developed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner
Based on 1 normalized pattern(s): 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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-28HID: add support for Apple Magic KeyboardsSean O'Brien
USB device Vendor 05ac (Apple) Device 026c (Magic Keyboard with Numeric Keypad) Bluetooth devices Vendor 004c (Apple) Device 0267 (Magic Keyboard) Device 026c (Magic Keyboard with Numeric Keypad) Support already exists for the Magic Keyboard over USB connection. Add support for the Magic Keyboard over Bluetooth connection, and for the Magic Keyboard with Numeric Keypad over Bluetooth and USB connection. Signed-off-by: Sean O'Brien <seobrien@chromium.org> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2017-06-08HID: apple: Use country code to detect ISO keyboardsAlex Henrie
At least on newer laptops, Apple uses the same USB ID for both ISO and ANSI keyboards. However, they have been good about filling in the bCountryCode field in the HID descriptor on all of their keyboards. A value of 13 indicates an ISO layout and other values indicate various country-specific ANSI layouts. With this patch, users of Apple US keyboards will no longer have to run `echo 0 > /sys/module/hid_apple/parameters/iso_layout` to get a working tilde key. Please test this patch and send feedback if you have a Macbook or an Apple keyboard. Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-07-11HID: add usb device id for Apple Magic KeyboardJean-Gabriel Gill-Couture
USB device Vendor 05ac (Apple) Device 0267 (Magic Keyboard) This keyboard supports both Bluetooth and USB connections, this patch only covers USB. Thanks to Maxime Poulin <maxpoulin64@gmail.com> Signed-off-by: Jean-Gabriel Gill-Couture <jeangab@jeangab.fr.nf> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2015-07-27HID: apple: Add support for the 2015 Macbook ProHenrik Rydberg
This patch adds keyboard support for MacbookPro12,1 as WELLSPRING9 (0x0272, 0x0273, 0x0274). The touchpad is handled in a separate bcm5974 patch, as usual. Tested-by: John Horan <knasher@gmail.com> Tested-by: Jochen Radmacher <jradmacher@gmx.de> Tested-by: Yang Hongyang <burnef@gmail.com> Tested-by: Yen-Chin, Lee <coldnew.tw@gmail.com> Tested-by: George Hilios <ghilios@gmail.com> Tested-by: Janez Urevc <janez@janezurevc.name> Signed-off-by: Henrik Rydberg <rydberg@bitmath.org> Acked-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-02-06HID: apple: add Apple wireless keyboard 2011 JIS model supportHuei-Horng Yo
Add Apple wireless keyboard 2011 JIS model (05ac:0257). Signed-off-by: Huei-Horng Yo <hiroshi@ghostsinthelab.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>