Bootstrap OpenBitdo clean-room SDK and reliability milestone

This commit is contained in:
2026-02-27 20:43:34 -05:00
commit d5afadf560
46 changed files with 3652 additions and 0 deletions

41
sdk/tests/boot_safety.rs Normal file
View File

@@ -0,0 +1,41 @@
use bitdo_proto::{BitdoError, DeviceSession, MockTransport, SessionConfig, VidPid};
#[test]
fn unsafe_boot_requires_dual_ack() {
let transport = MockTransport::default();
let mut session = DeviceSession::new(
transport,
VidPid::new(0x2dc8, 24585),
SessionConfig {
allow_unsafe: true,
brick_risk_ack: false,
experimental: true,
..SessionConfig::default()
},
)
.expect("session init");
let err = session.enter_bootloader().expect_err("expected denial");
match err {
BitdoError::UnsafeCommandDenied { .. } => {}
other => panic!("unexpected error: {other:?}"),
}
}
#[test]
fn unsafe_boot_succeeds_with_dual_ack() {
let transport = MockTransport::default();
let mut session = DeviceSession::new(
transport,
VidPid::new(0x2dc8, 24585),
SessionConfig {
allow_unsafe: true,
brick_risk_ack: true,
experimental: true,
..SessionConfig::default()
},
)
.expect("session init");
session.enter_bootloader().expect("boot sequence");
}