fn fb_send<T: Fastboot>(io: &mut T, payload: &[u8]) -> FbResult<Reply> {
    io.write_all(payload).map_err(|err| err.to_string())?;
    loop {
        let mut buff = [0; FB_MAX_REPLY_LEN];
        match io.read(&mut buff) {
            Ok(received) => return Ok(Reply::from(&mut buff[..received])),
            Err(err) => {
                match err.kind() {
                    std::io::ErrorKind::TimedOut => {
                        // Trait can't possible now what is a timeout set by a particular Read/Write implementation
                        // so it will *not* consider TimedOut a fatal error. Instead it will just try again
                        // until a reply or another error is received.
                        continue;
                    }
                    _ => {
                        return Err(err.to_string());
                    }
                };
            }
        };
    }
}
// According to U-Boot documentation, Fastboot is a synchronous protocol. Therefore
// we should always wait for a reply to our "request". This function will block until
// a reply or an error (except timeout) is received from USB I/O implementation.
// See u-boot/doc/README.android-fastboot-protocol
According to U-Boot documentation, Fastboot is a synchronous protocol. Therefore
we should always wait for a reply to our "request". This function will block until
a reply or an error (except timeout) is received from USB I/O implementation.
According to U - Boot documentation Fastboot is a synchronous protocol . Therefore we should always wait for a reply to our " request " . This function will block until a reply or an error ( except timeout ) is received from USB I / O implementation .
fn fb_send<T: Fastboot>(io: &mut T, payload: &[u8]) -> FbResult<Reply> {
    io.write_all(payload).map_err(|err| err.to_string())?;
    loop {
        let mut buff = [0; FB_MAX_REPLY_LEN];
        match io.read(&mut buff) {
            Ok(received) => return Ok(Reply::from(&mut buff[..received])),
            Err(err) => {
                match err.kind() {
                    std::io::ErrorKind::TimedOut => {
                        // Trait can't possible now what is a timeout set by a particular Read/Write implementation
                        // so it will *not* consider TimedOut a fatal error. Instead it will just try again
                        // until a reply or another error is received.
                        continue;
                    }
                    _ => {
                        return Err(err.to_string());
                    }
                };
            }
        };
    }
}
fn fb_send < T : Fastboot > ( io : & mut T , payload : & [ u8 ] ) -> FbResult < Reply > { io . write_all ( payload ) . map_err ( | err | err . to_string ( ) ) ? ; loop { let mut buff = [ 0 ; FB_MAX_REPLY_LEN ] ; match io . read ( & mut buff ) { Ok ( received ) => return Ok ( Reply :: from ( & mut buff [ .. received ] ) ) , Err ( err ) => { match err . kind ( ) { std :: io :: ErrorKind :: TimedOut => { // Trait can't possible now what is a timeout set by a particular Read/Write implementation // so it will *not* consider TimedOut a fatal error. Instead it will just try again // until a reply or another error is received. continue ; } _ => { return Err ( err . to_string ( ) ) ; } } ; } } ; } }
According to U-Boot documentation, Fastboot is a synchronous protocol.
According to U - Boot documentation Fastboot is a synchronous protocol .
io
&mut T
payload
&[u8]