What is the most simple way to check if the executing platform is laptop or desktop? If i need to check the files in /sys/class/power_supply/ which file should i go for? Thanks
What about checking if there is a Lid? This should work with Ubuntu – acpi:
if [ -d "/proc/acpi/button/lid" ]; then
echo "computer is a laptop"
fi
You only think you care about distinguishing laptops from desktops. What you really care about is simply whether /sys/class/power_supply/ exists.
if [ -d "/sys/class/power_supply" ]; then
# Work with the files in /sys/class/power_supply
fi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With