Read manufacturer manual: http://h10032.www1.hp.com/ctg/Manual/c05819688 (archived link).
Install PowerTOP (https://01.org/powertop/) and TLP (https://linrunner.de/en/tlp/tlp.html) tools.
sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install powertop tlp tlp-rdw
Default TLP configuration should be enough to have a more efficient power consumption.
Since this is a gaming laptop, you want to get the juice out of this computer when you want to play a demanding game. In order to achieve that automatically and avoiding the hassle of having to tune things manually, is why Feral Interactive's Gamemode (https://github.com/FeralInteractive/gamemode) exists.
You can compile and install it manually following the instructions in the github repo, or you can install it precompiled and prepackaged by a community user (this version may not be up to date to the publisher's repo):
sudo add-apt-repository ppa:samoilov-lex/gamemode
sudo apt-get update
sudo apt-get install gamemode
Once installed, you can enable gamemode by preloading a gamemode's library when running (could be done using a shell script to avoid having to type it each time is run):
LD_PRELOAD=/usr/\$LIB/libgamemodeauto.so.0 <game executable>
Or in the case of Steam games, it can be configured in steam launch options:
LD_PRELOAD=$LD_PRELOAD:/usr/\$LIB/libgamemodeauto.so.0 %command%
Also is recommended to create a gamemode configuration file to greater personalisation. An example of a gamemode.ini file in /home/USERNAME/gamemode.ini could be found in https://github.com/FeralInteractive/gamemode/blob/master/example/gamemode.ini
Install howdy (https://github.com/Boltgolt/howdy).
- Run:
sudo add-apt-repository ppa:boltgolt/howdy
sudo apt update
sudo apt install howdy
- Once installed, you will need to add a face model to be recognized. Run the following command (prepend "sudo" if needed):
howdy -U <username> add
Once the face model is saved, you can test it by logging out and logging in again. It works well in GDM and LightDM. Not tested in other session managers.
It works as this:
- Once you chose your user account, it will turn on IR camera and scan your face. If your face matches the face model saved previously, it will log in without needing to type the password. If there isn't a match, it will show a message and will allow to type the password. Howdy also works when elevated rights are required, so be careful and configure this feature properly.
Due to lack of manufacturer support, hardware support has to be made by the FOSS community and takes time. Currently there is a flood of an ACPI event (interrupt 0x6f) that makes increase CPU usage and hence power consumption. To stop this issue that impacts a lot in battery usage, has to be told to kernel to ignore this event, and this could be done in one of the following ways.
Run as root:
echo disable > /sys/firmware/acpi/interrupts/gpe6F
Should be noted that this is not permanent and have to be executed each time system is rebooted.
The option in the section above can be performed automatically in order to a less annoying experience.
Please read https://gist.github.com/StefanoBelli/0aab46b858a797c4eedb90e8799dffa2 in order to do this.
In order to achieve this, GRUB (or the boot manager used) has to be configured to send a parameter to kernel.
- Open GRUB configuration file`
sudo nano /etc/default/grub
- You will find a line like this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash $vt_handoff"
- Edit GRUB_CMDLINE_LINUX_DEFAULT (and GRUB_CMDLINE_LINUX if you want too) to add between the quotes the parameter to mask the General Purpose Event 0x6f: "acpi_mask_gpe=0x6f". For example, that will change to:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash $vt_handoff acpi_mask_gpe=0x6f"
- Save and close the file.
- Update grub by running
sudo update-grub
- Restart
To get more information about this, please read https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.txt
Disable Secure Boot, otherwise NVIDIA proprietary driver could not be loaded and wifi card will not be detected (maybe wifi card is using a closed source fw blob?).
To disable Secure Boot:
- BIOS/UEFI firmware settings should be accessed: right while laptop is booting, quickly press ESC key, and a screen with some options will appear. Press the key associated with "BIOS Configuration" option (may be F10).
- In screen "System Configuration", choose "Boot Options". There, set "Secure Boot" to "Disabled"-
- Press F10 to save settings and restart.
Install NVIDIA proprietary driver for better graphics performance and because Nouveau driver has issues with suspend: it suspends but does not resume properly, leaving screen off. It may be done through "Software & Updates" tool, "Additional Drivers" section; or using command line. If using default repository, the driver version could not be the latest available (396 branch), but the latest long-term support available (at the moment 390 branch).
Should be noted that if you choose to use NVIDIA proprietary drivers, you won't be able to use Wayland graphic server because proprietary driver has only Xorg support.
Using "Additional Drivers" GUI, just will be enough to choose NVIDIA proprietary driver instead of Xorg opensource driver. Once chosen, click "Apply Changes" and if there wasn't any problems, then restart.
You can check if your laptop has NVIDIA card using the following command:
lspci | grep "VGA"
If turns out that you have two "VGA" devices (Intel Graphics and NVIDIA) remember that you will need nvidia-prime either bumblebee.
Run
sudo ubuntu-drivers autoinstall
To use latest driver available (at the moment 396 branch) even if it isn't LTS, please read https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa
If something went wrong, or after a kernel update screen is black or Xorg server is unable to load, go to a text TTY (Ctrl+Alt+F), log in, and remove nvidia proprietary drivers:
sudo apt-get purge nvidia-*
sudo reboot
After that, restart. You can install proprietary drivers later.
Hardware brightness control with buttons (Fn+F1 and Fn+F2) does not work out of the box using proprietary NVIDIA driver in default Ubuntu experience (GNOME), but it works out of the box in KDE and Mate (not tested in other desktop environments).
Brightness seems not to work with Nouveau graphics driver.
Brightness can also be configured with xbacklight tool. A workaround to be able to configure brightness in GNOME is by using xbacklight and GNOME custom key bindings:
- Create a PolicyKit action
sudo nano /usr/share/polkit-1/actions/local.enable-unprivileged-xbacklight-local-access.policy
- Paste the following text:
<?xml version="1.0! encoding="UTF-8" ?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
<policyconfig>
<action id="local.enable-unprivileged-xbacklight-local-access.policy">
<message xml:lang="en">No admin privileges are required to locally set screen brightness.</message>
<icon_name />
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/xbacklight</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>
- Save and close the file.
Now that is not needed to run xbacklight as root, using GNOME keybindings tool in GNOME Settings app could be created two custom key combinations to increase and decrease brightness with two key combinations by clicking "+" button, for example:
Name='Decrease screen brightness'
Command='/usr/bin/xbacklight -dec 10'
Combination='<Shift>F1'
and
Name='Increase screen brightness'
Command='/usr/bin/xbacklight -inc 10'
Combination='<Shift>F2'
Airplane Mode is automatically enabled after lid is closed in GNOME. This behaviour seems not to happen in GDM screen, just in GNOME Shell. In order to avoid this, should be created a service that sets certain keycodes (source - https://askubuntu.com/a/965596):
- Create a text file
sudo nano /etc/systemd/system/hp-keycodes.service
- Paste the following text
[Unit]
Description=HP setkeycodes fix
[Service]
Type=oneshot
Restart=no
RemainAfterExit=no
ExecStart=/usr/bin/setkeycodes e057 240 e058 240
[Install]
WantedBy=rescue.target
WantedBy=multi-user.target
WantedBy=graphical.target
- Save the file
- Reload systemd daemons
sudo systemctl daemon-reload
- Enable the service created above
sudo systemctl enable hp-keycodes.service
- Restart
sudo reboot
At the moment, some media keys may not work. Some of the media keys works directly, some other through HP-WMI kernel interface, and a few doesn't work because even if they are a WMI implementation in firmware, are not implemented in kernel driver yet.
- "Fn+F1" and "Fn+F2" (brighness control keys) doesn't seem to work outside of Xorg server, but it is detected. Please see above.
- "Fn+F3" media key works even if it seems not to work. It will work once you attach a secondary screen device.
- "Fn+F4" (keyboard backlight) works out of the box without having to install anything at all. This could be because this function was implemented via keyboard firmaware.
- "Fn+F5" to "Fn+F7" (volume control keys) works well, and "Fn+F8" to "Fn+F10" (multimedia playback control keys) works after a media app is loaded.
- Like keyboard backlight, "Fn+F11" (Enable/Disable touchpad) and "Fn+F12" (Enable/Disable Super/Windows key) works by default.
- "Fn+Ins" (Enable/Disable Airplane Mode) doesn't seem to work.
- "Omen" key doesn't work at all. It's a dead function key that stole "Home" key its place. It is detected by HP-WMI kernel module but not recognized as a supported event. May be necessary to modify HP-WMI kernel module to load a feature that enables user to send a "Home pressed" and "Home released" keycodes when this key is pressed and released. However, in the meantime, you can use either the Home key in keypad (you have to turn off keypad-press Home-turn on keypad each time) or press Fn+Omen keys (https://h30434.www3.hp.com/t5/Gaming-Notebooks/How-to-get-Home-button-on-Omen-an-055-ur/m-p/6836831/highlight/true#M12056).
More information about WMI (Windows Management Instumentation) in firmware and hp laptops:
- https://github.com/torvalds/linux/blob/master/drivers/platform/x86/hp-wmi.c
- http://manpages.ubuntu.com/manpages/bionic/man4/acpi_hp.4freebsd.html
Even though Wifi card and linux drivers are capable of this feature, this will not work. Miraclecast (https://github.com/albfan/miraclecast), open source implementation of Miracast, didn't work.