summaryrefslogtreecommitdiffstats
path: root/sys-utils/ldattach.c
diff options
context:
space:
mode:
authorTilman Schmidt2015-07-09 15:22:32 +0200
committerKarel Zak2015-07-15 15:46:17 +0200
commit5687494ae00dfc7233b1aeac76a7c84d5108074e (patch)
treee4199355437c92c220dba29b8d711bf1699e84c0 /sys-utils/ldattach.c
parentldattach: adapt print_table column width to widest entry (diff)
downloadkernel-qcow2-util-linux-5687494ae00dfc7233b1aeac76a7c84d5108074e.tar.gz
kernel-qcow2-util-linux-5687494ae00dfc7233b1aeac76a7c84d5108074e.tar.xz
kernel-qcow2-util-linux-5687494ae00dfc7233b1aeac76a7c84d5108074e.zip
ldattach: always set line speed and format for N_GIGASET_M101
The Gigaset M101 exhibits particularly awkward and confusing behaviour when the serial line speed isn't set to what the device expects: Configuration mode detects the used speed and works anyway, but data mode silently fails. Troubleshooting this is enormously time-consuming. Spare the users this trouble by setting the line speed and format to these devices' factory default values as long as the command line doesn't say otherwise. Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Diffstat (limited to 'sys-utils/ldattach.c')
-rw-r--r--sys-utils/ldattach.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys-utils/ldattach.c b/sys-utils/ldattach.c
index 5317d22d8..9c1235d67 100644
--- a/sys-utils/ldattach.c
+++ b/sys-utils/ldattach.c
@@ -365,6 +365,15 @@ int main(int argc, char **argv)
if (ldisc < 0)
ldisc = strtos32_or_err(argv[optind], _("invalid line discipline argument"));
+ /* ldisc specific option settings */
+ if (ldisc == N_GIGASET_M101) {
+ /* device specific defaults for line speed and data format */
+ if (speed == 0) speed = 115200;
+ if (bits == '-') bits = '8';
+ if (parity == '-') parity = 'n';
+ if (stop == '-') stop = '1';
+ }
+
/* open device */
dev = argv[optind + 1];
if ((tty_fd = open(dev, O_RDWR | O_NOCTTY)) < 0)
@@ -447,12 +456,13 @@ int main(int argc, char **argv)
}
}
- /* Attach the line discpline. */
+ /* Attach the line discipline. */
if (ioctl(tty_fd, TIOCSETD, &ldisc) < 0)
err(EXIT_FAILURE, _("cannot set line discipline"));
dbg("line discipline set to %d", ldisc);
+ /* ldisc specific post-attach actions */
if (ldisc == N_GSM0710)
gsm0710_set_conf(tty_fd);