2

My Macbook Air 2013 power lasts 1.5 hours with just too bright light. More than 7 hours with normal light (that is 30-40% of the current max) corresponding to my default brightness in OS X where the battery lasts 7-9 hours. I would like to have a one-liner of gsettings to make the change. There is a rapid jump in power consumption of display depending on the setting. I would like to find the optimum one for power consumption and usability.

I do

git clone https://github.com/patjak/mba6x_bl
Cloning into 'mba6x_bl'...
remote: Counting objects: 140, done.
remote: Total 140 (delta 0), reused 0 (delta 0), pack-reused 140
Receiving objects: 100% (140/140), 45.12 KiB | 0 bytes/s, done.
Resolving deltas: 100% (76/76), done.
Checking connectivity... done.

masi@masi:~/jacob$ cd mba6x_bl/

masi@masi:~/jacob/mba6x_bl$ make
make -C /lib/modules/4.4.0-22-generic/build M=/home/masi/jacob/mba6x_bl modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.0-22-generic'
  CC [M]  /home/masi/jacob/mba6x_bl/mba6x_bl.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/masi/jacob/mba6x_bl/mba6x_bl.mod.o
  LD [M]  /home/masi/jacob/mba6x_bl/mba6x_bl.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-22-generic'

masi@masi:~/jacob/mba6x_bl$ sudo make install
make -C /lib/modules/4.4.0-22-generic/build M=/home/masi/jacob/mba6x_bl modules_install
make[1]: Entering directory '/usr/src/linux-headers-4.4.0-22-generic'
  INSTALL /home/masi/jacob/mba6x_bl/mba6x_bl.ko
At main.c:222:
- SSL error:02001002:system library:fopen:No such file or directory: bss_file.c:175
- SSL error:2006D080:BIO routines:BIO_new_file:no such file: bss_file.c:178
sign-file: certs/signing_key.pem: No such file or directory
  DEPMOD  4.4.0-22-generic
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-22-generic'

where the errors are harmless. The result works in my system! Here is a ticket about the case.

Laptop: Macbook Air 2013-mid (6.2)
Ubuntu versions: 16.04
Linux kernel: 4.4 and 4.6
Status: deprecated feature request (RESOLVED NOTOURBUG) because no resources for the development for the adjustment of Apple Hardware for Linux at least on the Intel side. However, Patrik Jacobsen is working with it.

2 Answers2

1

I can't get gsettings to change the brightness on my laptop running Ubuntu 16.06, but I can change the brightness by storing a value in /sys/class/backlight/device-name/brightness where device-name is one of the video devices listed in /sys/class/backlight. In each of these directories there is a max_brightness file. To write to these files you will need to be root. So in my case, using the first of the 3 device directories (which in my case is acpi_video0),

$ ls /sys/class/backlight    # shows the video devices
acpi_video0    acpi_video1    radeon_bl0
$ cat /sys/class/backlight/acpi_video0/brightness   # shows current level
7
$ cat /sys/class/backlight/acpi_video0/max_brightness   # shows max level
10
$ sudo sh   # become super-user
# echo 3 > /sys/class/backlight/acpi_video0/brightness   # dim screen
# echo 10 > /sys/class/backlight/acpi_video0/brightness   # max brightness
# exit   # return to unprivileged user
$ sudo sh -c "echo 10 > /sys/class/backlight/acpi_video0/brightness"

The final line above gives a "one-liner" brightness change command.

You could extend this if desired to compute a fraction of brightness required based on max_brightness using the expr command.

P.S. My laptop is an Intel Compaq CQ62 so this may not solve the problem on a Macbook.

0

Just do which works in most cases of Macbook 6.2

git clone https://github.com/patjak/mba6x_bl && cd mba6x_bl/ && make && make install

The errors about SSL are harmless.