Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions devices/flydigi/vader5.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,12 @@ Start = "BTN_START"
Home = "BTN_MODE"
LS = "BTN_THUMBL"
RS = "BTN_THUMBR"
M1 = "BTN_TRIGGER_HAPPY1"
# Steam Xbox Elite order: usage 22 = P3, usage 23 = P2; swap M2/M3 so Vader M2 lands at P3.
M2 = "BTN_TRIGGER_HAPPY3"
M3 = "BTN_TRIGGER_HAPPY2"
M4 = "BTN_TRIGGER_HAPPY4"
M1 = "BTN_TRIGGER_HAPPY5"
# Real Elite 2 exposes back paddles P1-P4 as BTN_TRIGGER_HAPPY5-8 (Linux xpad).
# Steam reads paddle slots from that layout; M2/M3 swapped so Vader M2 lands at P3, M3 at P2.
M2 = "BTN_TRIGGER_HAPPY7"
M3 = "BTN_TRIGGER_HAPPY6"
M4 = "BTN_TRIGGER_HAPPY8"
C = "BTN_TRIGGER_HAPPY9"
Z = "BTN_TRIGGER_HAPPY10"
LM = "BTN_TRIGGER_HAPPY11"
Expand Down
11 changes: 6 additions & 5 deletions src/io/uhid_descriptor.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1458,17 +1458,18 @@ test "descriptor: Vader 5 keeps Steam/SDL M2 and M3 paddle order" {
const out = parsed.value.output orelse return error.MissingOutputSection;

const buttons = out.buttons orelse return error.MissingButtons;
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY1", buttons.map.get("M1") orelse return error.MissingM1);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY3", buttons.map.get("M2") orelse return error.MissingM2);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY2", buttons.map.get("M3") orelse return error.MissingM3);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY4", buttons.map.get("M4") orelse return error.MissingM4);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY5", buttons.map.get("M1") orelse return error.MissingM1);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY7", buttons.map.get("M2") orelse return error.MissingM2);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY6", buttons.map.get("M3") orelse return error.MissingM3);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY8", buttons.map.get("M4") orelse return error.MissingM4);

const desc = try UhidDescriptorBuilder.buildFromOutput(alloc, out);
defer alloc.free(desc);

// M1..M4 = HAPPY5-8 → usages 21,23,22,24 (M2/M3 swapped); C/Z/LM/RM/O = HAPPY9-13 → 25-29.
try expectButtonUsages(desc, &.{
1, 2, 4, 5, 7, 8, 12, 11, 13, 14,
15, 17, 19, 18, 20, 25, 26, 27, 28, 29,
15, 21, 23, 22, 24, 25, 26, 27, 28, 29,
});
}

Expand Down
16 changes: 8 additions & 8 deletions src/test/validate_e2e_test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -240,28 +240,28 @@ test "validate: all device TOMLs have at least one report" {

// --- 6. vader5 paddle slot invariants (regression for PR #235) ---

test "vader5: M1..M4 occupy BTN_TRIGGER_HAPPY1..4 (Steam Elite paddle slots)" {
test "vader5: M1..M4 occupy BTN_TRIGGER_HAPPY5..8 (real Elite 2 paddle slots)" {
const allocator = testing.allocator;
const parsed = try device_mod.parseFile(allocator, "devices/flydigi/vader5.toml");
defer parsed.deinit();

const buttons = parsed.value.output.?.buttons.?.map;

try testing.expectEqualStrings("BTN_TRIGGER_HAPPY1", buttons.get("M1") orelse return error.MissingM1);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY3", buttons.get("M2") orelse return error.MissingM2);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY2", buttons.get("M3") orelse return error.MissingM3);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY4", buttons.get("M4") orelse return error.MissingM4);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY5", buttons.get("M1") orelse return error.MissingM1);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY7", buttons.get("M2") orelse return error.MissingM2);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY6", buttons.get("M3") orelse return error.MissingM3);
try testing.expectEqualStrings("BTN_TRIGGER_HAPPY8", buttons.get("M4") orelse return error.MissingM4);
}

test "vader5: C/Z/LM/RM/O do not occupy BTN_TRIGGER_HAPPY1..4" {
test "vader5: C/Z/LM/RM/O do not occupy BTN_TRIGGER_HAPPY5..8" {
const allocator = testing.allocator;
const parsed = try device_mod.parseFile(allocator, "devices/flydigi/vader5.toml");
defer parsed.deinit();

const buttons = parsed.value.output.?.buttons.?.map;
const paddle_slots = [_][]const u8{
"BTN_TRIGGER_HAPPY1", "BTN_TRIGGER_HAPPY2",
"BTN_TRIGGER_HAPPY3", "BTN_TRIGGER_HAPPY4",
"BTN_TRIGGER_HAPPY5", "BTN_TRIGGER_HAPPY6",
"BTN_TRIGGER_HAPPY7", "BTN_TRIGGER_HAPPY8",
};
const face_extras = [_][]const u8{ "C", "Z", "LM", "RM", "O" };

Expand Down
Loading