Skip to content

Add Tartarus V2 Pro support and a Deadlock profile - #1

Merged
PikkonMG merged 7 commits into
PikkonMG:mainfrom
Entharia:feat/tartarus-v2-pro
Nov 4, 2026
Merged

PikkonMG merged 7 commits into
PikkonMG:mainfrom
Entharia:feat/tartarus-v2-pro

Conversation

@Entharia

@Entharia Entharia commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Adds support for the Razer Tartarus V2 Pro (1532:02eb) and a Deadlock profile. I tested it on a real V2 Pro on Wayland. The V2 and Pro paths are unchanged.

Tartarus V2 Pro

  • Detects the pad and adds it to the udev rule.
  • Remaps its 27 keys, the four thumbstick directions and the stick click. The stick is a separate xpad node. The daemon grabs it only while the profile binds the stick, and otherwise leaves it to games.
  • The window draws its face: rows of 6/6/6/5/4, flush left, with the double-width keys, and the stick below. Keys are numbered 01–27 in reading order.
  • Key ids follow the V2 key that sends the same code, so existing profiles still work on the V2 Pro.

Per-model layouts

  • A profile can carry "model_bindings": { "v2pro": { ... } }, which replaces bindings on that model. Validation checks that the model is in device_models and that every key exists on it.
  • Edits made while a V2 Pro is connected go to its layout, and the window shows that layout. Profiles without one behave as before.
  • Every shipped profile gets a V2 Pro layout built for a small hand:
    • the busiest actions sit on the home row and the rows straight above and below it
    • the top row and the far right column hold only menus and maps
    • WASD games move with the stick, and the stick click does crouch, sprint or dodge
  • Tests enforce these rules. The rules are also written up in CONTRIBUTING.md.

Deadlock

  • A new shipped profile, built from the game's default PC binds, with a V2/Pro layout and a V2 Pro layout.

Fix: input lag and stuck stick directions

  • The device loop slept a fixed 250 ms whenever no events were waiting. On the V2 Pro's stick this caused lag, and it overflowed the kernel's event buffer, which could drop the return to the centre and leave a direction held.
  • The loop now waits on the device nodes with poll(2) and wakes on input. This also removes up to 250 ms of latency on key presses after a pause, on every model.

Thumbstick settings

  • Select a stick key in the window to set how the stick works. The mode is saved per profile:
    • Keys, 8 directions (default): each direction presses its key, and a diagonal holds two.
    • Keys, 4 directions: only the direction pushed furthest presses its key, with hysteresis so it doesn't flicker on diagonals.
    • Analog: left stick / Analog: right stick: games see the stick on a virtual controller ("OpenTartarus Controller"), with its full range. An unbound stick click becomes the controller's stick click.
  • A rotation slider turns the stick in 15° steps from −180° to 180°. It applies to every profile and is stored in the state file.
  • New IPC methods: SetStickMode and SetStickRotation. The status reply carries stick.rotation_deg.
  • Synapse can set the stick, per onboard profile, to report as the left stick, the right stick or a D-pad. All three are now read, so a layout keeps working when you switch onboard profiles on the pad. The right stick click also counts as the stick click.

Fix: udev uaccess never applied

  • The rule was 99-opentartarus.rules. systemd turns the uaccess tag into an ACL in 73-seat-late.rules, so a tag added at 99 came too late. The pad only worked once the opentartarus group took effect at the next login.
  • The rule is now 70-opentartarus.rules. The permissions helper writes the new name and removes the old /etc/udev/rules.d/99-opentartarus.rules it wrote before. A test checks the rule sorts before 73-seat-late.rules.

Fix: lighting never applied through OpenRazer

  • Devices were matched with razer.device.misc.getVid and getPid, which OpenRazer doesn't have. It has getVidPid, which returns both as an int32 array. No device ever matched, on any model, so every lighting call ended as lighting_error.
  • setWave was sent a byte, but OpenRazer declares it as int32.

Arch packaging

  • packaging/arch/PKGBUILD builds a pacman package from the checkout (makepkg -si).
  • It installs the same files as the deb, and a test keeps the file list and version in sync.
  • The README has an Arch section.

Checks

  • cargo fmt --all --check, cargo test --workspace (322 tests) and cargo clippy --workspace --all-targets -- -D warnings all pass.
  • Tried on hardware: key remaps, stick to WASD, stick click, the stick modes and rotation, every Synapse stick mode, the drawn layout, the udev ACL, lighting through OpenRazer (static, wave), and the Arch package install.
  • Not tried on hardware: the V2 and the Pro. Their code paths gained the per-model layout lookup, the poll-based wait, the udev rename and the OpenRazer matching fix. The matching fix should make lighting work on them for the first time.
  • Released OpenRazer doesn't know the V2 Pro yet; support is proposed upstream in Add support for Razer Tartarus V2 Pro openrazer/openrazer#2980. Until then, V2 Pro lighting needs a patched OpenRazer. Remaps work without it.

