35 if (strcmp(json_object_get_string(js),
"location") == 0)
36 return VuoHidDevice_MatchLocation;
37 else if (strcmp(json_object_get_string(js),
"vendor-product") == 0)
38 return VuoHidDevice_MatchVendorAndProduct;
39 else if (strcmp(json_object_get_string(js),
"usage") == 0)
40 return VuoHidDevice_MatchUsage;
42 return VuoHidDevice_MatchName;
90 json_object *js = json_object_new_object();
93 json_object_object_add(js,
"matchType", matchTypeObject);
98 json_object_object_add(js,
"name", o);
104 json_object_object_add(js,
"location", o);
110 json_object_object_add(js,
"controls", o);
116 json_object_object_add(js,
"vendorID", o);
122 json_object_object_add(js,
"productID", o);
128 json_object_object_add(js,
"usagePage", o);
134 json_object_object_add(js,
"usage", o);
194 if (device.
matchType == VuoHidDevice_MatchLocation)
200 realizedDevice->vendorID = device.vendorID;
201 realizedDevice->productID = device.productID;
202 realizedDevice->usagePage = device.usagePage;
203 realizedDevice->usage = device.usage;
209 if ((device.
matchType == VuoHidDevice_MatchName && !device.
name)
210 || (device.
matchType == VuoHidDevice_MatchVendorAndProduct && (!device.vendorID || !device.productID))
211 || (device.
matchType == VuoHidDevice_MatchUsage && (!device.usagePage || !device.usage)))
218 if (deviceCount == 0)
220 VUserLog(
"Warning: No HID devices found.");
226 for (
unsigned long i = 1; i <= deviceCount; ++i)
230 || (device.
matchType == VuoHidDevice_MatchVendorAndProduct && d.vendorID == device.vendorID && d.productID == device.productID)
231 || (device.
matchType == VuoHidDevice_MatchUsage && d.usagePage == device.usagePage && d.usage == device.usage))
233 realizedDevice->
matchType = VuoHidDevice_MatchLocation;
237 realizedDevice->vendorID = d.vendorID;
238 realizedDevice->productID = d.productID;
239 realizedDevice->usagePage = d.usagePage;
240 realizedDevice->usage = d.usage;
253 VUserLog(
"Warning: Didn't find a device matching those criteria.");