Add listen command to usbmuxd connection

This commit is contained in:
Jackson Coxson
2025-10-18 18:10:53 -06:00
parent aff3ef589f
commit 2ffeb0f25c
3 changed files with 185 additions and 57 deletions

View File

@@ -1,6 +1,7 @@
// Jackson Coxson
// Gets the devices from the muxer
use futures_util::StreamExt;
use idevice::usbmuxd::UsbmuxdConnection;
#[tokio::main]
@@ -10,4 +11,13 @@ async fn main() {
let mut muxer = UsbmuxdConnection::default().await.unwrap();
let res = muxer.get_devices().await.unwrap();
println!("{res:#?}");
let args: Vec<String> = std::env::args().collect();
if args.len() > 1 && args[1] == "-l" {
let mut s = muxer.listen().await.expect("listen failed");
while let Some(dev) = s.next().await {
let dev = dev.expect("failed to read from stream");
println!("{dev:#?}");
}
}
}