Re: Linux 2.6.7 (stty rows 50 columns 140 reports : No such deviceor address)

From: jsimmons
Date: Wed Jun 16 2004 - 11:44:51 EST



Actually its a bug in stty itself. stty only sets the row or column at a
time. So when you do a stty row col it is actually doing TWO mode sets.
One to change the number of rows then another to change the number of
columns. So to the fbdev driver it looks like this:

640x480 -> 1024x480 -> 1024x768

Now for alot of driver the middle setting doesn't work. So it fails.
This bug also effects serial consoles as well. I CC the stty maintain so
he can apply the below patch. It is against the latest GNU core utilites.
It fixes the issue.

--- stty.c.orig 2004-05-07 17:48:51.000000000 -0700
+++ stty.c 2004-05-07 18:00:36.000000000 -0700
@@ -733,6 +733,10 @@
int speed_was_set;
int verbose_output;
int recoverable_output;
+#ifdef TIOCGWINSZ
+ int size_was_set = 0;
+ int cols, rows;
+#endif
int k;
int noargs = 1;
char *file_name = NULL;
@@ -1004,8 +1008,8 @@
usage (EXIT_FAILURE);
}
++k;
- set_window_size ((int) integer_arg (argv[k]), -1,
- fd, device_name);
+ rows = integer_arg (argv[k]);
+ size_was_set = 1;
}
else if (STREQ (argv[k], "cols")
|| STREQ (argv[k], "columns"))
@@ -1016,8 +1020,8 @@
usage (EXIT_FAILURE);
}
++k;
- set_window_size (-1, (int) integer_arg (argv[k]),
- fd, device_name);
+ cols = integer_arg (argv[k]);
+ size_was_set = 1;
}
else if (STREQ (argv[k], "size"))
{
@@ -1063,6 +1067,12 @@
k++;
}

+#ifdef TIOCGWINSZ
+ if (size_was_set)
+ {
+ set_window_size (rows, cols, fd, device_name);
+ }
+#endif
if (require_set_attr)
{
struct termios new_mode;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/