func getIntProp(device C.IOHIDDeviceRef, key C.CFStringRef) int32 { var value int32 ref := C.IOHIDDeviceGetProperty(device, key) if ref != nil { if C.CFGetTypeID(ref) == C.CFNumberGetTypeID() { C.CFNumberGetValue(C.CFNumberRef(ref), C.kCFNumberSInt32Type, unsafe.Pointer(&value)) return value } } return 0 }
func getStringProp(device C.IOHIDDeviceRef, key C.CFStringRef) string { s := C.IOHIDDeviceGetProperty(device, key) return gostring(C.CFStringRef(s)) }