From f6aa8f29a50d7909802efdc6813dd8a6cdd345e7 Mon Sep 17 00:00:00 2001 From: jkcoxson Date: Fri, 29 Apr 2022 15:32:31 -0600 Subject: [PATCH] Add information about passcode setting --- src/pair.rs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/pair.rs b/src/pair.rs index 98ed65c..43480eb 100644 --- a/src/pair.rs +++ b/src/pair.rs @@ -1,6 +1,6 @@ // jkcoxson -use rusty_libimobiledevice::{idevice::get_devices, services::userpref}; +use rusty_libimobiledevice::{error::LockdowndError, idevice::get_devices, services::userpref}; const VERSION: &str = "0.1.2"; @@ -133,13 +133,23 @@ fn main() { }; // Turn on WiFi sync so JitStreamer can pair - lockdown_client - .set_value( - "EnableWifiDebugging".to_string(), - "com.apple.mobile.wireless_lockdown".to_string(), - true.into(), - ) - .unwrap(); + match lockdown_client.set_value( + "EnableWifiDebugging".to_string(), + "com.apple.mobile.wireless_lockdown".to_string(), + true.into(), + ) { + Ok(_) => {} + Err(e) => { + if e == LockdowndError::UnknownError { + println!("You need to set a passcode on your device for this to work."); + wait_for_enter(); + return; + } else { + println!("Error setting value: {:?}", e); + continue; + } + } + } loop { match lockdown_client.pair(None, None) {