Add special case for PermissionDenied on macOS

On macOS this can mean the device is busy.
This commit is contained in:
Sashanoraa
2025-05-15 13:44:29 -04:00
committed by Cooper Quintin
parent ec5bd81a70
commit 6a16ad7f15
2 changed files with 13 additions and 2 deletions
Generated
+2 -2
View File
@@ -5,7 +5,7 @@ version = 4
[[package]]
name = "adb_client"
version = "2.1.11"
source = "git+https://github.com/gaykitty/adb_client.git?branch=rayhunter#6a8054f0e04be9d669e06631e23882e6403d6e1e"
source = "git+https://github.com/gaykitty/adb_client.git?branch=rayhunter#1fb0f4f5cbcc95bbbb98db4ee2f1e53a1005aa81"
dependencies = [
"async-io",
"base64",
@@ -585,7 +585,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
dependencies = [
"lazy_static",
"windows-sys 0.59.0",
"windows-sys 0.48.0",
]
[[package]]
+11
View File
@@ -24,6 +24,13 @@ const ORBIC_BUSY: &str = r#"The Orbic is plugged in but is being used by another
Please close any program that might be using your USB devices.
If you have adb installed you may need to kill the adb daemon"#;
#[cfg(target_os = "macos")]
const ORBIC_BUSY_MAC: &str = r#"Permission denied.
On macOS this might be caused by another program using the Orbic.
Please close any program that might be using your Orbic.
If you have adb installed you may need to kill the adb daemon"#;
const VENDOR_ID: u16 = 0x05c6;
const PRODUCT_ID: u16 = 0xf601;
@@ -251,6 +258,10 @@ async fn wait_for_adb_shell() -> Result<ADBUSBDevice> {
Err(RustADBError::IOError(e)) if e.kind() == ErrorKind::ResourceBusy => {
bail!(ORBIC_BUSY);
}
#[cfg(target_os = "macos")]
Err(RustADBError::IOError(e)) if e.kind() == ErrorKind::PermissionDenied => {
bail!(ORBIC_BUSY_MAC);
}
Err(RustADBError::DeviceNotFound(_)) => {
wait_for_usb_device(VENDOR_ID, PRODUCT_ID).await?;
}