From 35dee10f82711101a7d30d03f0ec781ac23221e9 Mon Sep 17 00:00:00 2001 From: Peter A Date: Sat, 22 Aug 2026 17:07:04 +0200 Subject: macOS: Avoid deviceinterfaced races during DFU reconnect During Port DFU-to-DFU re-enumeration, macOS deviceinterfaced daemon can acquire the USB interface first, making idevicerestore time out waiting for DFU reconnection. Add experimental flag: --exclusive-usb that keeps deviceinterfaced from claiming the USB device for the duration of the restore, by booting it out or repeatedly terminating it when bootout is denied (SIP on), then reloading and starting it again on exit. idevicerestore itself does not need to run as root for this. Only the launchctl subcommands that manage the system-domain deviceinterfaced daemon (bootout, bootstrap, kickstart, kill) are elevated individually via sudo, which may prompt for a password on the controlling terminal. Read-only queries (print) are run unprivileged. Document how to allow these specific commands via a scoped sudoers(5) NOPASSWD rule for unattended use. Co-authored-by: Nikias Bassen --- src/deviceinterfaced.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/deviceinterfaced.h (limited to 'src/deviceinterfaced.h') diff --git a/src/deviceinterfaced.h b/src/deviceinterfaced.h new file mode 100644 index 0000000..c8623ad --- /dev/null +++ b/src/deviceinterfaced.h @@ -0,0 +1,28 @@ +/* + * deviceinterfaced.h + * Control deviceinterfaced while accessing restore devices on macOS + * + * Copyright (c) 2026 libimobiledevice contributors. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DEVICEINTERFACED_H +#define DEVICEINTERFACED_H + +int deviceinterfaced_control_start(void); +void deviceinterfaced_control_stop(void); + +#endif -- cgit v1.1-32-gdbae