finder - device detected

I’m looking to do the following:

  • check if “x” device (iOS) is connected (usb) to the computer or the device names that are connect to macOS?

I know you can see hard drives by /Volumes/ but unsure about IOS devices with their name.

How would I go about doing that?

Here is simplified checking. The principle is simple - I know: when my phone named Samsung Galaxy J3 is connected, then System Profiler report contains following substring (which includes “Connected: Yes” in it).

I got this substring running do shell script “/usr/sbin/system_profiler SPBluetoothDataType” when my phone was connected (cutting control substring from the result). Then I use this substring to check if my phone is connected later:


set sRes to do shell script "/usr/sbin/system_profiler SPBluetoothDataType"

return sRes contains "Samsung Galaxy J3 (2016):
              Address: 08-78-08-00-AA-5B
              Major Type: Phone
              Minor Type: Smartphone
              Services: SMS/MMS Message Access, Android Network User, Headset Gateway, AV Remote Control Target, OBEX Object Push, OBEX Phonebook Access Server, Android Network Access Point, Handsfree Gateway, Advanced Audio
              Paired: Yes
              Configured: Yes
              Connected: Yes"

Thanks for taking the time to respond. I really appreciate it. My apologies if I wasn’t more clearer.

Unfortunately,

  • I’m looking to check the USB if the device (iOS) is connected. I believe what was shared was bluetooth.
  • Also, For Catalina and on. If the device shows up in the location sidebar (wifi finder sync)

thank you

No, it’s not yours, but my fault. You explained everything correctly, but I did not understand you, because I never connected the phone to the computer through a cable. You will need help from other users. By the way, bluetooth connection is also a special case of a USB connection. That’s why I didn’t understand you.

Ok thanks for your response. Hopefully someone else could provide some greater insight :slight_smile:

Either of these shell commands will provide information about iPhones plugged in via USB, including IP address; MacAddress and Serial Number.


set miniSysProfile to do shell script "system_profiler -detailLevel mini"

set basicSysProfile to do shell script "system_profiler -detailLevel basic"

(A simple "do shell script “system_profiler” takes forever and returns a ton of info you don’t need here)

Does that help?

Thanks for the response sorry for the delay.

So a device does show up called “iPhone” when connected to the usb. But it doesn’t have an unique identifiers that the iPhone itself have. The serial numbers don’t even match. iPhone has 12 characters for serial number while the output of the serial number is 40 characters in the output.

Thanks for the response. But it grabs the header of "USB Product Name" = "iPhone" it’s a bit generic it would be helpful if the name of the actual device would have displayed.

I have no unique identifier that I can see how to identify which IOS device. Unless I take the unique identifier that is displayed as the device identifier?

thats one way of doing it.