Expand description
Pure-Rust Android Debug Bridge (ADB) client.
rsadb speaks the ADB transport protocol directly to adbd over USB
(via nusb) or TCP, with no adb binary, no libusb and no C code.
It can also talk to a running Google adb server when something else
(Android Studio, say) already holds the USB interface.
use rsadb::{Device, Session, auth, transport};
use std::time::Duration;
let key = auth::load_or_generate(&auth::default_key_paths()?, "me@laptop")?;
let usb = transport::usb::find(None).await?;
let session = Session::connect(transport::usb::open(&usb).await?, &key, Duration::from_secs(60)).await?;
let device = Device::new(session);
println!("{}", device.getprop("ro.product.model").await?);§Feature flags
usb(default) — direct USB transport throughnusb.tcp(default) — direct TCP transport (adb connecttargets, emulators).host-client(default) — client for a running Google adb server.cli(default) — thersadbcommand-line binary (pulls inclap).hardware— enables ignored integration tests that need a real device.
Re-exports§
pub use auth::HostKey;pub use channel::Channel;pub use channel::Connection;pub use device::Device;pub use error::Error;pub use error::Result;pub use session::Session;pub use session::Stream;pub use transport::Transport;
Modules§
- auth
- Host authentication: RSA key handling and token signing.
- channel
- The byte-stream abstraction every service is written against.
- device
- A typed, high-level view of one device.
- error
- Crate-wide error type.
- host
host-client - Client for a running Google adb server (
adb start-server, port 5037). - services
- Protocol-level clients for the services
adbdoffers on top of streams. - session
- A direct session with
adbd: handshake, then multiplexed streams. - track
usb - Attach/detach tracking for ADB USB devices.
- transport
- Message transports: anything that can carry
Messages to and from a device. - wire
- The ADB wire format: 24-byte little-endian headers followed by an optional payload.