On Sun, Apr 06, 2014 at 09:45:11PM +0200, Sven-Volker Nowarra wrote: > Hi, > > I am thinking about an approach to set the brightness on my > MacBook via standard keyboard keys. I can already call from the > commandline "wsconsctl display.brightness=xx", and it will arrive > in my asmc.c driver (thanx to Mark's hints). Now I want to use > the standard fn-keys on the keyboard. Other laptops (Thinkpad, > Toshiba?) have acpi usage, that does not work for the Mac. So I > thought I need to go through ukbd/wskbd. > > The brightness keys are FN-F1 (down) and FN-F2 (up), and keyboard > backlight FN-F5 (down) and FN-F6 (up). The MBPro has a USB type > keyboard, and in ukbd.c there is "void ukbd_apple_munge()" > prepared. Looking at the way audio is prepared, I seem to > understand, that ukbd.c translates key codes to values defined in > ukbdmap.c, and based on these values volume can be raised/lowered > in wskbd.c. Can I simply add equivalents in ukbdmap.c for > brightnes and backlight control? (is there a logic I'd violate, > when using numbers behind audio section?)
unlike audio, there's no standard "brighness key" scan-code code, so the implementation would probably be slightly different. > In wskbd.c: I was trying to find out the link between > "wskbd_set_mixervolume" and the function in audio.c. How would > wskbd.c know, it is in audio.c defined? There's a prototype at the beginning of the file wskbd.c. If NAUDIO > 0 then audio.c contents are compiled and wskbd_set_mixervolume() function is available. -- Alexandre