Get HID device property key as a string
| 51 | |
| 52 | // Get HID device property key as a string |
| 53 | std::string getDeviceString(IOHIDDeviceRef ref, CFStringRef prop, unsigned int index) |
| 54 | { |
| 55 | CFTypeRef typeRef = IOHIDDeviceGetProperty(ref, prop); |
| 56 | if (typeRef && (CFGetTypeID(typeRef) == CFStringGetTypeID())) |
| 57 | { |
| 58 | const auto* str = static_cast<CFStringRef>(typeRef); |
| 59 | return stringFromCFString(str); |
| 60 | } |
| 61 | |
| 62 | sf::err() << "Unable to read string value for property '" << stringFromCFString(prop) << "' for joystick at index " |
| 63 | << index << std::endl; |
| 64 | return "Unknown Joystick"; |
| 65 | } |
| 66 | |
| 67 | |
| 68 | // Get HID device property key as an unsigned int |
no test coverage detected