osmocon: Reset DTR pin at device open time

Change-Id: I6456cd5f48bde2b0c788b8c33548b2a2ec2ffba1
This commit is contained in:
Pau Espin 2018-05-28 13:49:53 +02:00
parent 9533aa7002
commit cd86439c6d
1 changed files with 10 additions and 0 deletions

View File

@ -1470,6 +1470,16 @@ int main(int argc, char **argv)
exit(1);
}
/* Reset ready to read/write */
fprintf(stderr, "Clearing DTR bit\n");
int v24 = TIOCM_DTR | TIOCM_RTS;
if (ioctl(dnload.serial_fd.fd, TIOCMBIC, &v24) < 0)
fprintf(stderr, "ioctl(TIOCMBIC) %d", errno);
usleep(5*1000*1000);
fprintf(stderr, "Setting DTR bit\n");
if (ioctl(dnload.serial_fd.fd, TIOCMBIS, &v24) < 0)
fprintf(stderr, "ioctl(TIOCMBIS) %d", errno);
if (osmo_fd_register(&dnload.serial_fd) != 0) {
fprintf(stderr, "Failed to register the serial.\n");
exit(1);