本文整理汇总了C++中OSObject::isEqualTo方法的典型用法代码示例。如果您正苦于以下问题:C++ OSObject::isEqualTo方法的具体用法?C++ OSObject::isEqualTo怎么用?C++ OSObject::isEqualTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSObject
的用法示例。
在下文中一共展示了OSObject::isEqualTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompareDeviceUsage
bool CompareDeviceUsage( IOService * owner, OSDictionary * matching, SInt32 * score, SInt32 increment)
{
// We return success if we match the key in the dictionary with the key in
// the property table, or if the prop isn't present
//
OSObject * usage;
OSObject * usagePage;
OSArray * functions;
OSDictionary * pair;
bool matches = true;
int count;
usage = matching->getObject( kIOHIDDeviceUsageKey );
usagePage = matching->getObject( kIOHIDDeviceUsagePageKey );
functions = OSDynamicCast(OSArray, owner->copyProperty( kIOHIDDeviceUsagePairsKey ));
if ( functions )
{
if ( usagePage || usage )
{
count = functions->getCount();
for (int i=0; i<count; i++)
{
if ( !(pair = (OSDictionary *)functions->getObject(i)) )
continue;
if ( !usagePage ||
!(matches = usagePage->isEqualTo(pair->getObject(kIOHIDDeviceUsagePageKey))) )
continue;
if ( score && !usage )
{
*score += increment / 2;
break;
}
if ( !usage ||
!(matches = usage->isEqualTo(pair->getObject(kIOHIDDeviceUsageKey))) )
continue;
if ( score )
*score += increment;
break;
}
}
functions->release();
} else {
matches = false;
}
return matches;
}
示例2: CompareProperty
//---------------------------------------------------------------------------
// Compare the properties in the supplied table to this object's properties.
bool CompareProperty( IOService * owner, OSDictionary * matching, const char * key, SInt32 * score, SInt32 increment)
{
// We return success if we match the key in the dictionary with the key in
// the property table, or if the prop isn't present
//
OSObject * value;
OSObject * property;
bool matches = true;
value = matching->getObject( key );
if( value)
{
property = owner->copyProperty( key );
if ( property )
{
matches = value->isEqualTo( property );
if (matches && score)
*score += increment;
property->release();
}
else
matches = false;
}
return matches;
}
示例3: copyProperty
bool
IOUSBNub::USBCompareProperty( OSDictionary * matching, const OSSymbol * key )
{
// We return success iff we match the key in the dictionary with the key in
// the property table.
//
OSObject *value;
bool matches = false;
OSObject *myProperty = NULL;
value = matching->getObject( key );
if ( value)
{
myProperty = copyProperty(key);
if (myProperty)
{
matches = value->isEqualTo( myProperty);
myProperty->release();
}
}
else
matches = false;
return matches;
}
示例4: matchPropertyTable
bool IOFireWireMagicMatchingNub::matchPropertyTable( OSDictionary * table )
{
OSObject *clientClass;
clientClass = table->getObject("IOClass");
if(!clientClass)
return false;
return clientClass->isEqualTo( getProperty( "IODesiredChild" ) );
}
示例5: start
bool FakeSMC::start(IOService *provider)
{
if (!super::start(provider))
return false;
int arg_value = 1;
// Check if we have SMC already
if (OSDictionary *matching = serviceMatching("IOACPIPlatformDevice")) {
if (OSIterator *iterator = getMatchingServices(matching)) {
OSString *smcNameProperty = OSString::withCString("APP0001");
while (IOService *service = (IOService*)iterator->getNextObject()) {
OSObject *serviceNameProperty = service->getProperty("name");
if (serviceNameProperty && serviceNameProperty->isEqualTo(smcNameProperty)) {
HWSensorsFatalLog("SMC device detected, will not create another one");
return false;
}
}
OSSafeRelease(iterator);
}
OSSafeRelease(matching);
}
if (!smcDevice->initAndStart(provider, this)) {
HWSensorsInfoLog("failed to initialize SMC device");
return false;
}
registerService();
// Load keys from NVRAM
if (PE_parse_boot_argn("-fakesmc-use-nvram", &arg_value, sizeof(arg_value))) {
if (UInt32 count = smcDevice->loadKeysFromNVRAM())
HWSensorsInfoLog("%d key%s loaded from NVRAM", count, count == 1 ? "" : "s");
else
HWSensorsInfoLog("NVRAM will be used to store system written keys...");
}
return true;
}
示例6: start
bool FakeSMC::start(IOService *provider)
{
if (!super::start(provider))
return false;
if (!(keyStore = OSDynamicCast(FakeSMCKeyStore, waitForMatchingService(serviceMatching(kFakeSMCKeyStoreService), kFakeSMCDefaultWaitTimeout)))) {
HWSensorsInfoLog("still waiting for FakeSMCKeyStore...");
return false;
// HWSensorsDebugLog("creating FakeSMCKeyStore");
//
// if (!(keyStore = new FakeSMCKeyStore)) {
// HWSensorsInfoLog("failed to create FakeSMCKeyStore");
// return false;
// }
//
// HWSensorsDebugLog("initializing FakeSMCKeyStore");
//
// if (keyStore->initAndStart(this, configuration)) {
// keyStore->setProperty("IOUserClientClass", "FakeSMCKeyStoreUserClient");
// }
// else {
// keyStore->release();
// HWSensorsFatalLog("failed to initialize FakeSMCKeyStore device");
// return false;
// }
}
// if (IOService *resources = waitForMatchingService(serviceMatching("IOResources"), 0))
// this->attach(resources);
OSDictionary *configuration = OSDynamicCast(OSDictionary, getProperty("Configuration"));
// Load preconfigured keys
HWSensorsDebugLog("loading keys...");
if (!configuration) {
HWSensorsFatalLog("no configuration node found!");
return false;
}
if (UInt32 count = keyStore->addKeysFromDictionary(OSDynamicCast(OSDictionary, configuration->getObject("Keys")))) {
HWSensorsInfoLog("%d preconfigured key%s added", count, count == 1 ? "" : "s");
}
else {
HWSensorsWarningLog("no preconfigured keys found");
}
// Load wellknown type names
HWSensorsDebugLog("loading types...");
keyStore->addWellKnownTypesFromDictionary(OSDynamicCast(OSDictionary, configuration->getObject("Types")));
// Set Clover platform keys
if (OSDictionary *dictionary = OSDynamicCast(OSDictionary, configuration->getObject("Clover"))) {
UInt32 count = 0;
if (IORegistryEntry* cloverPlatformNode = fromPath("/efi/platform", gIODTPlane)) {
if (OSIterator *iterator = OSCollectionIterator::withCollection(dictionary)) {
while (OSString *name = OSDynamicCast(OSString, iterator->getNextObject())) {
if (OSData *data = OSDynamicCast(OSData, cloverPlatformNode->getProperty(name))) {
if (OSArray *items = OSDynamicCast(OSArray, dictionary->getObject(name))) {
OSString *key = OSDynamicCast(OSString, items->getObject(0));
OSString *type = OSDynamicCast(OSString, items->getObject(1));
if (keyStore->addKeyWithValue(key->getCStringNoCopy(), type->getCStringNoCopy(), data->getLength(), data->getBytesNoCopy()))
count++;
}
}
}
OSSafeRelease(iterator);
}
}
if (count)
HWSensorsInfoLog("%d key%s exported by Clover EFI", count, count == 1 ? "" : "s");
}
// Check if we have SMC already
bool smcDeviceFound = false;
if (OSDictionary *matching = serviceMatching("IOACPIPlatformDevice")) {
if (OSIterator *iterator = getMatchingServices(matching)) {
OSString *smcNameProperty = OSString::withCString("APP0001");
while (IOService *service = (IOService*)iterator->getNextObject()) {
OSObject *serviceNameProperty = service->getProperty("name");
if (serviceNameProperty && serviceNameProperty->isEqualTo(smcNameProperty)) {
smcDeviceFound = true;
}
}
OSSafeRelease(iterator);
}
OSSafeRelease(matching);
}
if (!smcDeviceFound) {
//.........这里部分代码省略.........