feat(controller): add native 25Hz haptics on Steam Controller 2 (Ibex 0x80)

This commit is contained in:
bleack committed 2026-11-21 20:42:10 +01:00
1 parent b81b0f54f7
commit c8f27d32e3
7 files changed
+847 -20

No files matched your search

+134 -3
View File
@@ -244,6 +244,9 @@ impl SteamFrameGpuiApp {
|| self.latest_controller.throttle_pct != mon.latest_controller.throttle_pct
|| self.latest_controller.brake_pct != mon.latest_controller.brake_pct
|| self.latest_controller.clutch_pct != mon.latest_controller.clutch_pct
|| self.latest_controller.vibration_pct != mon.latest_controller.vibration_pct
|| self.latest_controller.rumble_left_pct != mon.latest_controller.rumble_left_pct
|| self.latest_controller.rumble_right_pct != mon.latest_controller.rumble_right_pct
|| self.latest_controller.last_button != mon.latest_controller.last_button
|| (self.latest_controller.steering_norm - mon.latest_controller.steering_norm).abs()
> 0.005
@@ -1743,6 +1746,128 @@ impl SteamFrameGpuiApp {
)),
),
))
.child(self.render_setting_row(
"Vibrations Haptiques SC (25 Hz)",
div()
.flex()
.flex_wrap()
.items_center()
.gap_2()
.child(self.render_selectable_pill(
"pill_sc_vib_0",
"OFF",
self.cfg.controller_vibration == 0,
cx.listener(|this, _, _, cx| {
this.cfg.controller_vibration = 0;
this.controls.set_controller_vibration_pct(0);
cx.notify();
}),
))
.child(
div()
.id("btn_sc_vib_dec")
.px_2()
.py_1()
.rounded_md()
.bg(rgb(COLOR_SURFACE_ELEVATED))
.border_1()
.border_color(rgb(COLOR_BORDER_SUBTLE))
.text_xs()
.font_weight(gpui::FontWeight::BOLD)
.cursor_pointer()
.on_click(cx.listener(|this, _, _, cx| {
let next = this.cfg.controller_vibration.saturating_sub(10);
this.cfg.controller_vibration = next;
this.controls.set_controller_vibration_pct(next);
cx.notify();
}))
.child("−10%"),
)
.child(
div()
.px_2p5()
.py_1()
.rounded_md()
.bg(rgb(COLOR_BG_DARK))
.border_1()
.border_color(if self.cfg.controller_vibration > 0 {
rgb(COLOR_CYAN)
} else {
rgb(COLOR_BORDER_SUBTLE)
})
.text_xs()
.font_weight(gpui::FontWeight::BOLD)
.text_color(if self.cfg.controller_vibration > 0 {
rgb(COLOR_CYAN)
} else {
rgb(COLOR_TEXT_MUTED)
})
.child(if self.cfg.controller_vibration == 0 {
"0% (OFF)".to_string()
} else {
format!("{}%", self.cfg.controller_vibration)
}),
)
.child(
div()
.id("btn_sc_vib_inc")
.px_2()
.py_1()
.rounded_md()
.bg(rgb(COLOR_SURFACE_ELEVATED))
.border_1()
.border_color(rgb(COLOR_BORDER_SUBTLE))
.text_xs()
.font_weight(gpui::FontWeight::BOLD)
.cursor_pointer()
.on_click(cx.listener(|this, _, _, cx| {
let next = (this.cfg.controller_vibration + 10).min(100);
this.cfg.controller_vibration = next;
this.controls.set_controller_vibration_pct(next);
cx.notify();
}))
.child("+10%"),
)
.child(self.render_selectable_pill(
"pill_sc_vib_50",
"50%",
self.cfg.controller_vibration == 50,
cx.listener(|this, _, _, cx| {
this.cfg.controller_vibration = 50;
this.controls.set_controller_vibration_pct(50);
cx.notify();
}),
))
.child(self.render_selectable_pill(
"pill_sc_vib_100",
"100%",
self.cfg.controller_vibration == 100,
cx.listener(|this, _, _, cx| {
this.cfg.controller_vibration = 100;
this.controls.set_controller_vibration_pct(100);
cx.notify();
}),
))
.child(
div()
.id("btn_sc_vib_test")
.px_2p5()
.py_1()
.rounded_md()
.bg(rgb(COLOR_SURFACE_ELEVATED))
.border_1()
.border_color(rgb(COLOR_ORANGE))
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.text_color(rgb(COLOR_ORANGE))
.cursor_pointer()
.on_click(cx.listener(|this, _, _, cx| {
this.controls.trigger_controller_rumble_test();
cx.notify();
}))
.child("📳 Tester Vibrations"),
),
))
.child(self.render_controller_monitor(cx))
.child(
div()
@@ -2910,11 +3035,17 @@ impl SteamFrameGpuiApp {
let sc = &self.latest_controller;
let detail = if sc.connected {
format!(
"Périphérique : {} ({}) • Trames $RC : {} (Err : {})",
sc.device_name, sc.device_path, sc.packets_sent, sc.send_errors
"Périphérique : {} ({}) • Vib {}% (G:{}% / D:{}%) • Trames $RC : {} (Err : {})",
sc.device_name,
sc.device_path,
sc.vibration_pct,
sc.rumble_left_pct,
sc.rumble_right_pct,
sc.packets_sent,
sc.send_errors
)
} else {
"En attente d'un Steam Controller / Gamepad Linux (/dev/input/event*)".to_string()
"En attente d'un Steam Controller / Gamepad Linux (/dev/hidraw* ou /dev/input/event*)".to_string()
};
(
sc.connected,