Skip to content

Commit

Permalink
Remove USB impl
Browse files Browse the repository at this point in the history
  • Loading branch information
jkcoxson committed Jan 29, 2025
1 parent a49153c commit bb1477b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 137 deletions.
31 changes: 0 additions & 31 deletions src/devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,28 +119,6 @@ impl SharedDevices {
self.devices.values().find(|x| x.device_id == id)
}

#[cfg(feature = "usb")]
pub fn add_usb_device(&mut self, udid: String, _data: Arc<Mutex<Self>>) {
self.last_index += 1;
self.last_interface_index += 1;

let dev = MuxerDevice {
connection_type: "USB".to_string(),
device_id: self.last_index,
service_name: None,
interface_index: self.last_interface_index,
network_address: None,
serial_number: udid,
heartbeat_handle: None,
connection_speed: None,
location_id: None,
product_id: None,
};

info!("Adding device: {:?}", dev.serial_number);
self.devices.insert(dev.serial_number.clone(), dev);
}

pub fn remove_device(&mut self, udid: &String) {
if !self.devices.contains_key(udid) {
warn!("Device isn't in the muxer, skipping");
Expand Down Expand Up @@ -286,15 +264,6 @@ impl SharedDevices {
trace!("No UDID found after a re-cache");
Err(())
}

#[cfg(feature = "usb")]
pub fn check_udid(&mut self, udid: String) -> bool {
if self.paired_udids.contains(&udid) {
return true;
}
self.update_cache();
self.paired_udids.contains(&udid)
}
}

impl From<&MuxerDevice> for plist::Dictionary {
Expand Down
16 changes: 0 additions & 16 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ mod devices;
mod heartbeat;
mod mdns;
mod raw_packet;
#[cfg(feature = "usb")]
mod usb;

#[tokio::main]
async fn main() {
Expand All @@ -38,8 +36,6 @@ async fn main() {
let mut use_unix = true;

let mut use_mdns = true;
#[cfg(feature = "usb")]
let mut use_usb = false;

// Loop through args
let mut i = 0;
Expand All @@ -66,11 +62,6 @@ async fn main() {
use_mdns = false;
i += 1;
}
#[cfg(feature = "usb")]
"--enable-usb" => {
use_usb = true;
i += 1;
}
"--disable-heartbeat" => {
use_heartbeat = false;
i += 1;
Expand Down Expand Up @@ -111,8 +102,6 @@ async fn main() {
));
info!("Created new central data");
let data_clone = data.clone();
#[cfg(feature = "usb")]
let usb_data = data.clone();

if let Some(host) = host.clone() {
let tcp_data = data.clone();
Expand Down Expand Up @@ -169,11 +158,6 @@ async fn main() {
});
}

#[cfg(feature = "usb")]
if use_usb {
usb::start_listener(usb_data);
}

if use_mdns {
let local = tokio::task::LocalSet::new();
local.spawn_local(async move {
Expand Down
4 changes: 2 additions & 2 deletions src/mdns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub async fn discover(data: Arc<Mutex<SharedDevices>>) {

let mac_addr = name.split("@").collect::<Vec<&str>>()[0];
let mut lock = data.lock().await;
if let Ok(udid) = lock.get_udid_from_mac(mac_addr.to_string()) {
if let Ok(udid) = lock.get_udid_from_mac(mac_addr.to_string()).await {
if lock.devices.contains_key(&udid) {
info!("Device has already been added to muxer, skipping");
continue;
Expand Down Expand Up @@ -101,7 +101,7 @@ pub async fn discover(data: Arc<Mutex<SharedDevices>>) {
}
let mac_addr = mac_addr.unwrap();
let mut lock = data.lock().await;
if let Ok(udid) = lock.get_udid_from_mac(mac_addr.to_string()) {
if let Ok(udid) = lock.get_udid_from_mac(mac_addr.to_string()).await {
if lock.devices.contains_key(&udid) {
info!("Device has already been added to muxer, skipping");
continue;
Expand Down
88 changes: 0 additions & 88 deletions src/usb.rs

This file was deleted.

0 comments on commit bb1477b

Please sign in to comment.