Repository navigation
Add Tartarus V2 Pro support and a Deadlock profile - #1
Conversation
- 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
left a comment
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
nit: this is just DeviceModel::from_usb_pid now, can call that and drop the wrapper.
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
Per-model layouts
"model_bindings": { "v2pro": { ... } }, which replacesbindingson that model. Validation checks that the model is indevice_modelsand that every key exists on it.Deadlock
Fix: input lag and stuck stick directions
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
SetStickModeandSetStickRotation. The status reply carriesstick.rotation_deg.Fix: udev
uaccessnever applied99-opentartarus.rules. systemd turns theuaccesstag into an ACL in73-seat-late.rules, so a tag added at 99 came too late. The pad only worked once theopentartarusgroup took effect at the next login.70-opentartarus.rules. The permissions helper writes the new name and removes the old/etc/udev/rules.d/99-opentartarus.rulesit wrote before. A test checks the rule sorts before73-seat-late.rules.Fix: lighting never applied through OpenRazer
razer.device.misc.getVidandgetPid, which OpenRazer doesn't have. It hasgetVidPid, which returns both as an int32 array. No device ever matched, on any model, so every lighting call ended aslighting_error.setWavewas sent a byte, but OpenRazer declares it as int32.Arch packaging
packaging/arch/PKGBUILDbuilds a pacman package from the checkout (makepkg -si).Checks
cargo fmt --all --check,cargo test --workspace(322 tests) andcargo clippy --workspace --all-targets -- -D warningsall pass.