Get HID device property key as an unsigned int
| 67 | |
| 68 | // Get HID device property key as an unsigned int |
| 69 | unsigned int getDeviceUint(IOHIDDeviceRef ref, CFStringRef prop, unsigned int index) |
| 70 | { |
| 71 | CFTypeRef typeRef = IOHIDDeviceGetProperty(ref, prop); |
| 72 | if (typeRef && (CFGetTypeID(typeRef) == CFNumberGetTypeID())) |
| 73 | { |
| 74 | SInt32 value = 0; |
| 75 | CFNumberGetValue(static_cast<CFNumberRef>(typeRef), kCFNumberSInt32Type, &value); |
| 76 | return static_cast<unsigned int>(value); |
| 77 | } |
| 78 | |
| 79 | sf::err() << "Unable to read uint value for property '" << stringFromCFString(prop) << "' for joystick at index " |
| 80 | << index << std::endl; |
| 81 | return 0; |
| 82 | } |
| 83 | } // namespace |
| 84 | |
| 85 |
no test coverage detected