add usb power as an unsuspend reason to sxmo_screenlock.sh

Signed-off-by: Stacy Harper <contact@stacyharper.net>
master
noneofyourbusiness 3 years ago committed by Stacy Harper
parent 672566c206
commit 9abfa620fe
No known key found for this signature in database
GPG Key ID: 5BAC92328B7C5D65
  1. 9
      scripts/core/sxmo_screenlock.sh

@ -13,21 +13,26 @@ BLUELED_PATH="/sys/class/leds/blue:indicator/brightness"
WAKEUPRTC="/sys/class/wakeup/wakeup1/active_count"
MODEMUPRTC="/sys/class/wakeup/wakeup10/active_count"
NETWORKRTCSCAN="/sys/module/8723cs/parameters/rtw_scan_interval_thr"
POWERRTC="/sys/class/wakeup/wakeup5/active_count"
OLD_RTC_WAKECOUNT="$XDG_RUNTIME_DIR/wakeup.rtc.count"
OLD_MODEM_WAKECOUNT="$XDG_RUNTIME_DIR/wakeup.modem.count"
OLD_POWER_WAKECOUNT="$XDG_RUNTIME_DIR/wakeup.power.count"
saveAllEventCounts() {
cat "$WAKEUPRTC" > "$OLD_RTC_WAKECOUNT"
cat "$MODEMUPRTC" > "$OLD_MODEM_WAKECOUNT"
cat "$POWERRTC" > "$OLD_POWER_WAKECOUNT"
# TODO: add logic for modem wakeup
}
whichWake() {
if [ "$(cat "$WAKEUPRTC")" -gt "$(cat "$OLD_RTC_WAKECOUNT")" ] ; then
echo "rtc"
if [ "$(cat "$POWERRTC")" -gt "$(cat "$OLD_POWER_WAKECOUNT")" ] ; then
echo "usb power"
elif [ "$(cat "$MODEMUPRTC")" -gt "$(cat "$OLD_MODEM_WAKECOUNT")" ] ; then
echo "modem"
elif [ "$(cat "$WAKEUPRTC")" -gt "$(cat "$OLD_RTC_WAKECOUNT")" ] ; then
echo "rtc"
else
# button does not have a active count so if it's none of the above, it has to be the button
echo "button"

Loading…
Cancel
Save