return;
}
+void hmcfgusb_leave_bootloader(struct hmcfgusb_dev *dev)
+{
+ uint8_t out[ASYNC_SIZE];
+
+ if (!dev->bootloader) {
+ fprintf(stderr, "request for leaving bootloader mode, but device already in normal mode!\n");
+ return;
+ }
+
+ memset(out, 0, sizeof(out));
+ out[0] = 'K';
+ hmcfgusb_send(dev, out, sizeof(out), 1);
+
+ return;
+}
+
void hmcfgusb_close(struct hmcfgusb_dev *dev)
{
int err;
int hmcfgusb_add_pfd(struct hmcfgusb_dev *dev, int fd, short events);
int hmcfgusb_poll(struct hmcfgusb_dev *dev, int timeout);
void hmcfgusb_enter_bootloader(struct hmcfgusb_dev *dev);
+void hmcfgusb_leave_bootloader(struct hmcfgusb_dev *dev);
void hmcfgusb_close(struct hmcfgusb_dev *dev);
void hmcfgusb_set_debug(int d);
}
if (dev->bootloader) {
- fprintf(stderr, "HM-CFG-USB in bootloader mode, restarting in normal mode...\n");
- memset(out, 0, sizeof(out));
- out[0] = 'K';
- hmcfgusb_send(dev, out, sizeof(out), 1);
+ if (verbose)
+ fprintf(stderr, "HM-CFG-USB in bootloader mode, restarting in normal mode...\n");
+
+ hmcfgusb_leave_bootloader(dev);
+
hmcfgusb_close(dev);
sleep(1);
return 0;
fprintf(stderr, "\t-i\tinteractive mode (connect HM-CFG-USB to terminal)\n");
fprintf(stderr, "\t-l ip\tlisten on given IP address only (for example 127.0.0.1)\n");
fprintf(stderr, "\t-P\tcreate PID file " PID_FILE " in daemon mode\n");
- fprintf(stderr, "\t-p n\tlisten on port n (default 1000)\n");
+ fprintf(stderr, "\t-p n\tlisten on port n (default: 1000)\n");
fprintf(stderr, "\t-r n\treboot HM-CFG-USB after n seconds (0: no reboot, default: %u)\n", DEFAULT_REBOOT_SECONDS);
fprintf(stderr, "\t-v\tverbose mode\n");