msec = ((tv_end.tv_sec-tv_start.tv_sec)*1000)+((tv_end.tv_usec-tv_start.tv_usec)/1000);
if (msec > 100) {
- if (debug)
- fprintf(stderr, "usb-transfer took more than 100ms (%dms), this can lead to timing problems!\n", msec);
+ fprintf(stderr, "usb-transfer took more than 100ms (%dms), this can lead to timing problems!\n", msec);
} else if (debug) {
fprintf(stderr, "usb-transfer took %dms!\n", msec);
}
memset(out, 0, sizeof(out));
out[0] = 'K';
+ hmcfgusb_send_null_frame(dev);
hmcfgusb_send(dev, out, sizeof(out), 1);
while(!quit) {
(client_addr & 0x0000ff00) >> 8,
(client_addr & 0x000000ff));
}
-
+ sleep(1);
}
return EXIT_SUCCESS;
}
printf("HM-CFG-USB opened!\n");
+ hmcfgusb_send_null_frame(dev);
hmcfgusb_send(dev, (unsigned char*)"K", 1, 1);
while(!quit) {
rdata.wrong_hmid = 0;
hmcfgusb_send(dev, (unsigned char*)"K", 1, 1);
}
- fd = hmcfgusb_poll(dev, 10);
+ fd = hmcfgusb_poll(dev, 1);
if (fd >= 0) {
fprintf(stderr, "activity on unknown fd %d!\n", fd);
continue;
if (errno) {
perror("hmcfgusb_poll");
break;
+ } else {
+ /* periodically wakeup the device */
+ hmcfgusb_send_null_frame(dev);
}
}
}