- Detect the Tartarus V2 Pro (1532:02eb) and grant it in the udev rule.
- Remap its 27 keys, thumbstick directions and stick click.
- Draw its face in the window: rows of 6/6/6/5/4, flush left, with
  double-width keys and the stick below.
- Let a profile carry its own layout per model (`model_bindings`). It
  replaces the shared layout on that model, and edits made on that pad
  land in it.
- Give every shipped profile a V2 Pro layout for a small hand: busy
  actions on the rest row and the rows beside it, menus on the far keys,
  WASD on the stick, and a stick click for crouch, sprint or dodge.
- Add a Deadlock profile from the game's default bindings.
The device loop slept a fixed 250 ms whenever no events were waiting.
The V2 Pro's thumbstick sends hundreds of events a second, so the stick
lagged, and the kernel's event buffer overflowed during the sleep. That
could drop the stick's return to the centre and leave a direction held.

The loop now blocks in poll(2) on the pad's nodes and wakes as soon as
input arrives. The 250 ms stays only as the longest wait for the
between-read checks.
packaging/arch/PKGBUILD builds a pacman package from the checkout it
sits in (`makepkg -si`). It installs the same files as the deb, plus the
licence, and its install script creates the opentartarus group and
reloads udev. A test keeps its file list and pkgver in step with the deb
metadata and the crate version.

The README gets an Arch section, with the log-out step that a new group
needs before the pad opens.
Say that the shipped profiles carry their own V2 Pro layout and bind its stick, that the V2 Pro was tried on real hardware, and list the Arch install in the release notes.
Each profile picks how the V2 Pro's stick works: 8-way keys, 4-way keys,
or an analog left or right stick on a virtual controller. A rotation in
15 degree steps applies to every profile and is kept in the state file.
The stick is now read whether Synapse set it to the left stick, the right
stick or the D-pad, and the right stick click counts as the stick click.
The rule was named 99-, after 73-seat-late.rules, so its uaccess tag
never became an ACL and the pad only worked once the opentartarus group
took effect at the next login. It is now 70-opentartarus.rules. The
permissions helper writes the new name and removes the old /etc copy.
OpenRazer exposes razer.device.misc.getVidPid, which returns both ids as
an int32 array. The getVid and getPid methods used before do not exist,
so no device ever matched and lighting never applied. setWave takes an
int32 direction, not a byte.

@PikkonMG PikkonMG left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, this is a big one and most of it looks good. the OpenRazer fix, the poll wait and the 70- rename all look right. one real bug in the stick mode switch (comment on remap.rs), the rest are small. CI has not run on it yet.


pub fn apply_profile(&mut self, p: &Profile) {
self.table = p.bindings_for_model(self.model);
self.stick_mode = p.stick_mode;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this swaps the mode without letting go of anything. hold the stick up in Keys8, pick an analog mode, and W stays down since handle_analog never calls apply_analog_dir again. other way round the virtual controller stays pushed because nothing sends 0 to the axes. needs a release of the held directions and a centre of pad_out before the swap, same on profile switch and unplug.

let want = state.lock().expect("daemon state").engine.binds_stick();
if want != gamepad_held {
hold_gamepads(&mut grabbed, &gamepad_idx, want);
gamepad_held = want;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gamepad_held is set to want even when the grab failed. if a game or Steam already grabbed the xpad node we never try again, and then the game gets the raw stick and we press WASD on top of it.

})
}

fn controller(&mut self) -> Option<&mut VirtualDevice> {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if build_controller fails this runs again on every stick event and logs each time, so a few hundred log lines a second in analog mode. remember the failure and log once.

/// sends hundreds of events a second, and a reader that sleeps through them
/// both lags and overflows the kernel's buffer, losing the stick's return to
/// the centre.
fn wait_for_input(devices: &[evdev::Device], timeout: Duration) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: when the stick is unbound the gamepad node is let go but still in the poll set, so we wake for every stick event just to drop it. could skip it while gamepad_held is false.

fs::remove_file(legacy).map_err(|_| HelperError::WriteRules)?;
}
let path = Path::new(RULES_PATH);
if path.exists() {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the /etc copy has the same name as the packaged rule in /usr/lib, so it masks it, and we never rewrite it once it exists. next time a pid gets added, anyone who pressed Fix permissions won't get it. a different file name, or compare contents before skipping.

}

impl KeyId {
/// Every physical key, in declaration order.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: kp21-kp27 and stick_click sit at the end of ALL, not in declaration order. fix the comment or the order.

opentartarus_core::constants::USB_PID_TARTARUS_PRO => Some(DeviceModel::Pro),
_ => None,
}
DeviceModel::from_usb_pid(pid)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this is just DeviceModel::from_usb_pid now, can call that and drop the wrapper.

@PikkonMG
PikkonMG merged commit 661db13 into PikkonMG:main Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants