iPhone-Mac connection issue and what does the usbd process do?

Solution 1:

I had the same problem and I was thinking that my Mac had some current problem into the usb connectors. I solved the problem using usb to lightning cables from a different brand, certified for Apple devices. They appear to be a little more thick than the original ones. I saw that problem in various older iMac (2012-2014) and every time I solved using a cable from a different factory.

Solution 2:

Thank you very much for the detailed report. I have the same problem on macOS 10.15.4, never had any problem with the same cable and the same iPhone on macOS 10.13.

The might have added some cable checks to usbd in order to stop unofficial cable usage.

There's a funny thing, though. Here on Catalina even when usbd has been killed this is the output of system_profiler SPUSBDataType:

 iPhone:

      Product ID: 0x12a8
      Vendor ID: 0x05ac (Apple Inc.)
      Version: 8.01
      Serial Number: [REDACTED]
      Speed: Up to 480 Mb/s
      Manufacturer: Apple Inc.
      Location ID: 0x14200000 / 18
      Current Available (mA): 500
      Current Required (mA): 500
      Extra Operating Current (mA): 1600
      Sleep current (mA): 2100

and it actually charges the iPhone pretty fast.

Is there any way to permanently disable usbd?

I also run locate usbd, here is /usr/share/sandbox/com.apple.usbd.sb:

;; Copyright (c) 2012 Apple Inc.  All Rights reserved.
;;
;; WARNING: The sandbox rules in this file currently constitute 
;; Apple System Private Interface and are subject to change at any time and
;; without notice. The contents of this file are also auto-generated and not
;; user editable; it may be overwritten at any time.
;;

(version 1)

(deny default)
(import "system.sb")

(allow distributed-notification-post)

(allow mach-per-user-lookup)

(allow file*
       (literal "/private/var/root/Library/Preferences/com.apple.usbd.plist")
)


(allow file-read*
       (literal "/AppleInternal")
       (literal "/usr/libexec")
       (literal "/usr/libexec/usbd")
       (literal "/private/var/root")
       (literal "/dev/console")
       (literal "/private/var/root/Library/Preferences/.GlobalPreferences.plist")
       (literal "/Library/Preferences/.GlobalPreferences.plist")
       (literal "/Library/Application Support/CrashReporter/SubmitDiagInfo.domains")
       (regex   "^/private/var/root/Library/Preferences/ByHost/\.GlobalPreferences\..*\.plist$")
)

(allow file-read-metadata
    (literal "/")
    (literal "/Library")
    (literal "/Library/Application Support/CrashReporter/SubmitDiagInfo.domains")
    (literal "/private")
    (literal "/private/var")
    (literal "/private/var/root")
)

;;crashtracer support

(allow system-socket)
(allow file-read-metadata
    (subpath "/Library/Application Support/CrashReporter/SubmitDiagInfo.domains")
    (literal "/Library/Caches/com.apple.DiagnosticReporting.HasBeenAppleInternal"))

(allow mach-lookup
    (global-name "com.apple.USBAgent")
    (global-name "com.apple.PowerManagement.control")
    (global-name "com.apple.SystemConfiguration.configd")
    (global-name-regex #"^com.apple.distributed_notifications")
)

(allow ipc-posix-shm
       (ipc-posix-name "apple.shm.notification_center")
)

(allow iokit-open
       (iokit-user-client-class "IOUSBDeviceUserClientV2")
)

Does this mean anything to anyone? I'd want to check the differences between usbd from 10.13 to 10.15.

Solution 3:

Thank you so much for doing the legwork on investigating this issue! My mother-in-law has this issue every time she plugs in her iPhone to download photos, so I needed to find a simple solution for grandma to get her pics of her grandkids into her computer despite the constant disconnecting. Using the information @AVelj provided for the temporary fix, I created a LaunchDaemon to make it permanent. Here's what I did.

I created a shell script called connect-iPhone.sh that contained the following text:

#!/bin/bash
killall -STOP -c usbd

I stored it at /Users/<username>/Documents/connect-iPhone.sh

Then I created another file named pauseusbd.plist with the following text:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>Label</key>
        <string>com.pauseusbd.app</string>

        <key>Program</key>
        <string>/Users/<username>/Documents/connect-iPhone.sh</string>

        <key>RunAtLoad</key>
        <true/>
    </dict>
</plist>

I saved that to /Library/LaunchDaemons. Then I used the following to make root the owner:

sudo chown root:wheel /Library/LaunchDaemons/pauseusbd.plist

Then I ran the following to load the plist so it runs on each reboot:

sudo launchctl load /Library/LaunchDaemons/pauseusbd.plist

Of course this will prevent Apple devices from charging faster than allowed by the USB spec, but it will also keep it connected. And that's all my grandkid-loving mother-in-law cares about. She's got a wall charger for charging.

I know this doesn't directly answer the why that the OP asked, but I wanted to provide a more permanent workaround for anyone else who is plagued by this issue. And thanks again to @AVelj for the thorough documentation!

References:

This post!

Plist in /System/Library/LaunchAgents not loading on reboot

What are the differences between LaunchAgents and LaunchDaemons?