cb22 / macbook12-spi-driver

WIP input driver for the SPI touchpad / keyboard found in the 12" MacBook (MacBook8,1 + MacBook9,1)
GNU General Public License v2.0
298 stars 103 forks source link

Driver should autosense ISO layout #44

Open l1k opened 7 years ago

l1k commented 7 years ago

Commit a7a73f0dbd485318b0f71405cf350106a6f826c7 introduced a command line parameter whether to assume an ISO keyboard layout.

For USB keyboards, the mainline kernel gained the ability to autosense an ISO layout with commit torvalds/linux@bd77a0f08ec57f7b805dfbaa64b36329dfa005d6 by looking at the bCountryCode field in the HID descriptor: 0x13 means ISO layout and e.g. 0x0d means German (de_DE) layout.

It seems likely that Apple used the same values and somehow communicates the country code either upon initialization or with every packet. The first step would thus be to look for 0x13 in data coming from the keyboard controller on a MacBook with ISO keyboard, then check if a German keyboard has 0x0d in the same byte position.

See also the mailing list discussion on the patch for USB keyboards.

jonas2515 commented 3 years ago

Just a little heads up here: I'm currently looking into why my Apple aluminium USB keyboard with german layout has those swapped keys and I've been digging through kernel history the whole day.

Please do not include a parameter that is necessary for unbreaking keyboards and leave them broken by default. That was done with the hid_apple iso_layout parameter and now we have a total mess where some keyboards work and some haven't been working for years, but nobody actually bothers to fix it because there's a parameter that can be set as a workaround.