look for other orbic PID

This commit is contained in:
Cooper Quintin
2025-05-20 10:23:29 -07:00
committed by Will Greenberg
parent 382702a9ee
commit 3358a06454

View File

@@ -1,5 +1,5 @@
use std::io::{ErrorKind, Write};
use std::path::Path;
use std::path::{Path, Prefix};
use std::time::Duration;
use adb_client::{ADBDeviceExt, ADBUSBDevice, RustADBError};
@@ -30,8 +30,7 @@ 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;
const PRODUCT_ID: u16 = 0xf626;
const PRODUCT_ID: u16 = 0xf601;
macro_rules! echo {
($($arg:tt)*) => {
@@ -392,7 +391,7 @@ pub fn enable_command_mode() -> Result<()> {
let timeout = Duration::from_secs(1);
if let Some(device) = open_usb_device(VENDOR_ID, 0xf626)? {
if let Some(device) = open_usb_device(VENDOR_ID, PRODUCT_ID)? {
let enable_command_mode = Control {
control_type: ControlType::Vendor,
recipient: Recipient::Device,
@@ -435,6 +434,14 @@ pub fn open_orbic() -> Result<Option<Interface>> {
return Ok(Some(interface));
}
// Another device with rndis enabled as well
if let Some(device) = open_usb_device(VENDOR_ID, 0xf626)? {
let interface = device
.detach_and_claim_interface(1) // will reattach drivers on release
.context("detach_and_claim_interface(1) failed")?;
return Ok(Some(interface));
}
Ok(None)
}