diff --git a/adb_client/Cargo.toml b/adb_client/Cargo.toml
index e8a18fd..80c55d5 100644
--- a/adb_client/Cargo.toml
+++ b/adb_client/Cargo.toml
@@ -17,6 +17,7 @@ rustdoc-args = ["--cfg", "docsrs"]
[features]
default = []
mdns = ["dep:mdns-sd"]
+usb = ["dep:rsa", "dep:rusb"]
[dependencies]
base64 = { version = "0.22.1" }
@@ -35,8 +36,6 @@ rcgen = { version = "0.13.2", default-features = false, features = [
"pem",
] }
regex = { version = "1.12.2", features = ["perf", "std", "unicode"] }
-rsa = { version = "0.9.8" }
-rusb = { version = "0.9.4", features = ["vendored"] }
rustls = { version = "0.23.33" }
rustls-pki-types = { version = "1.12.0" }
serde = { version = "1.0.228", features = ["derive"] }
@@ -50,6 +49,11 @@ mdns-sd = { version = "0.13.11", default-features = false, features = [
"logging",
], optional = true }
#########
+#########
+# USB-only dependencies
+rsa = { version = "0.9.7", optional = true }
+rusb = { version = "0.9.4", features = ["vendored"], optional = true }
+#########
[dev-dependencies]
anyhow = { version = "1.0.100" }
diff --git a/adb_client/README.md b/adb_client/README.md
index d284cca..87cd518 100644
--- a/adb_client/README.md
+++ b/adb_client/README.md
@@ -18,9 +18,10 @@ adb_client = "*"
## Crate features
-|Feature|Description|Default?|
-|:-----:|:---------:|:-----:|
-|`mdns`|Enables mDNS device discovery on local network.|No|
+| Feature | Description | Default? |
+| :-----: | :---------------------------------------------: | :------: |
+| `mdns` | Enables mDNS device discovery on local network. | No |
+| `usb` | Enables interactions with USB devices. | No |
To deactivate some features you can use the `default-features = false` option in your `Cargo.toml` file and manually specify the features you want to activate:
@@ -37,11 +38,11 @@ Benchmarks run on `v2.0.6`, on a **Samsung S10 SM-G973F** device and an **Intel
`ADBServerDevice` performs all operations by using adb server as a bridge.
-|File size|Sample size|`ADBServerDevice`|`adb`|Difference|
-|:-------:|:---------:|:----------:|:---:|:-----:|
-|10 MB|100|350,79 ms|356,30 ms|
-1,57 %
|
-|500 MB|50|15,60 s|15,64 s|-0,25 %
|
-|1 GB|20|31,09 s|31,12 s|-0,10 %
|
+| File size | Sample size | `ADBServerDevice` | `adb` | Difference |
+| :-------: | :---------: | :---------------: | :-------: | :------------------------------------: |
+| 10 MB | 100 | 350,79 ms | 356,30 ms | -1,57 %
|
+| 500 MB | 50 | 15,60 s | 15,64 s | -0,25 %
|
+| 1 GB | 20 | 31,09 s | 31,12 s | -0,10 %
|
## Examples
diff --git a/adb_client/src/device/adb_transport_message.rs b/adb_client/src/device/adb_transport_message.rs
index 56a8753..93cd297 100644
--- a/adb_client/src/device/adb_transport_message.rs
+++ b/adb_client/src/device/adb_transport_message.rs
@@ -4,10 +4,6 @@ use crate::{Result, RustADBError};
use super::models::MessageCommand;
-pub const AUTH_TOKEN: u32 = 1;
-pub const AUTH_SIGNATURE: u32 = 2;
-pub const AUTH_RSAPUBLICKEY: u32 = 3;
-
#[derive(Debug)]
pub struct ADBTransportMessage {
header: ADBTransportMessageHeader,
diff --git a/adb_client/src/device/adb_usb_device.rs b/adb_client/src/device/adb_usb_device.rs
index 83ee812..c213202 100644
--- a/adb_client/src/device/adb_usb_device.rs
+++ b/adb_client/src/device/adb_usb_device.rs
@@ -15,9 +15,13 @@ use super::{ADBRsaKey, ADBTransportMessage};
use crate::ADBDeviceExt;
use crate::ADBMessageTransport;
use crate::ADBTransport;
-use crate::device::adb_transport_message::{AUTH_RSAPUBLICKEY, AUTH_SIGNATURE, AUTH_TOKEN};
+use crate::utils::get_default_adb_key_path;
use crate::{Result, RustADBError, USBTransport};
+const AUTH_TOKEN: u32 = 1;
+const AUTH_SIGNATURE: u32 = 2;
+const AUTH_RSAPUBLICKEY: u32 = 3;
+
pub fn read_adb_private_key>(private_key_path: P) -> Result