Getting vender id from mount point

Hello,

I'd like to know if there is a way to get this properties(like the image below) of a USB thumb drive from a mount point(/Volumes/mydrive) in a generic kernel extension? Thanks!


https://www.dropbox.com/s/5ykusvrlz7apzzs/IORegistryExplorer.png?raw=1

Accepted Reply

I decide to check the volume type in user space.

Wise choice!

Could you please take a look at my code. Is it correct?

You can do this more easily by calling

statfs
and then passing
f_mntfromname
to
DADiskCreateFromBSDName
.

Also, it’s a lot easier to wrangle dictionaries from Objective-C (or Objective-C++, if you’re so inclined). For example:

struct statfs stfs;

int err = statfs("/", &stfs);
…  check error …

if ( !(stfs.f_flags & MNT_LOCAL) ) {
    … bail out …
}

DASessionRef session = DASessionCreate(NULL);
CFAutorelease(session);

DADiskRef disk = DADiskCreateFromBSDName(NULL, session, stfs.f_mntfromname);
CFAutorelease(disk);

NSDictionary * diskInfo = CFBridgingRelease( DADiskCopyDescription(disk) );
BOOL isRemovable = [diskInfo[(__bridge NSString *) kDADiskDescriptionMediaRemovableKey] boolValue];
NSLog(@"removable: %@", isRemovable ? @"YES" : @"NO");

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

I just wonder if there is a specific background daemon, which is responsible for burning files in the

.fpbf
folder to DVD drive. If so, what’s its name?

I don’t know but, even if I did, special casing a daemon by its name is a really bad idea from a binary compatibility perspective. Apple renames stuff like that all the time.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks for your reply.