Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cafeina-software/744b1e02d52ae685fc1513f68b6dd6d9 to your computer and use it in GitHub Desktop.
Save cafeina-software/744b1e02d52ae685fc1513f68b6dd6d9 to your computer and use it in GitHub Desktop.

Setting up a OMEN by HP laptop 15-ce000 with GPU (GTX 1060) in Ubuntu 18.04

Technical information

Read manufacturer manual: http://h10032.www1.hp.com/ctg/Manual/c05819688 (archived link).

Tweaks

Monitor and improve power-saving, and increase battery life

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.

Increase performance automatically when you want to play demanding games

ℹ️ Information
Part of the following text in this section is outdated and just kept for reference in case is needed.
Nowadays and since Ubuntu 20.04 onwards, gamemode is included by default in main and updates channels, so to install it you have to do it from Ubuntu Software or run in terminal sudo apt install gamemode.
To run steam games with gamemode, whether you installed from the repository or from source in newer releases, you have just to set the following advanced launch option: gamemoderun %command%.

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

Enable biometric authentication through IR camera (Windows Hello™ like)

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.

Solving problems

Disable high CPU usage due to certain ACPI event flood

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.

Manually disable interrupt via /sys/firmware/acpi interface

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.

Perform the above automatically

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.

Mask event by sending a parameter to the kernel

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 in firmware

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

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.

Install LTS driver using "Additional Drivers" tool

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.

Install LTS driver using command line

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

Enable and install short term support driver (396 branch)

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

After rebooting and loading kernel, screen turned black

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.

Brightness control

⚠️ Warning
The following instructions (regarding usage of xbacklight) may be outdated and no longer needed, and brightness control may work out of the box under certain circumstances. Please read later if your brightness does not work even with xbacklight with v470.

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'

Brightness does not work at all

ℹ️ Information
New information added, updated in 2021-08-02.

Under Ubuntu 20.04, brightness control and brightness capability may not work at all (even "xbacklight trick" not working anymore). I could not find exactly the cause of this regression, but I tested proprietary drivers nvidia-450 and nvidia-460 and with both drivers brightness works, but as of 2021-08-02 brightness will not work with proprietary driver v470.

I tested the v470 with and without the following without any success at the moment:

  1. Add the following lines to the file "/etc/initramfs-tools/modules"
nvidia
nvidia-drm
nvidia-modeset
  1. Run "sudo update-initramfs -u" in the terminal
  2. Reboot
  • Adding Option "RegistryDwords" "EnableBrightnessControl=1" to Xorg configuration files (/usr/share/X11/xorg.conf.d/10-nvidia.conf or /etc/X11/xorg.conf). For example:
Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "RegistryDwords" "EnableBrightnessControl=1"
    ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
EndSection
  • Adding certain kernel boot parameters such as acpi_backlight=[vendor|native|video|none] neither video.use_native_backlight=1.

Unless brightness is not an issue or an updated graphic drivers is required, until this is fixed we will have to stay with v460 version.

Avoid Airplane Mode being automatically enabled after lid is closed

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

Media keys

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 firmware.
  • "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. ** "Fn+Ins" works out of the box under Ubuntu 20.04.2 (Gnome 3.36.8, Kernel 5.8.0-63-generic x64).
  • "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:

Wireless connection

Wireless support

This device has a in-kernel driver (open source wrapper) that requires a proprietary firmware blob to work. Please make sure you install linux-firmware package to have functional wireless devices (this includes wifi and bluetooth).

Miracast/Wifi-Direct support

Even though Wifi card and linux drivers are capable of this feature, this does not seem to work even after installing firmware blob included in linux-firmware. Miraclecast (https://github.com/albfan/miraclecast), open source implementation of Miracast, didn't help.

@zeripath
Copy link

So after some sleuthing I've discovered that the keyboard backlight settings can read from ACPI from the name:

"\_SB_.WMID.LM02"

For example, the output from the default settings are:

echo "\_SB_.WMID.LM02" | sudo tee /proc/acpi/call > /dev/null && sudo cat /proc/acpi/call; echo

I get:

[0x0, 0x80, {0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x84, 0xfa, 0x71, 0x0f, 0xfa, 0xf9, 0x35, 0x0f, 0xfa, 0xac, 0x0f, 0x00, 0x00, 0x00,

which appears slightly truncated as the third section starting with '{' should be 128 bytes long. The values from 25-27 map to the RGB values for the first zone and so on (with the first zone being the far right, second being the zone with keys T-P, third being the WASD keys and fourth being the far left.

The setter should be _SB_.WMID.LM03 however, I'm a bit confused as to how to set this.

It appears that the windows code reads the array from the _SB_.WMID.LM02 and then should just paste it back with the values from 25-36 changed to represent the new values - but I'm having difficult replicating the call from the command line. I suspect that in the truncated section there may be some non-zero values or I don't have the syntax correct.

Brightness appears to be got from LM04 and set with LM05

[0x0, 0x4, {0xe4, 0x00, 0x00, 0x00}]

where the first value is the value of the brightness - again I believe LM05 requires a 4 byte array similarly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment