17 "title" :
"HID Device",
18 "description" :
"Information about a USB or Bluetooth HID device.",
36 if (strcmp(json_object_get_string(js),
"location") == 0)
37 return VuoHidDevice_MatchLocation;
38 else if (strcmp(json_object_get_string(js),
"vendor-product") == 0)
39 return VuoHidDevice_MatchVendorAndProduct;
40 else if (strcmp(json_object_get_string(js),
"usage") == 0)
41 return VuoHidDevice_MatchUsage;
43 return VuoHidDevice_MatchName;
51 if (type == VuoHidDevice_MatchLocation)
53 else if (type == VuoHidDevice_MatchVendorAndProduct)
54 return "vendor-product";
55 else if (type == VuoHidDevice_MatchUsage)
94 json_object_object_add(js,
"matchType", matchTypeObject);
99 json_object_object_add(js,
"name", o);
105 json_object_object_add(js,
"location", o);
111 json_object_object_add(js,
"controls", o);
117 json_object_object_add(js,
"vendorID", o);
123 json_object_object_add(js,
"productID", o);
129 json_object_object_add(js,
"usagePage", o);
135 json_object_object_add(js,
"usage", o);
195 if (device.
matchType == VuoHidDevice_MatchLocation)
201 realizedDevice->vendorID = device.vendorID;
202 realizedDevice->productID = device.productID;
203 realizedDevice->usagePage = device.usagePage;
204 realizedDevice->usage = device.usage;
210 if ((device.
matchType == VuoHidDevice_MatchName && !device.
name)
211 || (device.
matchType == VuoHidDevice_MatchVendorAndProduct && (!device.vendorID || !device.productID))
212 || (device.
matchType == VuoHidDevice_MatchUsage && (!device.usagePage || !device.usage)))
219 if (deviceCount == 0)
221 VUserLog(
"Warning: No HID devices found.");
227 for (
unsigned long i = 1; i <= deviceCount; ++i)
231 || (device.
matchType == VuoHidDevice_MatchVendorAndProduct && d.vendorID == device.vendorID && d.productID == device.productID)
232 || (device.
matchType == VuoHidDevice_MatchUsage && d.usagePage == device.usagePage && d.usage == device.usage))
234 realizedDevice->
matchType = VuoHidDevice_MatchLocation;
238 realizedDevice->vendorID = d.vendorID;
239 realizedDevice->productID = d.productID;
240 realizedDevice->usagePage = d.usagePage;
241 realizedDevice->usage = d.usage;
254 VDebugLog(
"Warning: Didn't find a device matching those criteria.");
268 char *outputText = strdup(realizedDevice.
name);
274 return strdup(value.
name);
276 return strdup(
"Unknown device");