Read the rejection properly: it was a command id, not a key refusal
Makinolo's Zwift Ride write-up gives the client command format — `00`
then protobuf field 1 with the parameter, so `00 08 00` is the
information request and `00 08 82 06` is parameter 770. Which explains
what the pod has been telling us all along.
We wrote frames beginning `0xff`. The pod answered `3e 08 ff 01 10 05` —
`{1: 255, 2: 5}`. **255 is 0xff**: our own first byte, echoed back as the
command id, with a status. It was never rejecting a key exchange; it was
saying "command 255, unsupported". `0xff` is a device-to-app notification
type and we were writing it back as though it were a command.
The same write-up records that Zwift "got rid of the Bluetooth
communication encryption they were using for the Play and the Click" —
and the Click v2 is newer than the Ride. So the crypto gate this line of
work assumed may not exist at all, which fits the plain fact that the
cleartext buttons work for the first fifty seconds.
That reopens A-2 from a better angle. It calls the thing that removes the
daily unlock a **keep-alive**: a periodic message, not a credential. So
`--keepalive <secs>` sends a chosen frame on a timer for the whole run
and lets the paddle oracle answer, and `info` and `param770` are
variants — the two commands the write-up documents, in the shape it
documents them.
If a periodic `00 08 00` holds the paddles open past the cliff, the fix
is a heartbeat in the controller supervisor and no cryptography at all.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -977,6 +977,7 @@ pub async fn unlock_cmd(
|
||||
candidate: Option<&str>,
|
||||
sweep: bool,
|
||||
variant: Option<&str>,
|
||||
keepalive: Option<Duration>,
|
||||
scan_timeout: Duration,
|
||||
) -> Result<()> {
|
||||
use crate::unlock;
|
||||
@@ -1011,8 +1012,16 @@ pub async fn unlock_cmd(
|
||||
)
|
||||
})?),
|
||||
};
|
||||
if let Some(v) = single {
|
||||
println!("Sending exactly one frame this run: {}\n", v.name);
|
||||
match (single, keepalive) {
|
||||
(Some(v), Some(every)) => println!(
|
||||
"Keep-alive run: sending {} every {}s for the whole run.\n\
|
||||
If the paddles are still reporting at the end, that is the fix.\n",
|
||||
v.name,
|
||||
every.as_secs()
|
||||
),
|
||||
(Some(v), None) => println!("Sending exactly one frame this run: {}\n", v.name),
|
||||
(None, Some(_)) => anyhow::bail!("--keepalive needs --variant to say what to send"),
|
||||
(None, None) => {}
|
||||
}
|
||||
|
||||
let peripheral = connect(device, scan_timeout).await?;
|
||||
@@ -1059,6 +1068,7 @@ pub async fn unlock_cmd(
|
||||
let mut sent: Vec<&'static str> = Vec::new();
|
||||
let mut responses: Vec<(&'static str, unlock::Response)> = Vec::new();
|
||||
let mut zeros: u64 = 0;
|
||||
let mut beats: u64 = 0;
|
||||
let mut last_mask: Option<u32> = None;
|
||||
// When the pod flipped its status flag, which is the cliff this run is
|
||||
// measured against — better than a constant, because the pod says so.
|
||||
@@ -1067,6 +1077,15 @@ pub async fn unlock_cmd(
|
||||
let deadline = tokio::time::sleep(duration);
|
||||
tokio::pin!(deadline);
|
||||
|
||||
// A-2 calls the thing that removes the daily unlock a *keep-alive*. That is
|
||||
// a periodic message, not a credential, and the Ride write-up gives the
|
||||
// shape of one. So: send it on a timer and let the paddles answer.
|
||||
let mut heartbeat = keepalive.map(|every| {
|
||||
let mut t = tokio::time::interval(every);
|
||||
t.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);
|
||||
t
|
||||
});
|
||||
|
||||
loop {
|
||||
tokio::select! {
|
||||
_ = &mut deadline => break,
|
||||
@@ -1074,6 +1093,18 @@ pub async fn unlock_cmd(
|
||||
println!("\nInterrupted.");
|
||||
break;
|
||||
}
|
||||
_ = async { heartbeat.as_mut().unwrap().tick().await }, if heartbeat.is_some() => {
|
||||
let Some(v) = single else { continue };
|
||||
let frame = (v.build)(&local, &unlock::KeyOffer::default());
|
||||
let at = start.elapsed().as_secs_f32();
|
||||
match write_frame(&peripheral, &sync_rx, &frame).await {
|
||||
Ok(()) => {
|
||||
beats += 1;
|
||||
println!("[{at:7.2}s] KEEPALIVE #{beats} {} {}", v.name, hex(&frame));
|
||||
}
|
||||
Err(e) => println!("[{at:7.2}s] KEEPALIVE !! {e}"),
|
||||
}
|
||||
}
|
||||
n = notifications.next() => {
|
||||
let Some(n) = n else {
|
||||
println!("\nThe device disconnected — the run is void, not a failure.");
|
||||
@@ -1099,7 +1130,10 @@ pub async fn unlock_cmd(
|
||||
),
|
||||
Err(e) => println!(" !! {e}"),
|
||||
}
|
||||
if let Some(one) = single {
|
||||
if keepalive.is_some() {
|
||||
// The heartbeat is the experiment; firing again here
|
||||
// would confound which write did what.
|
||||
} else if let Some(one) = single {
|
||||
// One write per connection. The sweep's replies came
|
||||
// back in a single burst six seconds after the first
|
||||
// write, so "attributed to the last thing sent" was a
|
||||
@@ -1232,6 +1266,9 @@ pub async fn unlock_cmd(
|
||||
_ => println!(" cliff: never flipped"),
|
||||
}
|
||||
println!(" key offers seen: {offers}");
|
||||
if beats > 0 {
|
||||
println!(" keep-alives sent: {beats}");
|
||||
}
|
||||
if zeros > 0 {
|
||||
println!(" all-zero frames: {zeros} <- the stream stopped carrying data");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user