Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Basic backlight data collection script for Lantern
# Basic backlight data collection script for Lantern
# Written by Zygmunt Krynicki <>
set -x
id=$(cat /proc/sys/kernel/random/uuid)
dest=$(mktemp -d --suffix=-lantern)
lspci > "$dest/lspci"
lsmod > "$dest/lsmod"
uname -a > "$dest/uname"
if [ -e /etc/os-release ]; then
cp /etc/os-release "$dest/"
if [ -e $SCB ]; then
mkdir "$dest/backlight"
for device in $(ls $SCB); do
mkdir "$device_dest"
cp "$SCB/$device/max_brightness" "$device_dest/"
cp "$SCB/$device/actual_brightness" "$device_dest/"
cp "$SCB/$device/brightness" "$device_dest/"
cp "$SCB/$device/type" "$device_dest/"
tar -Jcf "lantern-submission-$id.tar.xz" -C "$dest" .
rm -rf "$dest"
echo -- "$id"

zyga commented Mar 15, 2015

This doesn't seem to work on the BQ phone. All the interesting values there are in/sys/class/leds/lcd-backlight. Awww, android, how I hate thee!


zyga commented Mar 15, 2015

The same is true on Nexus 7 which uses /sys/class/leds/lcd-backlight (hmm, pattern!)


zyga commented Mar 15, 2015

NOTE: This script is designed for Laptops. I'll prepare a second version later once I work on some extra tooling and have more questions to ask about the mobile world with Android kernel.

mikini commented Mar 16, 2015

"(nothing sensitive or personally-identifiable though)"

Somebody might regard the uname -a reported hostname (which by default on most systems includes a username) as sensible.

This could do it:
uname -a |sed s/uname -n/fake-host/g


zyga commented Mar 16, 2015

Oh, good point about the hostname! I didn't realize that.

I'll change how uname gets invoked so that we don't have this needless piece of info. I'm currently working on a much much better (though far more complex) version that can do some useful manual tests as well. I'll post it to the main tree at

In the meantime, you can open issues on the current version of the script there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment