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" WAKEUPRTC="/sys/class/wakeup/wakeup1/active_count"
MODEMUPRTC="/sys/class/wakeup/wakeup10/active_count" MODEMUPRTC="/sys/class/wakeup/wakeup10/active_count"
NETWORKRTCSCAN="/sys/module/8723cs/parameters/rtw_scan_interval_thr" 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_RTC_WAKECOUNT="$XDG_RUNTIME_DIR/wakeup.rtc.count"
OLD_MODEM_WAKECOUNT="$XDG_RUNTIME_DIR/wakeup.modem.count" OLD_MODEM_WAKECOUNT="$XDG_RUNTIME_DIR/wakeup.modem.count"
OLD_POWER_WAKECOUNT="$XDG_RUNTIME_DIR/wakeup.power.count"
saveAllEventCounts() { saveAllEventCounts() {
cat "$WAKEUPRTC" > "$OLD_RTC_WAKECOUNT" cat "$WAKEUPRTC" > "$OLD_RTC_WAKECOUNT"
cat "$MODEMUPRTC" > "$OLD_MODEM_WAKECOUNT" cat "$MODEMUPRTC" > "$OLD_MODEM_WAKECOUNT"
cat "$POWERRTC" > "$OLD_POWER_WAKECOUNT"
# TODO: add logic for modem wakeup # TODO: add logic for modem wakeup
} }
whichWake() { whichWake() {
if [ "$(cat "$WAKEUPRTC")" -gt "$(cat "$OLD_RTC_WAKECOUNT")" ] ; then if [ "$(cat "$POWERRTC")" -gt "$(cat "$OLD_POWER_WAKECOUNT")" ] ; then
echo "rtc" echo "usb power"
elif [ "$(cat "$MODEMUPRTC")" -gt "$(cat "$OLD_MODEM_WAKECOUNT")" ] ; then elif [ "$(cat "$MODEMUPRTC")" -gt "$(cat "$OLD_MODEM_WAKECOUNT")" ] ; then
echo "modem" echo "modem"
elif [ "$(cat "$WAKEUPRTC")" -gt "$(cat "$OLD_RTC_WAKECOUNT")" ] ; then
echo "rtc"
else else
# button does not have a active count so if it's none of the above, it has to be the button # button does not have a active count so if it's none of the above, it has to be the button
echo "button" echo "button"

Loading…
Cancel
Save