- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3
Controlling Display and Keyboard Brightness Does not function on 2016 Macbook Pro, TouchBar #1
Description
Hello,
I am using your LightKit code in a project of mine, and I recently purchased a new 13" 2016 MacBook Pro, and I found that controlling the display and keyboard brightness does not work. I am receiving nil when I am initializing LightKit. This code works great on a 2015 MacBook Pro.
Here are some snippets showing how I am using your library:
Bringing Keyboard Brightness all the way down and back up:
import LightKit
func lowerAndRaiseKeyboardBrightness(){
    if let lk = LightKit() {
      // turning keyboard brightness all the way down
      for curLevel in [Int](0...10).reversed().map({Float($0) * Float(0.1)}) {
        _ = lk.setKeyboardBrightness(curLevel) // A value between 0 and 1.
        usleep(100000)
      }
      sleep(2) // waiting for the tester to evaluate
      
      // turning keyboard brightness all the way back up
      for curLevel in [Int](0...10).map({Float($0) * Float(0.1)}) {
        _ = lk.setKeyboardBrightness(curLevel) // A value between 0 and 1.
        usleep(100000)
      }
    } else {
      print("Light Sensors and Hooks not present")
    }
  }
Bringing Display Brightness all the way down and back up:
func lowerAndRaiseDisplayBrightness(){
    if let lk = LightKit() {
      // turning Display brightness all the way down
      for curLevel in [Int](0...10).reversed().map({Float($0) * Float(0.1)}) {
        _ = lk.setDisplayBrightness(curLevel) // A value between 0 and 1.
        usleep(100000)
      }
      sleep(2) // waiting for the tester to evaluate
      
      // turning Display brightness all the way back up
      for curLevel in [Int](0...10).map({Float($0) * Float(0.1)}) {
        _ = lk.setDisplayBrightness(curLevel) // A value between 0 and 1.
        usleep(100000)
      }
    } else {
      print("Light Sensors and Hooks not Present")
    }
  }
Both of my functions being are printing "Light Sensors and Hooks not Present" when they are run on my 2016 MacBook Pro with the TouchBar. When they run on my 2015 MacBook Pro, the keyboard and display brightness go down and up as expected. Both systems are running macOS 10.12.4 Beta 4.
I understand that you may not have a 2016 MacBook Pro with Touch Bar, so I would be glad to provide any information that you may need. I can get access to the 2016 MBP and take screenshots in IORegistryExplorer if that will help.
Thanks,
Mack