return NULL;
}
+int hmcfgusb_send_null_frame(struct hmcfgusb_dev *usbdev)
+{
+ int err;
+ int cnt;
+
+ err = libusb_interrupt_transfer(usbdev->usb_devh, EP_OUT, NULL, 0, &cnt, USB_TIMEOUT);
+ if (err) {
+ fprintf(stderr, "Can't send data: %s\n", usb_strerror(err));
+ return 0;
+ }
+
+ return 1;
+}
+
int hmcfgusb_send(struct hmcfgusb_dev *usbdev, unsigned char* send_data, int len, int done)
{
int err;
}
if (done) {
- err = libusb_interrupt_transfer(usbdev->usb_devh, EP_OUT, send_data, 0, &cnt, USB_TIMEOUT);
- if (err) {
- fprintf(stderr, "Can't send data: %s\n", usb_strerror(err));
+ if (!hmcfgusb_send_null_frame(usbdev)) {
return 0;
}
}
};
int hmcfgusb_send(struct hmcfgusb_dev *usbdev, unsigned char* send_data, int len, int done);
+int hmcfgusb_send_null_frame(struct hmcfgusb_dev *usbdev);
struct hmcfgusb_dev *hmcfgusb_init(hmcfgusb_cb_fn cb, void *data);
int hmcfgusb_add_pfd(struct hmcfgusb_dev *dev, int fd, short events);
int hmcfgusb_poll(struct hmcfgusb_dev *dev, int timeout);