Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Basic backlight data collection script for Lantern
#!/bin/sh
# Basic backlight data collection script for Lantern
# Written by Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
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/"
fi
SCB=/sys/class/backlight
if [ -e $SCB ]; then
mkdir "$dest/backlight"
for device in $(ls $SCB); do
device_dest="$dest/backlight/$device"
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/"
done
fi
tar -Jcf "lantern-submission-$id.tar.xz" -C "$dest" .
rm -rf "$dest"
echo -- "$id"
Owner

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!

Owner

zyga commented Mar 15, 2015

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

Owner

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)"
http://www.zygoon.pl/2015/03/crowdsourcing-help-needed-share-your.html

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

Owner

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 github.com/zyga/lantern.

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