mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 22:46:14 +01:00
Add listen command to usbmuxd connection
This commit is contained in:
@@ -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:#?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user