- Shell 40.7%
- C 38.8%
- Nix 17.7%
- Python 2%
- Makefile 0.8%
| cli | ||
| docs | ||
| home | ||
| kernel | ||
| nix | ||
| test | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| instructions.md | ||
| LICENSE | ||
| PLAN.md | ||
| README.md | ||
| SECURITY.md | ||
HP Sure View on Linux
This repository controls the HP Sure View electronic privacy filter from Linux. It also exposes the privacy level. The privacy level is the brightness control that Sure View applies to the panel.
The target machine is an HP EliteBook x360 830 G8. The host runs NixOS 26.11 with kernel 6.18.65.
Status: the protocol is reverse-engineered and verified on the target machine. The state read, the write path, and the keyboard shortcut work live. No BIOS password is needed.
What HP Sure View is
HP Sure View is a panel privacy layer. When it is on, the viewing angle becomes narrow. Light that leaves the panel at a wide angle is blocked. The panel therefore looks dimmer to the user, even though the normal panel backlight did not change.
The state has three useful parts:
off,on, orforced_on.- A visibility percentage from 0 to 100.
- 0 means maximum privacy and maximum dimming.
- 100 means minimum privacy and no extra dimming.
- A capability flag. Bit 0 means the panel has a touch UI.
HP also exposes a BIOS setting called Force enable HP Sure View in
/sys/devices/virtual/firmware-attributes/hp-bioscfg/. That setting forces the
filter on at boot. It is not the runtime state.
How the Windows tool works
HP Client Management Script Library implements Get-HPSureViewState,
Set-HPSureViewState, and Test-HPSureViewIsSupported.
The PowerShell code calls HP.CMSLHelper.dll. That assembly calls
dfmbios64.dll. The native DLL sends a command through the HP BIOS WMI
interface.
The important values are:
| Item | Value |
|---|---|
| WMI GUID | 5FB7F034-2C63-45E9-BE91-3D44E2C707E4 |
| ACPI device | \_SB.WMIV |
| WMI namespace | root/WMI |
| WMI class family | hpqBIOSInt0, hpqBIOSInt4, hpqBIOSInt128, hpqBIOSInt1024, hpqBIOSInt4096 |
| WMI method | hpqBIntM |
| Sure View command | 0x3e |
| Read command type | 1 |
| Write command type | 2 |
The kernel hp-wmi driver already speaks the same interface. Its
hp_wmi_perform_query() helper builds this request:
struct bios_args {
u32 signature; /* 0x55434553, "SECU" */
u32 command; /* 1 = read, 2 = write */
u32 commandtype; /* 0x3e for Sure View */
u32 datasize;
u8 data[];
};
The WMI method ID selects the output buffer size:
| Output size | Method ID | Windows class |
|---|---|---|
| 0 | 1 | hpqBIOSInt0 |
| 1..4 | 2 | hpqBIOSInt4 |
| 5..128 | 3 | hpqBIOSInt128 |
| 129..1024 | 4 | hpqBIOSInt1024 |
| 1025..4096 | 5 | hpqBIOSInt4096 |
The response starts with an eight-byte header:
struct bios_return {
u32 sigpass;
u32 return_code;
};
The Sure View data follows the header.
Sure View read
Send command type 1, command 0x3e, no input data, and a four-byte output
buffer.
The output bytes are:
| Byte | Meaning |
|---|---|
| 0 | Status |
| 1 | Visibility, 0 to 100 |
| 2 | Capabilities, bit 0 = touch UI |
| 3 | Reserved |
Status values:
| Value | Meaning |
|---|---|
0xff |
Off |
0xfe |
On |
0xfc |
Forced on by firmware |
0xfa |
Not supported |
0x00 |
Unknown |
Sure View write
Send command type 2, command 0x3e, and four input bytes.
The first byte selects the mode:
| Byte 0 | Byte 1 | Meaning |
|---|---|---|
0xff |
0 | Off |
0xfe |
0 | On |
0xfd |
0 | On with maximum privacy |
0x00 |
0xff |
Increase visibility by one ten-percent step |
0x00 |
0xfe |
Decrease visibility by one ten-percent step |
The firmware changes visibility in ten-percent steps. To reach a target, send
the on command and then send the step command until the visibility matches.
The Windows code reads the current visibility after the on command and sends
abs(target - current) / 10 steps.
The Windows privacy level is the inverse of visibility. Privacy 100 means visibility 0. Privacy 0 means visibility 100.
This repository
kernel/hp_sureview.c- out-of-tree kernel module. It exposes/dev/hp_sureview.cli/hp-sureview- command-line interface.nix/module.nix- NixOS module.home/hp-sureview.nix- Home Manager menu for KDE Plasma.docs/reverse-engineering.md- evidence and analysis notes.
The module does not patch hp-wmi. It calls wmi_evaluate_method() for the
same GUID. hp-wmi, hp_bioscfg, and this module can coexist.
Build and test
Build the module against the kernel of your NixOS flake:
module=$(test/build.sh)
The result is a package with this path:
$module/lib/modules/<kernel-version>/updates/hp_sureview.ko.xz
Load it and read the state:
sudo test/load-and-read.sh --reload "$module"/lib/modules/*/updates/hp_sureview.ko.xz
The read is safe. It only queries the current state.
To test the write path, use the reversible smoke test:
sudo test/smoke-test.sh
The smoke test turns the filter off, on, to 50 percent privacy, and off again. Watch the screen while it runs.
NixOS install
Add the module to the host configuration:
{
imports = [
/home/lj/Projects/SureView/nix/module.nix
];
hardware.hpSureView.enable = true;
}
Alternatively, add the flake as an input and import
inputs.hp-sureview.nixosModules.default.
Rebuild the system. The module loads at boot. The udev rule gives the
video group read and write access to /dev/hp_sureview.
Check that your user is in the video group:
id -nG
Command line
hp-sureview status
hp-sureview status --json
hp-sureview off
hp-sureview on
hp-sureview privacy 80
hp-sureview privacy 50
hp-sureview up
hp-sureview down
hp-sureview toggle
hp-sureview privacy 0 turns the filter off. hp-sureview privacy 100 turns
it on with maximum privacy.
hp-sureview up and hp-sureview down change the privacy level in ten-percent
steps. They are suitable for KDE global shortcuts. up is brighter and down
is dimmer.
KDE Plasma
The Home Manager module adds an application menu entry called HP Sure View. It shows the current state and lets you choose a privacy level:
{
imports = [
/home/lj/Projects/SureView/home/hp-sureview.nix
];
}
The entry uses kdialog. It does not need root because the udev rule gives the
video group access to the device.
The Home Manager module also installs three wrapper commands that show a KDE notification:
hp-sureview-up- make the screen brighter.hp-sureview-down- make the screen dimmer.hp-sureview-toggle- toggle the filter.
Open System Settings > Shortcuts > Custom Shortcuts and bind these
commands. They live in ~/.local/bin.
The normal KDE brightness slider still controls the panel backlight. The Sure View privacy level is a second layer. The two controls add up.
Safety
The Sure View commands only change the privacy filter state. They do not write
BIOS settings and do not change the Force enable HP Sure View setting.
If a command leaves the panel in an unexpected state, run:
hp-sureview off
If the module is not available, a reboot restores the firmware default.
Verified behavior
- The response signature is
0x53534150(PASS). The request signature is0x55434553(SECU). - The state read returns
offoronwith the visibility value. - The keyboard privacy shortcut changes the state and emits HP WMI event 20.
The event data is
0xfefor on,0xfffor off, and0xNN00for a visibility step. - The write path works live. No reboot and no BIOS password are needed.
- The module is not upstream. It is an out-of-tree module.
- The firmware supports ten-percent steps only.
forced_onmeans the BIOS forces the filter on. Writes may fail in that state.
Keyboard backlight timeout
The keyboard backlight timeout is a separate BIOS setting. The stored value is applied by the EC at boot, so changing the sysfs value alone does not change the live timeout.
The live value is EC RAM byte 0x28 (KBBL):
| Timeout | EC 0x28 |
|---|---|
| 5 secs. | 0x45 |
| 15 secs. | 0x4f |
| 30 secs. | 0x5e |
| 1 min. | 0xc1 |
| 5 mins. | 0xc5 |
| Never. | 0x40 |
Seconds use 0x40 | seconds. Minutes use 0xc0 | minutes. Never is 0x40.
test/set-ec-timeout.sh writes the live byte. See test/README.md for
details.
The keyboard backlight brightness is separate. The EC does not expose a stable
brightness register, and WMI command 0x0d is not a usable setter. Plasma
therefore has no keyboard backlight slider for this machine. See
docs/keyboard-backlight.md.