comms/usbmuxd: Workaround devd(8) race condition
When connecting an Apple device via USB, the device connects, usbmuxd is
started, then for reasons yet unknown, the device instantly disconnects,
and reconnects.
From dmesg when plugging in, for example:
ugen0.5: <Apple Inc. iPhone> at usbus0
<usbmuxd starts here>
ugen0.5: <Apple Inc. iPhone> at usbus0 (disconnected)
ugen0.5: <Apple Inc. iPhone> at usbus0
Due to the disconnect, the instance of usbmuxd that is spawned when the
device is first attached is subsequently killed by the unexplained
detach because the cdce(4) devices have not yet been created, but not
before the second instance of usbmuxd is started by the reattach. The
second instance automatically exits because two instances cannot run
simultaneously. The first instance then exits leaving no running
instances.
Adding a short sleep after the first instance is called to shutdown
gives it enough time to completely exit before the second instance is
spawned. Unfortunately, only one device is supported at a time until
I can figure out why the hotplugging isn't working.
While here, cleanup whitespace.
PR: 280014
Reported by: <fabio.comolli@gmail.com>