- Zig 83.7%
- Nix 16.3%
| src | ||
| .envrc | ||
| .gitignore | ||
| build.zig | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
Virtual Tablet Mode Switch for Surface Pro Typecovers
This programs listens to HID reports via hidraw to detect whether to emit a SW_TABLET_MODE event.
It activates tablet mode when the typecover is folded back or removed.
Tablet mode is deactivated when the typecover is reattached or brought back into normal position.
It needs to access /dev/hidraw[x] and /dev/uinput, it's probably easiest to just run it as root in a systemd service.
It logs the relevant HID report (ReportID 0x23) to stdout.
When it is installed as a systemd service, you can look at the logs with journalctl -xef -u tablet-mode.service.
Binary release
You can download the binary from here: https://dev.ostylk.de/NixDistro/tablet-mode/releases/tag/v0.1
Compiling
Dependencies:
libudev
libevdev
zig 0.9.1 compiler (https://ziglang.org/download/0.9.1/zig-linux-x86_64-0.9.1.tar.xz)
Just enter the projects directory and execute:
zig build -Drelease-safe
The binary is located at ./zig-out/bin/tablet-mode.
systemd service file
A basic systemd service might look like this (provided the binary is under /usr/local/bin/tablet-mode):
[Unit]
Description=Surface Pro Typecover tablet mode switch service
[Service]
ExecStart=/usr/local/bin/tablet-mode
[Install]
WantedBy=multi-user.target