for example, i have a flash disk(KingStone Mass Storage), and only one partition , so when I plug it on mac. I’ll see a Volume(it might be /Volumes/KingStone) was mounted automatically. we could see volume(/Volumes/Kingstone) is belong to the KingSton disk.
but now I pluged another disk, such as AData disk. and another volume was mounted. and how could I know which volume is belong to kingstone disk.(we could know which disk is kongston by VenderID).
now in code, we could know mounted volumes by call [[NSWorkspace sharedWorkspace] mountedRemovableMedia] OR [[NSFileManager defaultFileManager] mountedVolumeURLsInclud.....]
we could also know all usb device by using kIOUSBDeviceClassName with IOServiceMatching and IOServicesGetMatchingServices
even kIOMediaClassName with the two function we will know volume media,
we could determine every volume media belongs to which usb device by path.
but I don’t know the mount point of volume media.
either something else useful.
sorry for my pool English.
Another way.
Create a Matching Dictionary with kIOMediaClass
if you only want to get removable storage volume
set the dictionary with kIOMediaRemovableKey and kCFBooleanTrue
and getting matching service now,
you can enumerate your device now.
and you could Observer mount/unmount event like below