Skip to content

Instantly share code, notes, and snippets.

@hm0429
Created October 11, 2015 13:20
Embed
What would you like to do?
TSMC check
// Required to include #include <sys/sysctl.h>
- (BOOL)isTSMC {
size_t size;
sysctlbyname("hw.model", NULL, &size, NULL, 0);
char *model = (char*)malloc(size);
sysctlbyname("hw.model", model, &size, NULL, 0);
NSString *modelName = [NSString stringWithCString:model encoding:NSUTF8StringEncoding];
free(model);
NSLog(@"modelName: %@", modelName);
NSArray *tsmcModels = @[@"N71mAP", @"N66mAP"];
if ([tsmcModels containsObject:modelName]) {
NSLog(@"Yay!");
return true;
} else {
return false;
}
}
@hm0429
Copy link
Author

hm0429 commented Oct 11, 2015

// result
2015-10-11 21:19:32.105 HWInfo[2853:1508460] modelName: N71mAP
2015-10-11 21:19:32.106 HWInfo[2853:1508460] Yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment