Skip to content

Instantly share code, notes, and snippets.

@zyga
Last active August 29, 2015 14:17
Show Gist options
  • Save zyga/b8f64858aab37e44cf65 to your computer and use it in GitHub Desktop.
Save zyga/b8f64858aab37e44cf65 to your computer and use it in GitHub Desktop.
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"
@zyga
Copy link
Author

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
Copy link

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

@zyga
Copy link
Author

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