- hmuartlgw_poll(dev, HMUARTLGW_INIT_TIMEOUT);
- } while (rdata.state != HMUARTLGW_BOOTLOADER);
+ errno = 0;
+ ret = hmuartlgw_poll(dev, HMUARTLGW_INIT_TIMEOUT);
+ if (ret == -1 && errno == ETIMEDOUT) {
+ fprintf(stderr, "Communication with the module timed out, is the serial port configured correctly?\n");
+ exit(1);
+ }
+ } while ((rdata.state != HMUARTLGW_BOOTLOADER) &&
+ (rdata.state != HMUARTLGW_HMIP_BOOTLOADER));