diff --git a/func.d/30-tlp-func-rf-sw b/func.d/30-tlp-func-rf-sw index 17d31328..b940f7e6 100644 --- a/func.d/30-tlp-func-rf-sw +++ b/func.d/30-tlp-func-rf-sw @@ -391,6 +391,8 @@ set_radio_device_states () { # then re-enable wifi on shutdown to prepare for startup if wordinlist "wifi" "$DEVICES_TO_DISABLE_ON_BAT $DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE + $DEVICES_TO_DISABLE_ON_SAV + $DEVICES_TO_DISABLE_ON_SAV_NOT_IN_USE $DEVICES_TO_DISABLE_ON_LAN_CONNECT $DEVICES_TO_DISABLE_ON_WIFI_CONNECT $DEVICES_TO_DISABLE_ON_WWAN_CONNECT" && \ @@ -406,9 +408,9 @@ set_radio_device_states () { devs2disable="" ;; - "$PP_BAL"|"$PP_SAV") # balanced/power-saver profile --> build disable list + "$PP_BAL") # balanced profile --> build disable/enable lists quiet=1 # do not display progress - devs2enable="" + devs2enable="${DEVICES_TO_ENABLE_ON_BAT:-}" devs2disable="${DEVICES_TO_DISABLE_ON_BAT:-}" # check configured list for connected devices @@ -424,6 +426,24 @@ set_radio_device_states () { devs2disable="${devs2disable# }" ;; + "$PP_SAV") # power-saver profile --> build disable/enable lists + quiet=1 # do not display progress + devs2enable="${DEVICES_TO_ENABLE_ON_SAV:-}" + devs2disable="${DEVICES_TO_DISABLE_ON_SAV:-}" + + # check configured list for connected devices + for dev in ${DEVICES_TO_DISABLE_ON_SAV_NOT_IN_USE:-}; do + # if device is not connected and not in list yet --> add to disable list + { case $dev in + bluetooth) any_bluetooth_in_use ;; + nfc) any_nfc_in_use ;; + wifi) any_wifi_in_use ;; + wwan) any_wwan_in_use ;; + esac } || wordinlist "$dev" "$devs2disable" || devs2disable="$dev $devs2disable" + done + devs2disable="${devs2disable# }" + ;; + esac echo_debug "rf" "set_radio_device_states($1): enable=$devs2enable disable=$devs2disable" "$LOG_INFO" diff --git a/tlp.conf.in b/tlp.conf.in index ec3e6a80..1e53d3ef 100644 --- a/tlp.conf.in +++ b/tlp.conf.in @@ -558,20 +558,44 @@ #DEVICES_TO_ENABLE_ON_AC="bluetooth nfc wifi wwan" -# Radio devices to disable when switching to the balanced or power-saver -# profile: +# Radio devices to enable when switching to the balanced profile: +# bluetooth, nfc, wifi, wwan. +# Default: + +#DEVICES_TO_ENABLE_ON_BAT="bluetooth nfc wifi wwan" + +# Radio devices to enable when switching to the power-saver profile: +# bluetooth, nfc, wifi, wwan. +# Default: + +#DEVICES_TO_ENABLE_ON_SAV="bluetooth nfc wifi wwan" + +# Radio devices to disable when switching to the balanced profile: # bluetooth, nfc, wifi, wwan. # Default: #DEVICES_TO_DISABLE_ON_BAT="bluetooth nfc wifi wwan" +# Radio devices to disable when switching to the power-saver profile: +# bluetooth, nfc, wifi, wwan. +# Default: + +#DEVICES_TO_DISABLE_ON_SAV="bluetooth nfc wifi wwan" + # Radio devices to disable when not in use (not connected) and switching -# to the balanced or power-saver profile: +# to the balanced profile: # bluetooth, nfc, wifi, wwan. # Default: #DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth nfc wifi wwan" +# Radio devices to disable when not in use (not connected) and switching +# to the power-saver profile: +# bluetooth, nfc, wifi, wwan. +# Default: + +#DEVICES_TO_DISABLE_ON_SAV_NOT_IN_USE="bluetooth nfc wifi wwan" + # Battery Care -- Charge thresholds # Charging will start once the charger is connected and the battery level # is below the start threshold. Charging stops when the battery level