diff --git a/CHANGELOG.md b/CHANGELOG.md index 060985a..cb347e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ is on main, the release is published with that section as its notes (AGENTS.md, ### Command line +- On Linux, an A12 device entered by a usbliter8 board starts by the ibss + route: the boot request can end in a USB protocol error while the iBSS + takes over, and the run no longer stops there. + - The A13 iPhones (iPhone 11, 11 Pro, 11 Pro Max, SE 2nd generation) get their boot firmware built as the A12's: their patched iBSS takes the same borrowed manifest, so no manifest of your own is needed. diff --git a/crates/usb/src/dfu.rs b/crates/usb/src/dfu.rs index 3b39e1d..8c80e06 100644 --- a/crates/usb/src/dfu.rs +++ b/crates/usb/src/dfu.rs @@ -57,10 +57,18 @@ const SUFFIX: [u8; 12] = [ /// The reply to a request that starts code, or that an exploit payload /// answers, can be lost: the device leaves or the payload does not answer. +/// On Linux a device that leaves in the middle of the request can show as a +/// broken transfer (EPROTO) rather than a disconnect, as usbliter8's boot +/// request does on an iPhone XS Max while the iBSS starts. fn reply_may_be_lost(reply: Result) -> Result { match reply { Ok(_) => Ok(Sent::Acknowledged), - Err(e) if matches!(e.kind, Kind::Timeout | Kind::Stall | Kind::Disconnected) => { + Err(e) + if matches!( + e.kind, + Kind::Timeout | Kind::Stall | Kind::Disconnected | Kind::Fault + ) => + { Ok(Sent::Unconfirmed) } Err(e) => Err(e), @@ -546,7 +554,7 @@ mod tests { #[test] fn only_transfer_failures_can_be_unconfirmed() { - for kind in [Kind::Timeout, Kind::Stall, Kind::Disconnected] { + for kind in [Kind::Timeout, Kind::Stall, Kind::Disconnected, Kind::Fault] { assert_eq!( reply_may_be_lost::<()>(Err(Fault::new(kind, "test"))).unwrap(), Sent::Unconfirmed diff --git a/crates/usb/src/error.rs b/crates/usb/src/error.rs index 5551226..ae4a928 100644 --- a/crates/usb/src/error.rs +++ b/crates/usb/src/error.rs @@ -9,6 +9,9 @@ pub enum Kind { Stall, /// The device is gone. Disconnected, + /// The transfer broke off on the bus (Linux: EPROTO), as when the + /// device leaves in the middle of a request. + Fault, /// The device answered, but not with what the protocol expects. Unexpected, /// The device is not in the mode this protocol talks to. @@ -103,6 +106,10 @@ impl From for Fault { T::Cancelled => Fault::new(Kind::Timeout, "timed out"), T::Stall => Fault::new(Kind::Stall, "the device rejected the request"), T::Disconnected => Fault::new(Kind::Disconnected, "the device disconnected"), + T::Fault => Fault::new( + Kind::Fault, + "the transfer broke off (hardware fault or protocol violation)", + ), other => Fault::new(Kind::Other, other.to_string()), } }