+static struct sr_dev_inst *probe_device_enum(struct hid_device_info *dev)
+{
+ return probe_device_common(dev->path,
+ dev->manufacturer_string, dev->product_string);
+}
+
+static struct sr_dev_inst *probe_device_path(const char *path)
+{
+ hid_device *dev;
+ gboolean ok;
+ int ret;
+ wchar_t vendor[32], product[32];
+
+ /*
+ * TODO Accept different types of conn= specs? Either paths that
+ * hidapi(3) can open. Or bus.addr specs that we can check for
+ * during USB enumeration and derive a hidapi(3) compatible path
+ * from? Is some "unescaping" desirable for platforms which have
+ * colons in hidapi(3) paths that collide with how conn= specs
+ * are passed in sigrok? This would be the place to translate
+ * the 'path' to a canonical format.
+ */
+
+ dev = hid_open_path(path);
+ if (!dev) {
+ sr_err("Cannot open %s.", path);
+ return NULL;
+ }
+
+ ok = TRUE;
+ ret = hid_get_manufacturer_string(dev, vendor, ARRAY_SIZE(vendor));
+ if (ret != 0)
+ ok = FALSE;
+ if (!wcslen(vendor))
+ ok = FALSE;
+ ret = hid_get_product_string(dev, product, ARRAY_SIZE(product));
+ if (ret != 0)
+ ok = FALSE;
+ if (!wcslen(product))
+ ok = FALSE;
+ hid_close(dev);
+ if (!ok)
+ return NULL;
+
+ return probe_device_common(path, vendor, product);
+}
+