Can't edit IORegistryEntry
Posted
by yangumi
on Stack Overflow
See other posts from Stack Overflow
or by yangumi
Published on 2010-04-10T21:24:17Z
Indexed on
2010/04/10
21:43 UTC
Read the original article
Hit count: 210
Hi,
I am creating a software on Mac and I would like to change the value of an IORegistryEntry. I can view it on the IORegistryExplorer, but I can't edit it. So it's my understanding that I have to edit it via code. Here is my code:
CFMutableDictionaryRef matchingDict = IOServiceNameMatching("AppleUSBMultitouchDriver");
io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, matchingDict);
if(service) {
CFStringRef manufacturer = IORegistryEntryCreateCFProperty(service, CFSTR("Manufacturer"), kCFAllocatorDefault,0);
NSLog(@"%@", (NSString*)manufacturer);
kern_return_t err = IORegistryEntrySetCFProperty(service, CFSTR("Manufacturer"), CFSTR("test"));
NSLog(@"error = %d", err);
}
This will output
2010-04-10 16:09:09.015 Test[41548:a0f] Apple Inc.
2010-04-10 16:09:09.015 Test[41548:a0f] error = 0
But after I check the value in the IORegistryExplorer, it still doesn't change. Does anybody have any suggestions?
Thank you
© Stack Overflow or respective owner