]> git.pld-linux.org Git - packages/gpm.git/blame - gpm-serialconsole.patch
- md5
[packages/gpm.git] / gpm-serialconsole.patch
CommitLineData
4eda23bf
PG
1--- ./src/headers/message.h.org Sat Feb 23 16:42:23 2002
2+++ ./src/headers/message.h Tue Mar 12 00:16:35 2002
3@@ -125,6 +125,7 @@
4 #define GPM_MESS_NOTWRITE "Can you write to %s?"
5 #define GPM_MESS_WRITE_ERR "write(): %s"
6 #define GPM_MESS_OPEN_CON "Opening console failed."
7+#define GPM_MESS_OPEN_SERIALCON "We seem to be on a serial console."
8 #define GPM_MESS_READ_FIRST "Error in read()ing first: %s"
9 #define GPM_MESS_READ_REST "Error in read()ing rest: %s"
10 #define GPM_MESS_REMOVE_FILES "Removing files %s and %s"
11--- ./src/gpm.c.org Sat Feb 23 16:42:23 2002
12+++ ./src/gpm.c Tue Mar 12 00:20:19 2002
71bb8784 13@@ -38,6 +38,7 @@
14 #include <sys/un.h> /* struct sockaddr_un */
15
16 #include <linux/vt.h> /* VT_GETSTATE */
17+#include <linux/serial.h> /* for serial console check */
18 #include <sys/kd.h> /* KDGETMODE */
19 #include <termios.h> /* winsize */
20
4eda23bf 21@@ -153,10 +154,23 @@
71bb8784 22 static inline int open_console(const int mode)
23 {
4eda23bf 24 int fd;
71bb8784 25-
b7b5e8d9 26- if ((fd=open(option.consolename, mode)) < 0)
4eda23bf
PG
27- gpm_report(GPM_PR_OOPS,GPM_MESS_OPEN_CON);
28+ struct stat sb;
29+ int maj, twelve=12;
30+ struct serial_struct si;
71bb8784 31+
b7b5e8d9 32+ fd = open(option.consolename, mode);
4eda23bf
PG
33+ if (fd != -1) {
34+ fstat(fd, &sb);
35+ maj = major(sb.st_rdev);
36+ if (maj != 4 && (maj < 136 || maj > 143)) {
37+ if (ioctl (fd, TIOCLINUX, &twelve) < 0) {
38+ if (si.line > 0)
39+ gpm_report(GPM_PR_OOPS,GPM_MESS_OPEN_SERIALCON);
40+ }
41+ }
42 return fd;
43+ } else
44+ gpm_report(GPM_PR_OOPS,GPM_MESS_OPEN_CON);
71bb8784 45 }
46
47 /*-------------------------------------------------------------------*/
This page took 0.077987 seconds and 4 git commands to generate.