return NULL;
}
-int hmcfgusb_send_null_frame(struct hmcfgusb_dev *usbdev)
+int hmcfgusb_send_null_frame(struct hmcfgusb_dev *usbdev, int silent)
{
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));
+ if (err && (!silent)) {
+ fprintf(stderr, "Can't send null frame: %s\n", usb_strerror(err));
return 0;
}
}
if (done) {
- if (!hmcfgusb_send_null_frame(usbdev)) {
+ if (!hmcfgusb_send_null_frame(usbdev, 0)) {
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);
+int hmcfgusb_send_null_frame(struct hmcfgusb_dev *usbdev, int silent);
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);
memset(out, 0, sizeof(out));
out[0] = 'K';
wait_for_h = 1;
- hmcfgusb_send_null_frame(dev);
+ hmcfgusb_send_null_frame(dev, 1);
hmcfgusb_send(dev, out, sizeof(out), 1);
while(!quit) {
quit = 1;
} else {
/* periodically wakeup the device */
- hmcfgusb_send_null_frame(dev);
+ hmcfgusb_send_null_frame(dev, 1);
}
}
}
}
printf("HM-CFG-USB opened!\n");
- hmcfgusb_send_null_frame(dev);
+ hmcfgusb_send_null_frame(dev, 1);
hmcfgusb_send(dev, (unsigned char*)"K", 1, 1);
while(!quit) {
break;
} else {
/* periodically wakeup the device */
- hmcfgusb_send_null_frame(dev);
+ hmcfgusb_send_null_frame(dev, 1);
}
}
}