| 16 | using std::min; |
| 17 | |
| 18 | static bool goodProbe(io_service_t theService) |
| 19 | { |
| 20 | if (!IOObjectConformsTo(theService, kIOHIDDeviceKey)) { |
| 21 | return false; |
| 22 | } |
| 23 | CFMutableDictionaryRef dict; |
| 24 | |
| 25 | IORegistryEntryCreateCFProperties(theService, &dict, kCFAllocatorDefault, 0); |
| 26 | CFTypeRef aNum = CFDictionaryGetValue(dict, CFSTR(kIOHIDProductIDKey)); |
| 27 | int tmpNum; |
| 28 | ::CFNumberGetValue((CFNumberRef)aNum, kCFNumberIntType, &tmpNum); |
| 29 | if (tmpNum != 765) { |
| 30 | CFRelease(dict); |
| 31 | return false; |
| 32 | } |
| 33 | aNum = CFDictionaryGetValue(dict, CFSTR(kIOHIDVendorIDKey)); |
| 34 | ::CFNumberGetValue((CFNumberRef)aNum, kCFNumberIntType, &tmpNum); |
| 35 | if (tmpNum != 1118) { |
| 36 | CFRelease(dict); |
| 37 | return false; |
| 38 | } |
| 39 | |
| 40 | CFRelease(dict); |
| 41 | return true; |
| 42 | } |
| 43 | |
| 44 | #define LoopGranularity 10000 // Microseconds |
| 45 |
no outgoing calls
no test coverage detected