NVME powersaving script
#11
(07-06-2020, 06:32 PM)squidd Wrote: also, a TL;DR for the script

sudo nano /usr/bin/nvmelowpower.sh

#!/bin/sh sudo nvme set-feature /dev/nvme0 -f 2 -v 2

sudo nano /usr/bin/nvmehighpower.sh

#!/bin/sh sudo nvme set-features /dev/nvme0 - 2 -v 0

sudo nano /etc/sudoers

username ALL=(ALL) NOPASSWD: /usr/bin/nvme

sudo chmod a+x /usr/bin/nvmelowpower.sh

sudo chmod a+x /usr/bin/nvmehighpower.sh

open KDE System settings power management menu

Under the "On AC Power" tab under "Run Script" entered the script "/usr/bin/nvmehighpower.sh"

Under the "On Battery" tab under "run Script" enter "/usr/bin/nvmelowpower.sh"
I am probably the one to blame, but in looking at your TL;DR there are a few changes that need to be made:
the nvmehighpower.sh script needs to contain "sudo nvme set-feature /dev/nvme0 -f 2 -v 0" instead of what's there.

The corrected Tl;



Code:
sudo nano /usr/bin/nvmelowpower.sh



Code:
#!/bin/sh
sudo nvme set-feature /dev/nvme0 -f 2 -v 2

Power State 0 is full power, 1 is less and slower, 2 is even less and slower and on my drive power states 3 and 4 are non-operational.   I have used the following as a compromise:

Code:
#!/bin/sh
sudo nvme set-feature /dev/nvme0 -f 2 -v 1




Ctrl + X to exit then enter to save.

Code:
sudo nano /usr/bin/nvmehighpower.sh


Code:
#!/bin/sh
sudo nvme set-feature /dev/nvme0 -f 2 -v 0


Ctrl + X to exit and Enter to save.


Code:
sudo nano /etc/sudoers

At the bottom of the file add substituting username with your actual username:

Code:
username ALL=(ALL) NOPASSWD: /usr/bin/nvme


Ctrl+X to exit and enter to save.



Code:
sudo chmod a+x /usr/bin/nvmelowpower.sh


Code:
sudo chmod a+x /usr/bin/nvmehighpower.sh

At this point I test each script to make sure they are working correctly.  For example, on my system it looks like this:

Code:
[user@pinebookpro ~]$ /usr/bin/nvmehighpower.sh
set-feature:02 (Power Management), value:00000000

[user@pinebookpro ~]$ /usr/bin/nvmelowpower.sh
set-feature:02 (Power Management), value:0x000001





open KDE System settings power management menu



Under the "On AC Power" tab under "Run Script" entered the script "/usr/bin/nvmehighpower.sh"



Under the "On Battery" tab under "run Script" enter "/usr/bin/nvmelowpower.sh"


Possibly Related Threads…
Thread Author Replies Views Last Post
  Selling my Pinebook Pro with a bootable NVMe WD SSD drive pinemouth 0 1,068 09-27-2023, 08:53 PM
Last Post: pinemouth
  Boot into NVME drive, no wifi, sound, buttons... PaulQ 0 1,084 07-13-2023, 01:50 PM
Last Post: PaulQ
  I'm booting from NVME but I want to switch back to eMMC acruhl 4 2,199 04-23-2023, 06:58 AM
Last Post: acruhl
  U-Boot with direct NVMe boot support for eMMC/SPI Flash pcm720 125 238,494 09-27-2022, 07:41 AM
Last Post: olyavi
  Selling Pinebook Pro (ISO) + nvme from Sweden DavidL 5 4,064 06-20-2022, 03:20 PM
Last Post: DavidL
  For Sale: Pinebook Pro 64gb ANSI with NVMe Adapter Lumat 2 2,456 04-24-2022, 01:42 AM
Last Post: kylexd
  Selling PineBook PRO with ISO Keyboard + NVME firefox-58 27 22,645 04-08-2022, 06:23 AM
Last Post: firefox-58
  Pinebook Pro (ANSI) with NVME 1TB (660p) for sale Fish 5 4,860 01-26-2022, 08:49 AM
Last Post: TRS-80
  Selling PineBook PRO with ANSI Keyboard + NVME woodeen 3 3,838 11-30-2021, 06:38 PM
Last Post: luca22
  Boot from NVME theboz1@verizon.net 2 2,764 10-22-2021, 07:58 PM
Last Post: theboz1@verizon.net

Forum Jump:


Users browsing this thread: 1 Guest(s)