All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] ldattach updates
@ 2015-07-09 13:22 Tilman Schmidt
  2015-07-09 13:22 ` [PATCH 3/3] ldattach: always set line speed and format for N_GIGASET_M101 Tilman Schmidt
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tilman Schmidt @ 2015-07-09 13:22 UTC (permalink / raw)
  To: util-linux; +Cc: Karel Zak, Tilman Schmidt, Paul Bolle, Sami Kerola

Please merge the following three patches for ldattach.

Thanks,
Tilman

Tilman Schmidt (3):
  ldattach: adapt print_table column width to widest entry
  ldattach: order line disciplines canonically
  ldattach: always set line speed and format for N_GIGASET_M101

 sys-utils/ldattach.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

-- 
1.9.2.459.g68773ac


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] ldattach: adapt print_table column width to widest entry
  2015-07-09 13:22 [PATCH 0/3] ldattach updates Tilman Schmidt
  2015-07-09 13:22 ` [PATCH 3/3] ldattach: always set line speed and format for N_GIGASET_M101 Tilman Schmidt
@ 2015-07-09 13:22 ` Tilman Schmidt
  2015-07-09 13:22 ` [PATCH 2/3] ldattach: order line disciplines canonically Tilman Schmidt
  2015-07-15 13:50 ` [PATCH 0/3] ldattach updates Karel Zak
  3 siblings, 0 replies; 5+ messages in thread
From: Tilman Schmidt @ 2015-07-09 13:22 UTC (permalink / raw)
  To: util-linux; +Cc: Karel Zak, Tilman Schmidt, Paul Bolle, Sami Kerola

The hardcoded column width of 10 in print_table() is not enough, as
the currently longest table entry to be printed has 12 characters.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---
 sys-utils/ldattach.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-utils/ldattach.c b/sys-utils/ldattach.c
index 33c7aa2..5317d22 100644
--- a/sys-utils/ldattach.c
+++ b/sys-utils/ldattach.c
@@ -161,8 +161,8 @@ static void print_table(FILE * out, const struct ld_table *tab)
 	int i;
 
 	for (t = tab, i = 1; t && t->name; t++, i++) {
-		fprintf(out, "  %-10s", t->name);
-		if (!(i % 6))
+		fprintf(out, "  %-12s", t->name);
+		if (!(i % 5))
 			fputc('\n', out);
 	}
 }
-- 
1.9.2.459.g68773ac


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] ldattach: order line disciplines canonically
  2015-07-09 13:22 [PATCH 0/3] ldattach updates Tilman Schmidt
  2015-07-09 13:22 ` [PATCH 3/3] ldattach: always set line speed and format for N_GIGASET_M101 Tilman Schmidt
  2015-07-09 13:22 ` [PATCH 1/3] ldattach: adapt print_table column width to widest entry Tilman Schmidt
@ 2015-07-09 13:22 ` Tilman Schmidt
  2015-07-15 13:50 ` [PATCH 0/3] ldattach updates Karel Zak
  3 siblings, 0 replies; 5+ messages in thread
From: Tilman Schmidt @ 2015-07-09 13:22 UTC (permalink / raw)
  To: util-linux; +Cc: Karel Zak, Tilman Schmidt, Paul Bolle, Sami Kerola

List line disciplines in numerical order and put official names
before convenience aliases.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---
 sys-utils/ldattach.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/sys-utils/ldattach.c b/sys-utils/ldattach.c
index 5317d22..bd4fadd 100644
--- a/sys-utils/ldattach.c
+++ b/sys-utils/ldattach.c
@@ -62,14 +62,15 @@ struct gsm_config
 #ifndef N_GIGASET_M101
 # define N_GIGASET_M101 16
 #endif
-#ifndef N_GSM0710
-# define N_GSM0710 21
-#endif
 
 #ifndef N_PPS
 # define N_PPS 18
 #endif
 
+#ifndef N_GSM0710
+# define N_GSM0710 21
+#endif
+
 #define MAXINTROPARMLEN 32
 
 /* attach a line discipline ioctl */
@@ -86,7 +87,6 @@ struct ld_table {
 
 /* currently supported line disciplines, plus some aliases */
 static const struct ld_table ld_discs[] = {
-	{ "GSM0710",		N_GSM0710},
 	{ "TTY",		N_TTY },
 	{ "SLIP",		N_SLIP },
 	{ "MOUSE",		N_MOUSE },
@@ -101,10 +101,11 @@ static const struct ld_table ld_discs[] = {
 	{ "SYNC_PPP",		N_SYNC_PPP },
 	{ "SYNCPPP",		N_SYNC_PPP },
 	{ "HCI",		N_HCI },
-	{ "PPS",		N_PPS },
+	{ "GIGASET_M101",	N_GIGASET_M101 },
 	{ "M101",		N_GIGASET_M101 },
 	{ "GIGASET",		N_GIGASET_M101 },
-	{ "GIGASET_M101",	N_GIGASET_M101 },
+	{ "PPS",		N_PPS },
+	{ "GSM0710",		N_GSM0710},
 	{ NULL,	0 }
 };
 
-- 
1.9.2.459.g68773ac


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] ldattach: always set line speed and format for N_GIGASET_M101
  2015-07-09 13:22 [PATCH 0/3] ldattach updates Tilman Schmidt
@ 2015-07-09 13:22 ` Tilman Schmidt
  2015-07-09 13:22 ` [PATCH 1/3] ldattach: adapt print_table column width to widest entry Tilman Schmidt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Tilman Schmidt @ 2015-07-09 13:22 UTC (permalink / raw)
  To: util-linux; +Cc: Karel Zak, Tilman Schmidt, Paul Bolle, Sami Kerola

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>
---
 sys-utils/ldattach.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sys-utils/ldattach.c b/sys-utils/ldattach.c
index bd4fadd..99db32e 100644
--- a/sys-utils/ldattach.c
+++ b/sys-utils/ldattach.c
@@ -366,6 +366,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)
@@ -448,12 +457,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);
 
-- 
1.9.2.459.g68773ac


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] ldattach updates
  2015-07-09 13:22 [PATCH 0/3] ldattach updates Tilman Schmidt
                   ` (2 preceding siblings ...)
  2015-07-09 13:22 ` [PATCH 2/3] ldattach: order line disciplines canonically Tilman Schmidt
@ 2015-07-15 13:50 ` Karel Zak
  3 siblings, 0 replies; 5+ messages in thread
From: Karel Zak @ 2015-07-15 13:50 UTC (permalink / raw)
  To: Tilman Schmidt; +Cc: util-linux, Paul Bolle, Sami Kerola

On Thu, Jul 09, 2015 at 03:22:32PM +0200, Tilman Schmidt wrote:
>   ldattach: adapt print_table column width to widest entry
>   ldattach: order line disciplines canonically
>   ldattach: always set line speed and format for N_GIGASET_M101

 Applied, thanks!

    Karel
-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-15 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09 13:22 [PATCH 0/3] ldattach updates Tilman Schmidt
2015-07-09 13:22 ` [PATCH 3/3] ldattach: always set line speed and format for N_GIGASET_M101 Tilman Schmidt
2015-07-09 13:22 ` [PATCH 1/3] ldattach: adapt print_table column width to widest entry Tilman Schmidt
2015-07-09 13:22 ` [PATCH 2/3] ldattach: order line disciplines canonically Tilman Schmidt
2015-07-15 13:50 ` [PATCH 0/3] ldattach updates Karel Zak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.