}
} else if (fd == -1) {
if (errno) {
- perror("hmcfgusb_poll");
- quit = 1;
- } else {
- /* periodically wakeup the device */
- hmcfgusb_send_null_frame(dev, 1);
+ if (errno != ETIMEDOUT) {
+ perror("hmcfgusb_poll");
+ quit = 1;
+ } else {
+ /* periodically wakeup the device */
+ hmcfgusb_send_null_frame(dev, 1);
+ if (wait_for_h) {
+ memset(out, 0, sizeof(out));
+ out[0] = 'K';
+ hmcfgusb_send(dev, out, sizeof(out), 1);
+ }
+ }
}
}
}
sin.sin_addr.s_addr = htonl(INADDR_ANY);
} else {
if (inet_pton(AF_INET, iface, &(sin.sin_addr.s_addr)) != 1) {
- perror("inet_ntop");
+ fprintf(stderr, "Can't convert IP %s, aborting!\n", iface);
return EXIT_FAILURE;
}
}