20 releases (4 stable)

1.0.3 Jul 13, 2024
1.0.1 Apr 10, 2024
1.0.0 Oct 3, 2023
0.8.0 Aug 16, 2023
0.1.5 Jan 23, 2022

#104 in Debugging

Download history 10/week @ 2024-03-31 119/week @ 2024-04-07 14/week @ 2024-04-14 2/week @ 2024-04-21 1/week @ 2024-04-28 26/week @ 2024-05-19 8/week @ 2024-05-26 21/week @ 2024-06-02 15/week @ 2024-06-09 6/week @ 2024-06-16 118/week @ 2024-06-23 126/week @ 2024-06-30 90/week @ 2024-07-07 50/week @ 2024-07-14

385 downloads per month

MIT license

46KB
1K SLoC

adb_client

Android Debug Bridge (ADB) client implementation in pure Rust !

Main features :

  • Full Rust, no need to use shell commands
  • Currently only support server TCP/IP protocol
  • Highly configurable
  • Easy to use !

Examples

First declare adb_client as a dependency by simply adding this to your Cargo.toml:

[dependencies]
adb_client = "*"

Launch a command on host device

use adb_client::AdbTcpConnection;
use std::net::Ipv4Addr;

let mut connection = AdbTcpConnection::new(Ipv4Addr::from([127,0,0,1]), 5037).unwrap();
connection.shell_command(None, ["df", "-h"]);

Get available ADB devices

use adb_client::AdbTcpConnection;
use std::net::Ipv4Addr;

let mut connection = AdbTcpConnection::new(Ipv4Addr::from([127,0,0,1]), 5037).unwrap();
connection.devices();

Push a file to the device

use adb_client::AdbTcpConnection;
use std::net::Ipv4Addr;
use std::fs::File;
use std::path::Path;

let mut connection = AdbTcpConnection::new(Ipv4Addr::from([127,0,0,1]), 5037).unwrap();
let mut input = File::open(Path::new("/tmp")).unwrap();
connection.send::<&str,&str>(None, &mut input, "/data/local/tmp");

Rust binary

This crate also provides a lightweight binary based on the adb_client crate. You can install it by running the following command :

cargo install adb_client --example adb_cli 

Missing features

  • USB protocol

All pull requests are welcome !

Documentation

Dependencies

~4–13MB
~142K SLoC