diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-05-28 13:49:53 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-05-28 13:57:39 +0200 |
commit | cd86439c6db648c19e6753c8a06b841419703870 (patch) | |
tree | 8103c38fc32b0905b03acc9c47b8f546189b6e1b /src/host/osmocon/osmocon.c | |
parent | 9533aa70025e41fef785cacdc7e51701fb40d8fb (diff) |
osmocon: Reset DTR pin at device open timepespin/dtr-rst
Change-Id: I6456cd5f48bde2b0c788b8c33548b2a2ec2ffba1
Diffstat (limited to 'src/host/osmocon/osmocon.c')
-rw-r--r-- | src/host/osmocon/osmocon.c | 10 |
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); |