Skip to content

Instantly share code, notes, and snippets.

@defunctio
Created September 18, 2016 19:32
Show Gist options
  • Save defunctio/b544880c25036b33aa611edd53b42c53 to your computer and use it in GitHub Desktop.
Save defunctio/b544880c25036b33aa611edd53b42c53 to your computer and use it in GitHub Desktop.
Dell 5500 resume backlight fix in Ubuntu
#!/bin/sh
# From patchwork.freedesktop.org/.../
# and en.community.dell.com/.../19985320
# /lib/systemd/system-sleep/fixbacklight
# Suspend Resume fails to restore PWM_GRANUALITY
# Based on script by [email protected]
INTEL_REG=/usr/bin/intel_reg
ADDR="0x000c2000"
SAVE_FILE=/var/lib/systemd/save_intel_reg_pwm_granuality
[ -x "$INTEL_REG" ] || exit 0
case "$1" in
pre)
echo "$0: Saving Intel Register PWM_GRANUALITY"
"$INTEL_REG" read "$ADDR" \
| (read addr value && echo "$value") \
>"$SAVE_FILE"
sync
;;
post)
value=`cat "$SAVE_FILE" 2>/dev/null`
if [ -n "$value" ]
then
echo "$0: Restoring Intel Register PWM_GRANUALITY $value"
"$INTEL_REG" write "$ADDR" "$value"
rm "$SAVE_FILE"
fi
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment