-
Notifications
You must be signed in to change notification settings - Fork 36
Description
This is a question towards @hishamhm.
I was looking into a (harmless but annoying) warning generated by /System/Tasks/PowerTOP upon boot.
However while looking into it, I have found that there used to be several, more elaborate versions of that Task in the past.
For instance PowerTOP 2.05's task looked as follows:
Recipes/PowerTOP/2.5/Resources/Tasks/PowerTOP
Lines 1 to 24 in bee961d
| #!/bin/bash | |
| function Has_Substring() { | |
| alt=${1/$2/} | |
| [[ "$alt" != "$1" ]] | |
| } | |
| ( | |
| powertop --auto-tune &> /dev/null | |
| for device in /sys/bus/usb/devices/* | |
| do | |
| if [[ -e $device/product ]] | |
| then | |
| product=$(<$device/product) | |
| # Do not auto-suspend keyboards and mice | |
| if Has_Substring "$product" "Keyboard" || Has_Substring "$product" "Mouse" | |
| then | |
| echo 'on' > $device/power/control | |
| fi | |
| fi | |
| done | |
| ) & |
The task used to selectively turn off auto-suspend for mice and keyboards (which sounds reasonable to me).
Then with PowerTOP 2.08, a much more simplified version got introduced:
Recipes/PowerTOP/2.8/Resources/Tasks/PowerTOP
Lines 1 to 11 in bee961d
| #!/bin/bash | |
| ( | |
| powertop --auto-tune &> /dev/null | |
| for device in /sys/bus/usb/devices/* | |
| do | |
| # Do not auto-suspend USB devices | |
| echo 'on' > $device/power/control | |
| done | |
| ) & |
The difference here is, that it simply disables auto-suspend for all USB devices (looks a bit more brute-force).
However, to make it more confusing, then comes PowerTOP 2.10 - which again features the more elaborate script from version 2.05. Even iterated upon by selecting "Receiver" USB devies as well (Wifi dongles maybe?) along with "Keyboard" and "Mouse" from before:
Recipes/PowerTOP/2.10/Resources/Tasks/PowerTOP
Lines 1 to 24 in bee961d
| #!/bin/bash | |
| function Has_Substring() { | |
| alt=${1/$2/} | |
| [[ "$alt" != "$1" ]] | |
| } | |
| ( | |
| powertop --auto-tune &> /dev/null | |
| for device in /sys/bus/usb/devices/* | |
| do | |
| if [[ -e $device/product ]] | |
| then | |
| product=$(<$device/product) | |
| # Do not auto-suspend keyboards and mice | |
| if Has_Substring "$product" "Keyboard" || Has_Substring "$product" "Mouse" || Has_Substring "$product" "Receiver" | |
| then | |
| echo 'on' > $device/power/control | |
| fi | |
| fi | |
| done | |
| ) & |
Then the next version, PowerTOP 2.11 (the one actually present in GoboLinux 017), again features the simpler less elaborate revision from 2.08:
Recipes/PowerTOP/2.11/Resources/Tasks/PowerTOP
Lines 1 to 11 in bee961d
| #!/bin/bash | |
| ( | |
| powertop --auto-tune &> /dev/null | |
| for device in /sys/bus/usb/devices/* | |
| do | |
| # Do not auto-suspend USB devices | |
| echo 'on' > $device/power/control | |
| done | |
| ) & |
I am a bit puzzled now which revision of the tasks to prefer....
It was a bit hard to follow the exact history of what happened, but actually I've found the diff that introduced the simplifed version for PowerTOP 2.08: ab9ea06#diff-4e6613aa06a889dfada96f7abc6a84a7a8507c66519c44933823bd3ad01bf910. No explanation is given unfortunately.
Given the messy history, I am on the fence whether the simplified version was included on purpose - or by mistake.
Personally, I tend to think that it makes more sense to disable auto-suspend just for keyboards and mice, rather than all USB devices! 🤔
@hishamhm I'd appreciate if you could try to remember how this came about, or which version you'd prefer if you had again the choice. :) ty!!