Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
hardware info ...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hardware info ...



ok, I manage to create a class which gather device driver info, I have
a hardware specific
+ (CFMutableDictionaryRef) MyDeviceMatchDict;
method for each device I want to query, and everything else is
automatic (samples below)

I'm getting quite easily the mouse, keyboard, modem info.
I have real problem to get CD-Drive, Hard-Drive info .....

here are my matching dicts (mouse & SCSI, so you could compare).
BTW, I don't know yet how to access CD-Drive, but just SCSI device, any
ideas ?


// --- code ----
// this one is working
+ (CFMutableDictionaryRef) MouseMatchDict
{
CFMutableDictionaryRef ref = IOServiceMatching(kIOHIDDeviceKey);

if (ref != NULL)
{
UInt32 dev = kHIDUsage_GD_Mouse;
CFNumberRef refdev = CFNumberCreate (kCFAllocatorDefault,
kCFNumberIntType, &dev);
CFDictionarySetValue (ref, CFSTR (kIOHIDPrimaryUsageKey),
refdev);
CFRelease(refdev);

dev = kHIDPage_GenericDesktop;
refdev = CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType,
&dev);
CFDictionarySetValue (ref, CFSTR (kIOHIDPrimaryUsagePageKey),
refdev);
CFRelease(refdev);
}

return ref;
}

// -- not working, at last not as expected
// get nothing, neither does the NonauthoringSCSIMatchDict
// BTW, what this 'Authoring' means ?
+ (CFMutableDictionaryRef) AuthoringSCSIMatchDict
{
CFMutableDictionaryRef matchingDict;
CFMutableDictionaryRef subDict;

matchingDict = CFDictionaryCreateMutable ( kCFAllocatorDefault, 0,
NULL, NULL );
subDict = CFDictionaryCreateMutable ( kCFAllocatorDefault, 0,
NULL, NULL );

// Create a dictionary with the "SCSITaskDeviceCategory" key =
"SCSITaskAuthoringDevice"
CFDictionarySetValue ( subDict,
CFSTR ( kIOPropertySCSITaskDeviceCategory ),
CFSTR ( kIOPropertySCSITaskAuthoringDevice
) );

// Add the dictionary to the main dictionary with the key
"IOPropertyMatch" to
// narrow the search to the above dictionary.
CFDictionarySetValue ( matchingDict,
CFSTR ( kIOPropertyMatchKey ),
subDict );

//CFRelease( subDict );

return matchingDict;
}

// get the CD-ROm (not the CD-Drive) !
+ (CFMutableDictionaryRef) CDRomMatchDict
{
CFMutableDictionaryRef ref = IOServiceMatching(kIOCDMediaClass);
if (ref != NULL)
{
CFDictionarySetValue(
ref,
CFSTR(kIOMediaEjectable),
kCFBooleanTrue);
}
return ref;
}
_______________________________________________
darwin-userlevel mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-userlevel
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.