style: cargo fmt --all under rustfmt 1.9 (Rust 1.96)

Comment reflow only — the pinned "stable" channel moved and CI checks
formatting with the current toolchain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 12:28:13 +00:00
parent 7f234420c7
commit 60ccbfdcf7
4 changed files with 30 additions and 12 deletions
+14 -3
View File
@@ -274,7 +274,10 @@ fn discover(secs: u64) -> Result<()> {
let receiver = daemon let receiver = daemon
.browse("_punktfunk._udp.local.") .browse("_punktfunk._udp.local.")
.context("browse _punktfunk._udp")?; .context("browse _punktfunk._udp")?;
tracing::info!(secs, "browsing for native punktfunk/1 hosts (_punktfunk._udp)…"); tracing::info!(
secs,
"browsing for native punktfunk/1 hosts (_punktfunk._udp)…"
);
// One row per host, keyed by the stable uniqueid (falls back to the fullname) so the same // One row per host, keyed by the stable uniqueid (falls back to the fullname) so the same
// host re-advertising or answering on several interfaces collapses to a single entry. // host re-advertising or answering on several interfaces collapses to a single entry.
let mut hosts: BTreeMap<String, String> = BTreeMap::new(); let mut hosts: BTreeMap<String, String> = BTreeMap::new();
@@ -298,7 +301,12 @@ fn discover(secs: u64) -> Result<()> {
.unwrap_or_else(|| "?".into()); .unwrap_or_else(|| "?".into());
let fp = val("fp"); let fp = val("fp");
let fp_short = fp.get(..16).unwrap_or(fp.as_str()); let fp_short = fp.get(..16).unwrap_or(fp.as_str());
let name = info.get_fullname().split('.').next().unwrap_or("?").to_string(); let name = info
.get_fullname()
.split('.')
.next()
.unwrap_or("?")
.to_string();
let id = val("id"); let id = val("id");
let key = if id.is_empty() { let key = if id.is_empty() {
info.get_fullname().to_string() info.get_fullname().to_string()
@@ -490,7 +498,10 @@ async fn session(args: Args) -> Result<()> {
} else { } else {
0 0
}; };
let throughput_kbps = recv_bytes.saturating_mul(8).checked_div(window_ms).unwrap_or(0); let throughput_kbps = recv_bytes
.saturating_mul(8)
.checked_div(window_ms)
.unwrap_or(0);
let loss_pct = if res.bytes_sent > 0 { let loss_pct = if res.bytes_sent > 0 {
res.bytes_sent.saturating_sub(recv_bytes) as f64 / res.bytes_sent as f64 * 100.0 res.bytes_sent.saturating_sub(recv_bytes) as f64 / res.bytes_sent as f64 * 100.0
} else { } else {
+1 -2
View File
@@ -175,8 +175,7 @@ impl NativeClient {
let (mic_tx, mic_rx) = tokio::sync::mpsc::unbounded_channel::<(u32, u64, Vec<u8>)>(); let (mic_tx, mic_rx) = tokio::sync::mpsc::unbounded_channel::<(u32, u64, Vec<u8>)>();
let (rich_input_tx, rich_input_rx) = tokio::sync::mpsc::unbounded_channel::<RichInput>(); let (rich_input_tx, rich_input_rx) = tokio::sync::mpsc::unbounded_channel::<RichInput>();
let (ctrl_tx, ctrl_rx) = tokio::sync::mpsc::unbounded_channel::<CtrlRequest>(); let (ctrl_tx, ctrl_rx) = tokio::sync::mpsc::unbounded_channel::<CtrlRequest>();
let (ready_tx, ready_rx) = let (ready_tx, ready_rx) = std::sync::mpsc::channel::<Result<Negotiated>>();
std::sync::mpsc::channel::<Result<Negotiated>>();
let shutdown = Arc::new(AtomicBool::new(false)); let shutdown = Arc::new(AtomicBool::new(false));
let mode_slot = Arc::new(std::sync::Mutex::new(mode)); let mode_slot = Arc::new(std::sync::Mutex::new(mode));
let probe = Arc::new(Mutex::new(ProbeState::default())); let probe = Arc::new(Mutex::new(ProbeState::default()));
+6 -1
View File
@@ -46,7 +46,12 @@ pub fn advertise_native(
props.insert("fp".into(), fingerprint.to_string()); props.insert("fp".into(), fingerprint.to_string());
props.insert( props.insert(
"pair".into(), "pair".into(),
if require_pairing { "required" } else { "optional" }.into(), if require_pairing {
"required"
} else {
"optional"
}
.into(),
); );
props.insert("id".into(), uniqueid.to_string()); props.insert("id".into(), uniqueid.to_string());
let service = ServiceInfo::new(NATIVE_SERVICE, hostname, &host_name, ip, port, props) let service = ServiceInfo::new(NATIVE_SERVICE, hostname, &host_name, ip, port, props)
@@ -436,9 +436,9 @@ fn parse_ds_output(pad: u8, data: &[u8], fb: &mut DsFeedback) {
} }
let flag0 = data[1]; // BIT0 compat vibration, BIT1 haptics select, BIT2 R2, BIT3 L2 let flag0 = data[1]; // BIT0 compat vibration, BIT1 haptics select, BIT2 R2, BIT3 L2
let flag1 = data[2]; // BIT2 lightbar, BIT4 player indicators let flag1 = data[2]; // BIT2 lightbar, BIT4 player indicators
// Motor rumble: high-frequency (small/right) motor at data[3], low-frequency (big/left) at // Motor rumble: high-frequency (small/right) motor at data[3], low-frequency (big/left) at
// data[4]. Scale 0..255 → 0..0xFFFF, same (low, high) convention as the uinput pad's mixer, // data[4]. Scale 0..255 → 0..0xFFFF, same (low, high) convention as the uinput pad's mixer,
// and route to the universal rumble plane (0xCA). // and route to the universal rumble plane (0xCA).
if flag0 & 0x03 != 0 { if flag0 & 0x03 != 0 {
let high = (data[3] as u16) << 8; let high = (data[3] as u16) << 8;
let low = (data[4] as u16) << 8; let low = (data[4] as u16) << 8;
@@ -607,7 +607,10 @@ impl DualSenseManager {
} }
match DualSensePad::open(idx as u8) { match DualSensePad::open(idx as u8) {
Ok(p) => { Ok(p) => {
tracing::info!(index = idx, "virtual DualSense created (UHID hid-playstation)"); tracing::info!(
index = idx,
"virtual DualSense created (UHID hid-playstation)"
);
self.pads[idx] = Some(p); self.pads[idx] = Some(p);
self.state[idx] = DsState::neutral(); self.state[idx] = DsState::neutral();
self.last_rumble[idx] = (0, 0); self.last_rumble[idx] = (0, 0);
@@ -744,8 +747,8 @@ mod tests {
assert_eq!(&r[16..22], &[0x22, 0x11, 0x44, 0x33, 0x66, 0x55]); // gyro LE assert_eq!(&r[16..22], &[0x22, 0x11, 0x44, 0x33, 0x66, 0x55]); // gyro LE
assert_eq!(&r[22..28], &[0x78, 0x07, 0x9A, 0x09, 0xBC, 0x0B]); // accel LE assert_eq!(&r[22..28], &[0x78, 0x07, 0x9A, 0x09, 0xBC, 0x0B]); // accel LE
assert_eq!(&r[28..32], &[0xDD, 0xCC, 0xBB, 0xAA]); // sensor_timestamp LE assert_eq!(&r[28..32], &[0xDD, 0xCC, 0xBB, 0xAA]); // sensor_timestamp LE
// Touch point 1 at struct off 32 = r[33..37]: contact byte (active → bit7 clear), // Touch point 1 at struct off 32 = r[33..37]: contact byte (active → bit7 clear),
// then 12-bit x / 12-bit y packed. // then 12-bit x / 12-bit y packed.
assert_eq!(r[33], 5); assert_eq!(r[33], 5);
assert_eq!(r[34], 0x23); assert_eq!(r[34], 0x23);
assert_eq!(r[35], 0x61); // x_hi nibble 0x1 | (y & 0xF) << 4 (y=0x356 → 0x6 << 4) assert_eq!(r[35], 0x61); // x_hi nibble 0x1 | (y & 0xF) << 4 (y=0x356 → 0x6 << 4)