adb_client

Crates.ioadb_client
lib.rsadb_client
version1.0.2
sourcesrc
created_at2022-01-05 10:08:23.355008
updated_at2024-07-13 17:04:51.596564
descriptionRust ADB (Android Debug Bridge) client library
homepage
repositoryhttps://github.com/cocool97/adb_client
max_upload_size
id508307
size63,996
(cocool97)

documentation

README

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

Commit count: 41

cargo fmt