type
Post
status
Published
date
Nov 8, 2022
slug
summary
tags
YubiKey
category
Tutorial
icon
password
Property
Nov 8, 2022 09:14 PM
Sometimes, you might see the battery drained when YubiKey is plugged into your laptop. This is caused by the fact that YubiKey is recognized as a keyboard when plugged in, and it may prevent your laptop from going to sleep, thus draining your laptop battery over a period of time.
To fix this, we can force the laptop to enter hibernate mode by running the following command in the terminal:
sudo pmset -b hibernatemode 25 sudo pmset -b standbydelaylow 600
What this will do is force the laptop to enter hibernate mode when your laptop is not in use for
600
seconds and when the battery is lower than the threshold, which by default is 50%. The benefit of doing so is your battery will last longer, even longer when you don’t have YubiKey plugged in. But the downside is that it will take longer for your laptop to wake up when you open the lid.
You can change the
standbydelaylow
to meet your work style, for example, if you need to carry your laptops from meeting to meeting and don’t want it to enter hibernate mode too often even if the battery is low, you can increase the standbydelaylow
value to 1800
(30 min), 3600
(1 hour) or even higher if you prefer it that way. If you want better battery life and don’t mind waiting, you can lower the standbydelaylow
value to 60
(1 min) or lower.There are also other options that you can utilize:
highstandbythreshold
: The remaining battery threshold, by default it’s 50.
standbydelayhigh
: Configure how it will act when the battery is higher than the threshold, by default it’s 86400, which is 24 hours.
standbydelay
: Configure how it will act despite the battery.
- You can also check the current setting by running:
sudo pmset -g
Check out this webpage for more information on
pmset
: https://www.dssw.co.uk/reference/pmset/- Author:Jeffrey Hung
- URL:https://blog.jeffreyhung.com/article/5419a8e9-6769-49e3-9fa0-cc37fedf2bd2
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!