Post

Replies

Boosts

Views

Activity

Reply to which flag of DiskArbitration is to indicate the external drive
Thanks very much, Eskimo!I am developing an application that uses disk arbitration to find out which devices are connected to a machine and react to connect/disconnect events./dev/disk0 (internal): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme 1.0 TB disk0 1: EFI EFI 314.6 MB disk0s1 2: Apple_APFS Container disk1 1.0 TB disk0s2 /dev/disk1 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +1.0 TB disk1 Physical Store disk0s2 1: APFS Volume Macintosh HD 509.7 GB disk1s1 2: APFS Volume Preboot 44.5 MB disk1s2 3: APFS Volume Recovery 513.5 MB disk1s3 4: APFS Volume VM 2.1 GB disk1s4 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *1.0 TB disk2 1: Windows_NTFS TOSHIBA EXT 1.0 TB disk2s1 /dev/disk3 (disk image): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme +10.1 MB disk3 1: Apple_HFS File Transfer 10.0 MB disk3s1As the output of Disktutil above, I assume all ejectable drivers are the external drives(such as .dmg, CD/DVD drives, external hard drive...), so I can use kDADiskDescriptionMediaEjectableKey to identify them as below? or any other way?ASessionRef session = DASessionCreate(NULL); if (session) { disk = DADiskCreateFromBSDName(NULL, session, "/dev/disk2s1"); if (disk) { descDict = DADiskCopyDescription(disk); if (descDict) { object = CFDictionaryGetValue(description, kDADiskDescriptionMediaEjectableKey); if (object) { if (object == kCFBooleanTrue) { return true; } } } } }As you mentioned, I can use kDADiskDescriptionDeviceInternalKey to identify the local driver, so I can also use ‘not internal’ to replace the above approach?
Mar ’20