summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-05-28 13:49:53 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-05-28 13:57:39 +0200
commitcd86439c6db648c19e6753c8a06b841419703870 (patch)
tree8103c38fc32b0905b03acc9c47b8f546189b6e1b
parent9533aa70025e41fef785cacdc7e51701fb40d8fb (diff)
osmocon: Reset DTR pin at device open timepespin/dtr-rst
-rw-r--r--src/host/osmocon/osmocon.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c
index 76f60374..f62f5a40 100644
--- a/src/host/osmocon/osmocon.c
+++ b/src/host/osmocon/osmocon.c
@@ -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);