+static const char* usb_str_transfer_status(int e)
+{
+ static char unknerr[256];
+
+ switch (e) {
+ case LIBUSB_TRANSFER_COMPLETED:
+ return "Transfer completed";
+ case LIBUSB_TRANSFER_ERROR:
+ return "Transfer error";
+ case LIBUSB_TRANSFER_TIMED_OUT:
+ return "Transfer timed out";
+ case LIBUSB_TRANSFER_CANCELLED:
+ return "Transfer cancelled";
+ case LIBUSB_TRANSFER_STALL:
+ return "For bulk/interrupt endpoints: endpoint stalled. For control endpoints: control request not supported.";
+ case LIBUSB_TRANSFER_NO_DEVICE:
+ return "No device";
+ case LIBUSB_TRANSFER_OVERFLOW:
+ return "Transfer overflow";
+ };
+ snprintf(unknerr, sizeof(unknerr), "Unknown transfer status %d / 0x%02x", e, e);
+ return unknerr;
+}
+
+static libusb_device_handle *hmcfgusb_find(int vid, int pid, char *serial) {