You are not logged in.

#1 2016-11-16 11:55:29

stevebob
Member
Registered: 2012-01-12
Posts: 8

Macbook 12" 2016 keyboard backlight

I have arch working reasonably well on a 2016 12" Macbook. I can't work out out to turn on the keyboard backlight. On other mac laptops I've used "/sys/class/leds/smc::kbd_backlight" to set the backlight brightness, but that directory isn't present. I have the kernel module "applesmc" loaded (is that module responsible for the leds?).

Possibly related, I have a capslock led directory. Pressing the capslock key toggles the value in "brightness" between 0 and 1, but the capslock led never turns on, even when I write a 1 to the file.

$ ls /sys/class/leds/input6::capslock
power/  brightness  device  max_brightness  subsystem  trigger  uevent

Also possibly related, unlike most mac laptops, the keyboard (and trackpad) aren't connected by internal usb, but by spi. I'm using this driver with a kernel I compiled myself.

Any ideas what the problem might be?

Offline

#2 2016-11-16 12:15:22

stevebob
Member
Registered: 2012-01-12
Posts: 8

Re: Macbook 12" 2016 keyboard backlight

More information:

$ dmesg | grep applesmc:
[    4.419517] applesmc: key=685 fan=0 temp=37 index=36 acc=0 lux=2 kbd=0

Looking at the code in the applesmc module that prints that, it looks like it's not detecting the backlight:

    pr_info("key=%d fan=%d temp=%d index=%d acc=%d lux=%d kbd=%d\n",
           s->key_count, s->fan_count, s->temp_count, s->index_count,
           s->has_accelerometer,
           s->num_light_sensors,
           s->has_key_backlight);

The module seems to determine the presence of features by querying a key value store. The key corresponding to the keyboard backlight is:

#define BACKLIGHT_KEY›  ›   "LKSB" /* w-o {lkb (2 bytes) */

Is anyone familiar with how the key value store is populated? Could it be that on this laptop a different key is used for the backlight?

Offline

#3 2016-11-16 14:50:39

stevebob
Member
Registered: 2012-01-12
Posts: 8

Re: Macbook 12" 2016 keyboard backlight

Assuming the backlight is controlled by the SMC, it looks like the 12" macbook uses a different name for the SMC entry (other than "LKSB"). It looks like the SMC key names are not public, or at least I can't find them. I found a tool for dumping the contents of an SMC entry for a given key: https://github.com/jballard1991/softwar … cDumpKey.c, but there's no way to list all valid keys short of brute forcing all of them, and even if I had a list of all valid keys, I don't know how I'd work out which one corresponds to the backlight. Some of the SMC entries relate to power management, so I don't really want to try writing to random entries until one works in case I break something.

Does anyone know if the keyboard backlight is controlled by the SMC, and if so, how one might go about finding the corresponding key?

Offline

#4 2017-07-29 18:57:14

vasavest
Member
Registered: 2017-06-09
Posts: 9

Re: Macbook 12" 2016 keyboard backlight

stevebob wrote:

Also possibly related, unlike most mac laptops, the keyboard (and trackpad) aren't connected by internal usb, but by spi. I'm using this driver with a kernel I compiled myself.

Would it be possible for you to explain how you did this? I have arch running relatively well, the only things left to figure out are the problems pertaining to the keyboard. Any help or direction is very, very appreciated.
Thanks.

Offline

#5 2017-08-13 01:40:03

glenb77
Member
Registered: 2014-10-02
Posts: 68

Re: Macbook 12" 2016 keyboard backlight

Are you talking about a macbook 12 early 2016, model 9,1 ?? because i had to use the aur spi driver to get keyboard to work at all, but once that driver was installed the keyboard backlight worked fine. I am seeking a fix on sound and bluetooth. Are sound and bt working on your unit and is your unit an early 2016 9,1 machine ?

using current kernel 4.12 i still had to use kernel option 'intremap=nosid' to get it to boot. but the keyboard backlight works fine.

Offline

Board footer

Powered by FluxBB