Skip to main content

run_target_handshake

Function run_target_handshake 

Source
pub async fn run_target_handshake<S: SerialRead + SerialWrite>(
    device: &mut S,
) -> Result<(ProtocolId, u32, Vec<u8>)>
Expand description

Runs the target-side framing protocol handshake over device.

Waits for a valid NegotiateReq frame on CONTROL_CHANNEL_ID, sends a NegotiateResp, and returns the negotiated ProtocolId, session ID, and any unconsumed bytes read past the handshake frame.

ยงErrors

Returns TargetDriverError::EmptyRead if the serial device returns EOF before negotiation completes, or an I/O/framing error if reading or writing to the serial device fails.