Skip to content

Instantly share code, notes, and snippets.

@hm0429
Created October 11, 2015 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hm0429/858de4b8b40345389c24 to your computer and use it in GitHub Desktop.
Save hm0429/858de4b8b40345389c24 to your computer and use it in GitHub Desktop.
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