SHA256
3
0
forked from pool/gpm

Accepting request 47591 from Base:System

Copy from Base:System/gpm based on submit request 47591 from user psmt

OBS-URL: https://build.opensuse.org/request/show/47591
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gpm?expand=0&rev=24
This commit is contained in:
OBS User autobuild 2010-09-09 12:55:44 +00:00 committed by Git OBS Bridge
parent ffe96b45e4
commit 3f2b332964
34 changed files with 884 additions and 918 deletions

View File

@ -1,22 +0,0 @@
--- src/lib/liblow.c
+++ src/lib/liblow.c
@@ -199,7 +199,7 @@
Gpm_Stst *new = NULL;
char* sock_name = 0;
- option.consolename = NULL;
+ if (checked_con == 0) option.consolename = NULL;
gpm_report(GPM_PR_DEBUG,"VC: %d",flag);
@@ -257,6 +257,10 @@
gpm_report(GPM_PR_ERR,"checking tty name failed");
goto err;
}
+ if (option.consolename == NULL) {
+ gpm_report(GPM_PR_ERR,"option.consolename not set");
+ goto err;
+ }
/* do we really need this check ? */
if(strncmp(tty,option.consolename,strlen(option.consolename)-1)
|| !isdigit(tty[strlen(option.consolename)-1])) {

View File

@ -1,13 +0,0 @@
Index: gpm-1.20.1/src/prog/gpm-root.y
===================================================================
--- gpm-1.20.1.orig/src/prog/gpm-root.y 2002-12-24 23:57:16.000000000 +0100
+++ gpm-1.20.1/src/prog/gpm-root.y 2007-12-12 11:15:15.000000000 +0100
@@ -525,7 +525,7 @@ int f_bgcmd(int mode, DrawItem *self, in
open("/dev/null",O_RDONLY); /* stdin */
open(consolename,O_WRONLY); /* stdout */
dup(1); /* stderr */
- for (i=3;i<OPEN_MAX; i++) close(i);
+ for (i=3;i<FOPEN_MAX; i++) close(i);
execl("/bin/sh","sh","-c",self->arg,(char *)NULL);
exit(1); /* shouldn't happen */
default: return 0;

View File

@ -1,28 +0,0 @@
--- src/headers/message.h
+++ src/headers/message.h
@@ -145,6 +145,7 @@
#define GPM_MESS_SETSID_FAILED "Setsid failed"
#define GPM_MESS_CHDIR_FAILED "change directory failed"
#define GPM_MESS_FORK_FAILED "Fork failed."
+#define GPM_MESS_DAEMON_FAILED "Change to run in background failed."
#define GPM_MESS_VCCHECK "Failed on virtual console check."
#define GPM_MESS_PROT_ERR "Error in protocol"
#define GPM_MESS_ROOT "You should be root to run gpm!"
--- src/startup.c
+++ src/startup.c
@@ -136,13 +136,8 @@
if(option.run_status == GPM_RUN_STARTUP ) { /* else is debugging */
/* goto background and become a session leader (Stefan Giessler) */
- switch(fork()) {
- case -1: gpm_report(GPM_PR_OOPS,GPM_MESS_FORK_FAILED); /* error */
- case 0: option.run_status = GPM_RUN_DAEMON; break; /* child */
- default: _exit(0); /* parent */
- }
-
- if (setsid() < 0) gpm_report(GPM_PR_OOPS,GPM_MESS_SETSID_FAILED);
+ if (daemon(0,0)) gpm_report(GPM_PR_OOPS,GPM_MESS_DAEMON_FAILED); /* error */
+ option.run_status = GPM_RUN_DAEMON;
}
/* damon init: check whether we run or not, display message */

View File

@ -1,11 +0,0 @@
--- src/mice.c
+++ src/mice.c
@@ -2275,7 +2275,7 @@
for (i=0; i<4; i++)
if (gunze_calib[i] & ~1023) calibok = 0;
if (gunze_calib[0] == gunze_calib[2]) calibok = 0;
- if (gunze_calib[1] == gunze_calib[4]) calibok = 0;
+ if (gunze_calib[1] == gunze_calib[3]) calibok = 0;
fclose(f);
}
if (!calibok) {

View File

@ -1,14 +0,0 @@
--- src/report.c
+++ src/report.c
@@ -137,8 +137,9 @@
switch(stat) {
case GPM_STAT_INFO:
#ifdef HAVE_VSYSLOG
- syslog(LOG_INFO | LOG_USER, GPM_STRING_INFO);
- vsyslog(LOG_INFO | LOG_USER, text, ap_sys);
+ // gpm spams /var/log/messages (bnc#307209)
+ // syslog(LOG_INFO | LOG_USER, GPM_STRING_INFO);
+ // vsyslog(LOG_INFO | LOG_USER, text, ap_sys);
#endif
break;

View File

@ -1,51 +0,0 @@
--- src/Makefile.in
+++ src/Makefile.in
@@ -14,7 +14,7 @@
# Main portion: regular build rules
GSRC = main.c gpm.c gpn.c mice.c special.c twiddler.c synaptics.c silitek.c \
- startup.c server_tools.c
+ startup.c
GOBJ = $(GSRC:.c=.o) report.o tools.o
--- src/gpn.c
+++ src/gpn.c
@@ -254,15 +254,12 @@
case 'i': opt_time=atoi(optarg); break;
case 'k': check_kill(); break;
case 'l': opt_lut = optarg; break;
- case 'm': add_mouse(GPM_ADD_DEVICE,optarg);
- opt_dev = optarg; break; /* GO AWAY!*/
+ case 'm': opt_dev = optarg; break; /* GO AWAY!*/
case 'M': opt_double++; option.repeater++;
if (option.repeater_type == 0)
option.repeater_type = "msc";
which_mouse=mouse_table+2; break;
- case 'o': add_mouse(GPM_ADD_OPTIONS,optarg);
- gpm_report(GPM_PR_DEBUG,"options: %s",optarg);
- opt_options = optarg; break; /* GO AWAY */
+ case 'o': opt_options = optarg; break; /* GO AWAY */
case 'p': opt_ptrdrag = 0; break;
case 'r':
/* being called responsiveness, I must take the inverse */
@@ -276,8 +273,7 @@
case 's': opt_sample = atoi(optarg); break;
case 'S': if (optarg) opt_special = optarg;
else opt_special=""; break;
- case 't': add_mouse(GPM_ADD_TYPE,optarg);
- opt_type = optarg; break; /* GO AWAY */
+ case 't': opt_type = optarg; break; /* GO AWAY */
case 'u': option.autodetect = 1; break;
case 'T': opt_test++; break;
case 'v': printf(GPM_MESS_VERSION "\n"); exit(0);
--- src/startup.c
+++ src/startup.c
@@ -158,7 +158,6 @@
/****************** OLD CODE from gpn.c END ***********************/
- init_mice(option.micelist); /* reads option.micelist */
atexit(gpm_exited); /* call gpm_exited at the end */
}

View File

@ -1,11 +0,0 @@
--- src/gpm.c
+++ src/gpm.c
@@ -366,7 +366,7 @@
if((i=m_type->packetlen-howmany)) /* still to get */
do {
- j = read(fd,edata-i,i); /* edata is pointer just after data */
+ j = read(fd,edata-i,howmany); /* edata is pointer just after data */
if (kd_mode!=KD_TEXT && fifofd != -1 && opt_rawrep && j > 0)
write(fifofd, edata-i, j);
i -= j;

View File

@ -1,18 +0,0 @@
--- src/lib/report-lib.c
+++ src/lib/report-lib.c
@@ -26,6 +26,7 @@
void gpm_report(int line, char *file, int stat, char *text, ... )
{
+#ifndef QUIET_LIBGPM
char *string = NULL;
va_list ap;
va_start(ap,text);
@@ -43,5 +44,7 @@
va_end(ap);
+#endif /* QUIET_LIBGPM */
+
if(stat == GPM_STAT_OOPS) exit(1); /* may a lib function call exit ???? */
}

View File

@ -1,155 +0,0 @@
--- src/lib/report-lib.c
+++ src/lib/report-lib.c
@@ -41,5 +41,7 @@
vfprintf(stderr,text,ap);
fprintf(stderr,"\n");
+ va_end(ap);
+
if(stat == GPM_STAT_OOPS) exit(1); /* may a lib function call exit ???? */
}
--- src/report.c
+++ src/report.c
@@ -71,9 +71,18 @@
void gpm_report(int line, char *file, int stat, char *text, ... )
{
FILE *console = NULL;
- va_list ap;
+ va_list ap,ap2;
+#ifdef HAVE_VSYSLOG
+ va_list ap_sys;
+#endif
+ int exit_request=0; /* 0 -> return is requested
+ 1 -> exit(1) is requested
+ 2 -> _exit(1) is requested */
va_start(ap,text);
+#ifdef HAVE_VSYSLOG
+ va_copy(ap_sys,ap);
+#endif
switch(option.run_status) {
/******************** STARTUP *****************/
@@ -82,7 +91,7 @@
case GPM_STAT_INFO:
#ifdef HAVE_VSYSLOG
syslog(LOG_INFO | LOG_USER, GPM_STRING_INFO);
- vsyslog(LOG_INFO | LOG_USER, text, ap);
+ vsyslog(LOG_INFO | LOG_USER, text, ap_sys);
#endif
fprintf(stderr,GPM_STRING_INFO);
vfprintf(stderr,text,ap);
@@ -92,7 +101,7 @@
case GPM_STAT_WARN:
#ifdef HAVE_VSYSLOG
syslog(LOG_DAEMON | LOG_WARNING, GPM_STRING_WARN);
- vsyslog(LOG_DAEMON | LOG_WARNING, text, ap);
+ vsyslog(LOG_DAEMON | LOG_WARNING, text, ap_sys);
#endif
fprintf(stderr,GPM_STRING_WARN);
vfprintf(stderr,text,ap);
@@ -102,7 +111,7 @@
case GPM_STAT_ERR:
#ifdef HAVE_VSYSLOG
syslog(LOG_DAEMON | LOG_ERR, GPM_STRING_ERR);
- vsyslog(LOG_DAEMON | LOG_ERR, text, ap);
+ vsyslog(LOG_DAEMON | LOG_ERR, text, ap_sys);
#endif
fprintf(stderr,GPM_STRING_ERR);
vfprintf(stderr,text,ap);
@@ -112,13 +121,13 @@
case GPM_STAT_OOPS:
#ifdef HAVE_VSYSLOG
syslog(LOG_DAEMON | LOG_ERR, GPM_STRING_OOPS);
- vsyslog(LOG_DAEMON | LOG_ERR, text, ap);
+ vsyslog(LOG_DAEMON | LOG_ERR, text, ap_sys);
#endif
fprintf(stderr,GPM_STRING_OOPS);
vfprintf(stderr,text,ap);
fprintf(stderr,"\n");
- exit(1); /* we should have a oops()-function,but this works,too*/
+ exit_request=1; /* we should have a oops()-function,but this works,too*/
break;
}
break; /* startup sequence */
@@ -129,14 +138,14 @@
case GPM_STAT_INFO:
#ifdef HAVE_VSYSLOG
syslog(LOG_INFO | LOG_USER, GPM_STRING_INFO);
- vsyslog(LOG_INFO | LOG_USER, text, ap);
+ vsyslog(LOG_INFO | LOG_USER, text, ap_sys);
#endif
break;
case GPM_STAT_WARN:
#ifdef HAVE_VSYSLOG
syslog(LOG_DAEMON | LOG_WARNING, GPM_STRING_WARN);
- vsyslog(LOG_DAEMON | LOG_WARNING, text, ap);
+ vsyslog(LOG_DAEMON | LOG_WARNING, text, ap_sys);
#endif
if((console = fopen(GPM_SYS_CONSOLE,"a")) != NULL) {
fprintf(console,GPM_STRING_WARN);
@@ -149,8 +158,9 @@
case GPM_STAT_ERR:
#ifdef HAVE_VSYSLOG
syslog(LOG_DAEMON | LOG_ERR, GPM_STRING_ERR);
- vsyslog(LOG_DAEMON | LOG_ERR, text, ap);
+ vsyslog(LOG_DAEMON | LOG_ERR, text, ap_sys);
#endif
+ va_copy(ap2,ap);
if((console = fopen(GPM_SYS_CONSOLE,"a")) != NULL) {
fprintf(console,GPM_STRING_ERR);
vfprintf(console,text,ap);
@@ -160,22 +170,24 @@
if((console = fopen(option.consolename,"a")) != NULL) {
fprintf(console,GPM_STRING_ERR);
- vfprintf(console,text,ap);
+ vfprintf(console,text,ap2);
fprintf(console,"\n");
fclose(console);
}
+
+ va_end(ap2);
break;
case GPM_STAT_OOPS:
#ifdef HAVE_VSYSLOG
syslog(LOG_DAEMON | LOG_ERR, GPM_STRING_OOPS);
- vsyslog(LOG_DAEMON | LOG_ERR, text, ap);
+ vsyslog(LOG_DAEMON | LOG_ERR, text, ap_sys);
#endif
fprintf(stderr,GPM_STRING_OOPS);
vfprintf(stderr,text,ap);
fprintf(stderr,"\n");
- _exit(1); /* we are the fork()-child */
+ exit_request=2; /* we are the fork()-child */
break;
}
break; /* running gpm */
@@ -203,10 +215,21 @@
vfprintf(console,text,ap);
fprintf(console,"\n");
- if(stat == GPM_STAT_OOPS) exit(1);
-
+ if(stat == GPM_STAT_OOPS) exit_request=1;
+
break;
} /* switch for current modus */
+
+ va_end(ap);
+#ifdef HAVE_VSYSLOG
+ va_end(ap_sys);
+#endif
+
+ if (exit_request == 2)
+ _exit(1);
+ if (exit_request == 1)
+ exit(1);
+ return;
} /* gpm_report */

View File

@ -1,102 +0,0 @@
--- doc/doc.gpm.in
+++ doc/doc.gpm.in
@@ -450,16 +450,6 @@
@item -v
Print version information and exit.
-@item -V[@var{verbosity increment}]
- Raise or decrease the maximum level of messages that will be
- logged. Thus a positive argument has the effect of making the
- program more verbose. One can also give a negative argument to
- hush the program; due to @b{getopt(3)} rules, any optional
- argument needs to be passed without a space in between!
- When omitting the argument, the increment defaults to 1.
- Default verbosity level is 5 (@code{LOG_NOTICE}).
- @xref{Program Arguments,,,libc}.
-
@item -2
Force two buttons. This means that the middle button, if any,
will be taken as it was the right one.
@@ -1993,15 +1993,6 @@
mechanism. This is useful for debugging; in previous releases
it was done with a compile-time option.
-@item -V @var{verbosity increment}
- Raise the maximum level of messages that will be logged. Thus a
- positive argument has the effect of making the program more
- verbose. One can also give a negative argument to hush the
- program; however, note that due to @b{getopt(3)} rules a negative
- argument must follow the option with no space betwixt (that is,
- @samp{-V-1} but not @samp{-V -1}). @xref{Program Arguments,,,libc}.
- The argument is optional and its default value is 1.
-
@end table
Each time a menu is drawn, the configuration file is reparsed if it has
--- doc/gpm.info
+++ doc/gpm.info
@@ -333,16 +333,6 @@
`-v'
Print version information and exit.
-`-V[VERBOSITY INCREMENT]'
- Raise or decrease the maximum level of messages that will be
- logged. Thus a positive argument has the effect of making the
- program more verbose. One can also give a negative argument to
- hush the program; due to getopt(3) rules, any optional argument
- needs to be passed without a space in between! When omitting the
- argument, the increment defaults to 1. Default verbosity level is
- 5 (`LOG_NOTICE'). *Note Program Arguments: (libc)Program
- Arguments.
-
`-2'
Force two buttons. This means that the middle button, if any, will
be taken as it was the right one.
@@ -1606,15 +1606,6 @@
mechanism. This is useful for debugging; in previous releases it
was done with a compile-time option.
-`-V VERBOSITY INCREMENT'
- Raise the maximum level of messages that will be logged. Thus a
- positive argument has the effect of making the program more
- verbose. One can also give a negative argument to hush the
- program; however, note that due to getopt(3) rules a negative
- argument must follow the option with no space betwixt (that is,
- `-V-1' but not `-V -1'). *Note Program Arguments: (libc)Program
- Arguments. The argument is optional and its default value is 1.
-
Each time a menu is drawn, the configuration file is reparsed if it
has changed. This allows modification of personal setup without
reinvoking the daemon.
--- src/prog/gpm-root.y
+++ src/prog/gpm-root.y
@@ -868,7 +868,6 @@
" -m <number-or-name> modifier to use\n"
" -u inhibit user configuration files\n"
" -D don't auto-background and run as daemon\n"
- " -V <verbosity-delta> increase amount of logged messages\n"
);
return 1;
--- src/gpn.c
+++ src/gpn.c
@@ -281,6 +281,7 @@
case 'u': option.autodetect = 1; break;
case 'T': opt_test++; break;
case 'v': printf(GPM_MESS_VERSION "\n"); exit(0);
+ case 'V': break; /* gpm_debug_level not supported anymore */
case '2': opt_three = -1; break;
case '3': opt_three = 1; break;
default: exit(usage("commandline"));
--- src/headers/message.h
+++ src/headers/message.h
@@ -98,8 +98,7 @@
" -t mouse-type sets mouse type (default '%s')\n" \
" Use a non-existent type (e.g. \"help\") to get a list\n" \
" -T test: read mouse, no clients\n" \
- " -v print version and exit\n" \
- " -V verbosity increase number of logged messages\n\n\n" \
+ " -v print version and exit\n\n\n" \
" Examples:\n\n" \
" gpm -m /dev/misc/psaux -t ps2 to start with a ps2 mouse\n" \
" gpm -m /dev/tts/0 -t mman to use mouse man on COM1\n\n"

View File

@ -1,11 +0,0 @@
--- src/twiddler.c
+++ src/twiddler.c
@@ -331,7 +331,7 @@
int len = strlen(mod);
if (len == 0) return twiddler_map->table;
- for (ptr = twiddler_map; ptr->table; ptr = ptr++) {
+ for (ptr = twiddler_map; ptr->table; ptr++) {
if (!strncasecmp(mod,ptr->keyword,len))
return ptr->table;
}

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:11fabe7f27a205ff1ea6aee23e1dc2bb2dc5dbfc45ff0320fca0cd559806a936
size 565014

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad1c1a23324e626a532c76e5870aa36357f0df798960c53fc208fdfbdf8a5151
size 312560

3
gpm-1.20.6.tar.lzma Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0795792f1e4f300f8f2d4474db04baba1ef99dc0017fec0057fcb6ee59eb8745
size 998443

View File

@ -1,24 +1,28 @@
--- Makefile.in
+++ Makefile.in
@@ -50,9 +50,13 @@
Index: Makefile.in
===================================================================
--- Makefile.in.orig 2009-02-09 10:58:53.000000000 +0100
+++ Makefile.in 2010-09-07 19:08:40.912655993 +0200
@@ -87,9 +87,13 @@ install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) $(STRIP)' install
installdirs:
- $(MKDIR) $(libdir) $(bindir) $(sbindir) $(includedir) $(sysconfdir); \
+ $(INSTALL_DIR) $(DESTDIR)$(libdir)
+ $(INSTALL_DIR) $(DESTDIR)$(libdir)
+ $(INSTALL_DIR) $(DESTDIR)$(bindir)
+ $(INSTALL_DIR) $(DESTDIR)$(sbindir)
+ $(INSTALL_DIR) $(DESTDIR)$(includedir)
+ $(INSTALL_DIR) $(DESTDIR)$(sysconfdir); \
if test "x@ELISP@" != "x" ; then \
if test "x$(ELISP)" != "x" ; then \
- $(MKDIR) $(lispdir) ; \
+ $(INSTALL_DIR) $(DESTDIR)$(lispdir) ; \
+ $(MKDIR) $(DESTDIR)$(lispdir) ; \
fi
### GENERIC
--- Makefile.include.in
+++ Makefile.include.in
@@ -37,6 +37,7 @@
Index: Makefile.include.in
===================================================================
--- Makefile.include.in.orig 2009-02-09 10:58:53.000000000 +0100
+++ Makefile.include.in 2010-09-07 19:03:04.962483820 +0200
@@ -43,6 +43,7 @@ YACC = @YACC@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
@ -26,9 +30,11 @@
LN_S = @LN_S@
EMACS = @EMACS@
ELISP = @ELISP@
--- doc/Makefile.in
+++ doc/Makefile.in
@@ -112,29 +112,18 @@
Index: doc/Makefile.in
===================================================================
--- doc/Makefile.in.orig 2009-02-09 10:58:53.000000000 +0100
+++ doc/Makefile.in 2010-09-07 19:09:37.506283144 +0200
@@ -111,29 +111,18 @@ gpmdoc.ps: gpm.ps
# install & uninstall
installdirs:
@ -36,7 +42,7 @@
+ $(INSTALL_DIR) $(DESTDIR)$(man1dir)
+ $(INSTALL_DIR) $(DESTDIR)$(man7dir)
+ $(INSTALL_DIR) $(DESTDIR)$(man8dir)
+ $(INSTALL_DIR) $(DESTDIR)$(infodir)
+ $(INSTALL_DIR) $(DESTDIR)$(infodir)
install: all installdirs
- $(INSTALL_DATA) -m 644 mev.1 $(man1dir)
@ -68,9 +74,11 @@
# This potentially leaves around cached manpages,
# e.g. /var/cache/man/cat1/mev.1.gz. Deleting these is not our job,
--- src/Makefile.in
+++ src/Makefile.in
@@ -91,15 +91,16 @@
Index: src/Makefile.in
===================================================================
--- src/Makefile.in.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/Makefile.in 2010-09-07 19:07:57.361560078 +0200
@@ -104,15 +104,16 @@ check: all
installdirs:
install: check
@ -84,15 +92,15 @@
# 2.x goes along; unfortunately that means an additional
# headache in cases like this
if test "x@SHLIB@" != "x" ; then \
- $(INSTALL_DATA) -m 644 lib/libgpm.so.@abi_full@ $(libdir)/libgpm.so.@abi_full@ ;\
- cd $(libdir) && $(LN_S) -f libgpm.so.@abi_full@ libgpm.so ;\
+ $(INSTALL_DATA) -m 755 lib/libgpm.so.@abi_full@ $(DESTDIR)$(libdir)/libgpm.so.@abi_full@ ;\
+ cd $(DESTDIR)$(libdir) && $(LN_S) -f libgpm.so.@abi_full@ libgpm.so ;\
+ cd $(DESTDIR)$(libdir) && $(LN_S) -f libgpm.so.@abi_full@ libgpm.so.@abi_lev@;\
echo "WARNING: We installed a lib, you should now call ldconfig" ; \
echo "f.i.: ldconfig -n -l $(libdir)/libgpm.so.@abi_full@" ;\
echo "Or to update everything just type ldconfig"; \
@@ -107,7 +108,7 @@
- $(INSTALL_DATA) -m 644 lib/libgpm.so.@abi_full@ $(libdir)/libgpm.so.@abi_full@ ; \
- cd $(libdir) && $(LN_S) -f libgpm.so.@abi_full@ libgpm.so.@abi_lev@ ; \
+ $(INSTALL_DATA) -m 755 lib/libgpm.so.@abi_full@ $(DESTDIR)$(libdir)/libgpm.so.@abi_full@ ; \
+ cd $(DESTDIR)$(libdir) && $(LN_S) -f libgpm.so.@abi_full@ libgpm.so ; \
+ cd $(DESTDIR)$(libdir) && $(LN_S) -f libgpm.so.@abi_full@ libgpm.so.@abi_lev@; \
echo "WARNING: We installed a lib, you should now call ldconfig" ; \
echo "f.i.: ldconfig -n -l $(libdir)/libgpm.so.@abi_full@" ; \
echo "Or to update everything just type ldconfig" ; \
@@ -122,7 +123,7 @@ install: check
# prog/
for i in $(PROG); do \
@ -101,14 +109,3 @@
done
install-strip:
--- src/special.c
+++ src/special.c
@@ -155,7 +155,7 @@
open(GPM_NULL_DEV,O_RDONLY); /* stdin */
open(option.consolename,O_WRONLY); /* stdout */
dup(1); /* stderr */
- for (i=3;i<OPEN_MAX; i++) close(i);
+ for (i=3;i<getdtablesize(); i++) close(i);
execl("/bin/sh","sh","-c",command,(char *)NULL);
exit(1); /* shouldn't happen */

15
gpm-Gpm_Open.patch Normal file
View File

@ -0,0 +1,15 @@
Index: src/lib/liblow.c
===================================================================
--- src/lib/liblow.c.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/lib/liblow.c 2010-09-08 16:42:15.667355974 +0200
@@ -255,6 +255,10 @@ int Gpm_Open(Gpm_Connect *conn, int flag
if (tty == NULL) {
gpm_report(GPM_PR_ERR,"checking tty name failed");
goto err;
+ }
+ if (consolename == NULL) {
+ gpm_report(GPM_PR_ERR,"consolename not set");
+ goto err;
}
conn->vc=atoi(&tty[strlen(consolename)-1]);

View File

@ -2,9 +2,11 @@ Note that GCC 4.0 will optimize ceil (constant), we therefore
have to make the argument non-constant.
================================================================================
--- configure.in
+++ configure.in
@@ -91,6 +91,25 @@
Index: configure.ac
===================================================================
--- configure.ac.orig 2009-02-09 10:58:53.000000000 +0100
+++ configure.ac 2010-09-08 16:10:06.434722846 +0200
@@ -108,6 +108,25 @@ fi
AC_CHECK_FUNCS(vsyslog syslog)
AC_FUNC_ALLOCA
@ -16,7 +18,7 @@ have to make the argument non-constant.
+ AC_MSG_RESULT(yes),
+ SYNLDFLAGS=-lm
+ AC_MSG_RESULT(no))
+
+
+if test "$SYNLDFLAGS" = "-lm" ; then
+ SAVE_LIBS="$LIBS"
+ AC_CHECK_LIB(m,
@ -30,7 +32,7 @@ have to make the argument non-constant.
case $with_curses in
No|no|N|n) SHARED_LIBS=-lc ;;
*)
@@ -123,6 +142,7 @@
@@ -138,6 +157,7 @@ AC_SUBST(ELISP)
AC_SUBST(SHLIB)
AC_SUBST(PICFLAGS)
AC_SUBST(SOLDFLAGS)
@ -38,22 +40,26 @@ have to make the argument non-constant.
AC_SUBST(CURSES_OBJS)
AC_SUBST(SHARED_LIBS)
AC_SUBST(lispdir)
--- src/Makefile.in
+++ src/Makefile.in
@@ -70,6 +70,7 @@
all: gpm lib/@SHLIB@ lib/libgpm.a $(PROG)
Index: src/Makefile.in
===================================================================
--- src/Makefile.in.orig 2010-09-08 16:06:46.812997967 +0200
+++ src/Makefile.in 2010-09-08 16:09:40.464506680 +0200
@@ -82,7 +82,7 @@ prog/%: prog/%.o
all: gpm lib/libgpm.so.@abi_lev@ lib/libgpm.a $(PROG)
gpm: $(GOBJ)
+ $(CC) @LDFLAGS@ @SYNLDFLAGS@ $(GOBJ) -o gpm
- $(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $(GOBJ) @LIBS@ $(LIBS) -lm
+ $(CC) @LDFLAGS@ @SYNLDFLAGS@ -o $@ $(GOBJ) @LIBS@ $(LIBS) -lm
# construct dependings of sourcefiles and link sourcefiles
$(DEPFILE) dep: prog/gpm-root.c
@@ -155,7 +156,7 @@
@@ -164,7 +164,8 @@ lib/libgpm.a: $(LOBJ)
lib/libgpm.so.@abi_full@: $(PICS)
$(CC) @SOLDFLAGS@libgpm.so.@abi_lev@ \
- @LDFLAGS@ $(LDFLAGS) -o lib/libgpm.so.@abi_full@ $^ @LIBS@ @SHARED_LIBS@ $(LIBS)
+ @LDFLAGS@ $(LDFLAGS) -o lib/libgpm.so.@abi_full@ $^ @LIBS@ @SHARED_LIBS@ @SYNLDFLAGS@ $(LIBS)
lib/libgpm.so: lib/libgpm.so.@abi_full@
$(LN_S) -f libgpm.so.@abi_full@ lib/libgpm.so
+ @LDFLAGS@ $(LDFLAGS) -o lib/libgpm.so.@abi_full@ $^ @LIBS@ @SHARED_LIBS@ @SYNLDFLAGS@ $(LIBS)
+
lib/libgpm.so.@abi_lev@: lib/libgpm.so.@abi_full@
$(LN_S) -f libgpm.so.@abi_full@ lib/libgpm.so.@abi_lev@
# unneeded, isn't it?

View File

@ -1,6 +1,8 @@
--- README
+++ README
@@ -102,7 +102,7 @@
Index: README
===================================================================
--- README.orig 2009-02-09 10:58:53.000000000 +0100
+++ README 2010-09-08 13:26:14.060039119 +0200
@@ -128,7 +128,7 @@ Configuration is optional...
(string-match "con.*" (getenv "TERM"))))
(load-library "t-mouse"))
@ -9,9 +11,11 @@
directory, test it out and then edit it to suit your feels.
* You'd like to name the gpm info file inside /usr/info/dir. Just insert
--- doc/README.silitek
+++ doc/README.silitek
@@ -14,11 +14,11 @@
Index: doc/README.silitek
===================================================================
--- doc/README.silitek.orig 2010-09-08 13:26:13.916055341 +0200
+++ doc/README.silitek 2010-09-08 13:26:14.084036415 +0200
@@ -14,11 +14,11 @@ This IR commander can be used with two t
Both types of mouse driver uses the system wide configuration file
@ -25,7 +29,7 @@
is used. To switch back to the normal return values, the drag mouse
button has to be pressed again. It is allowed to use escaped
sequences as return values. Characters other than printable can
@@ -169,7 +169,7 @@
@@ -169,7 +169,7 @@ EOF
--------------------------------------------------------------------
the Multimedia keys on IR Keyboard SK-7100 are usable (for ncurses
@ -34,9 +38,11 @@
to get the similar named keys to work similar, both the IR Keyboard
SK-7100 and the IR commander SM-1000 are usable in parallel.
--- doc/README.synaptics
+++ doc/README.synaptics
@@ -25,8 +25,8 @@
Index: doc/README.synaptics
===================================================================
--- doc/README.synaptics.orig 2009-02-09 10:58:53.000000000 +0100
+++ doc/README.synaptics 2010-09-08 13:26:14.108033711 +0200
@@ -25,8 +25,8 @@ the buttons, this support currently has
These features can be enabled/disabled and many of them have time and speed
parameters which can be adjusted to the taste of the user. These parameters
@ -47,9 +53,11 @@
configure). Each line in this file has the following syntax: [param-name]
<value>
--- doc/README.twiddler
+++ doc/README.twiddler
@@ -101,23 +101,23 @@
Index: doc/README.twiddler
===================================================================
--- doc/README.twiddler.orig 2009-02-09 10:58:53.000000000 +0100
+++ doc/README.twiddler 2010-09-08 13:26:14.128031459 +0200
@@ -101,23 +101,23 @@ precompile values because that would mea
file, and provide documentation as well. Using a compulsory
configuration file reliefs my workload :-)
@ -79,9 +87,11 @@
Gpm will print an error message for any incorrect line in any of the
configuration files: error messages include the file name and the
--- doc/doc.gpm.in
+++ doc/doc.gpm.in
@@ -1981,7 +1981,7 @@
Index: doc/doc.gpm.in
===================================================================
--- doc/doc.gpm.in.orig 2008-06-16 22:44:05.000000000 +0200
+++ doc/doc.gpm.in 2010-09-08 13:26:14.128031459 +0200
@@ -1971,7 +1971,7 @@ Available command line options are the f
@item -u
Deny using user-specific configuration files. With this
@ -90,7 +100,7 @@
of configuration information. This option
is intended for those system administrators who fear security could
be broken by this daemon. Things should be sufficiently secure, but
@@ -2009,7 +2009,7 @@
@@ -1999,7 +1999,7 @@ changed. This allows modification of per
the daemon.
%M The actual configuration file is better introduced by looking at your
@ -99,7 +109,7 @@
%M
%MSKIP
@@ -2196,7 +2196,7 @@
@@ -2186,7 +2186,7 @@ Alessandro Rubini <rubini@linux.it>
.SH FILES
.nf
/dev/gpmctl The socket used to connect to gpm.
@ -108,9 +118,11 @@
$(HOME)/.gpm-root The user configuration file.
/dev/vcs* Virtual Console Screens
.fi
--- doc/gpm.info
+++ doc/gpm.info
@@ -1604,7 +1604,7 @@
Index: doc/gpm.info
===================================================================
--- doc/gpm.info.orig 2009-02-09 10:59:44.000000000 +0100
+++ doc/gpm.info 2010-09-08 13:26:14.168026952 +0200
@@ -1594,7 +1594,7 @@ distribution directory. The tool won't r
`-u'
Deny using user-specific configuration files. With this option on,
@ -119,9 +131,11 @@
configuration information. This option is intended for those
system administrators who fear security could be broken by this
daemon. Things should be sufficiently secure, but if you find a
--- src/headers/silitek.h
+++ src/headers/silitek.h
@@ -27,7 +27,7 @@
Index: src/headers/silitek.h
===================================================================
--- src/headers/silitek.h.orig 2010-09-08 13:26:14.000045878 +0200
+++ src/headers/silitek.h 2010-09-08 13:26:14.224020642 +0200
@@ -27,7 +27,7 @@ extern void silitek_keys(unsigned char *
extern void silitek_keys_ps2(unsigned char *data, int *drag);
extern int silitek_ghost_ps2(unsigned char *data);
extern int fd_silitek;
@ -130,8 +144,10 @@
#define SILISTRLEN 32
#define SILISTRSCN "key %32s %32s %32s"
extern void silitek_mapping(void);
--- src/headers/twiddler.h
+++ src/headers/twiddler.h
Index: src/headers/twiddler.h
===================================================================
--- src/headers/twiddler.h.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/headers/twiddler.h 2010-09-08 13:26:14.284013884 +0200
@@ -46,7 +46,7 @@
#define TW_M_MASK 0x1FF /* mask of movement bits, after shifting */
#define TW_M_BIT 0x100
@ -142,9 +158,11 @@
+#define TW_CUSTOM_FILE SYSCONFDIR "/twiddler.user"
--- src/prog/gpm-root.y
+++ src/prog/gpm-root.y
@@ -78,7 +78,7 @@
Index: src/prog/gpm-root.y
===================================================================
--- src/prog/gpm-root.y.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/prog/gpm-root.y 2010-09-08 13:26:14.304011630 +0200
@@ -77,7 +77,7 @@
#endif
#define USER_CFG ".gpm-root"
@ -153,9 +171,11 @@
#define DEFAULT_FORE 7
#define DEFAULT_BACK 0
--- src/synaptics.c
+++ src/synaptics.c
@@ -2047,7 +2047,7 @@
Index: src/synaptics.c
===================================================================
--- src/synaptics.c.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/synaptics.c 2010-09-08 13:26:14.308011179 +0200
@@ -2064,7 +2064,7 @@ static void tp_process_report (Gpm_Event
** syn_read_config_file
**
** Read the configuration data from the global config file
@ -164,7 +184,7 @@
*/
void tp_read_config_file (char* config_filename)
{
@@ -2171,7 +2171,7 @@
@@ -2188,7 +2188,7 @@ static void syn_process_config (info_typ
gpm_report (GPM_PR_INFO, " Firmware version %d.%d\n",
ident.info_major, ident.info_minor);

25
gpm-daemon_mode.patch Normal file
View File

@ -0,0 +1,25 @@
Index: src/headers/message.h
===================================================================
--- src/headers/message.h.orig 2010-09-08 16:43:48.924334502 +0200
+++ src/headers/message.h 2010-09-08 16:43:49.456294395 +0200
@@ -146,6 +146,7 @@
#define GPM_MESS_SETSID_FAILED "Setsid failed"
#define GPM_MESS_CHDIR_FAILED "change directory failed"
#define GPM_MESS_FORK_FAILED "Fork failed."
+#define GPM_MESS_DAEMON_FAILED "Change to run in background failed."
#define GPM_MESS_VCCHECK "Failed on virtual console check."
#define GPM_MESS_PROT_ERR "Error in protocol"
#define GPM_MESS_ROOT "You should be root to run gpm!"
Index: src/daemon/startup.c
===================================================================
--- src/daemon/startup.c.orig 2010-09-08 16:43:49.328304044 +0200
+++ src/daemon/startup.c 2010-09-08 16:46:36.665526251 +0200
@@ -126,7 +126,7 @@ void startup(int argc, char **argv)
if (option.run_status == GPM_RUN_STARTUP ) { /* else is debugging */
if (daemon(0,0))
- gpm_report(GPM_PR_OOPS,GPM_MESS_FORK_FAILED); /* error */
+ gpm_report(GPM_PR_OOPS,GPM_MESS_DAEMON_FAILED); /* error */
option.run_status = GPM_RUN_DAEMON; /* child */
}

View File

@ -1,7 +1,7 @@
Index: gpm-1.20.1/src/gpm.c
===================================================================
--- gpm-1.20.1.orig/src/gpm.c
+++ gpm-1.20.1/src/gpm.c
--- src/daemon/gpm.c
+++ src/daemon/gpm.c
@@ -22,6 +22,7 @@
********/

13
gpm-int_ptr_casts.patch Normal file
View File

@ -0,0 +1,13 @@
Index: src/twiddler.c
===================================================================
--- src/twiddler.c.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/twiddler.c 2010-09-08 18:13:31.706407202 +0200
@@ -429,7 +429,7 @@ char *twiddler_rest_to_value(char *s)
return strdup(buf);
}
if (*ptr == '\\')
- return (char *)twiddler_escape_sequence(ptr+1, &len /* unused */);
+ return (char *)(long)twiddler_escape_sequence(ptr+1, &len /* unused */);
if (strlen(ptr)==1) return ((char *)((unsigned long)*ptr & 0xFF));

16
gpm-log.patch Normal file
View File

@ -0,0 +1,16 @@
Index: src/report.c
===================================================================
--- src/report.c.orig 2010-09-08 17:04:41.743044084 +0200
+++ src/report.c 2010-09-08 17:08:22.257855674 +0200
@@ -92,8 +92,9 @@ void gpm_report(int line, char *file, in
switch(stat) {
case GPM_STAT_INFO:
#ifdef HAVE_VSYSLOG
- syslog(LOG_INFO | LOG_USER, GPM_STRING_INFO);
- vsyslog(LOG_INFO | LOG_USER, text, ap2);
+ // gpm spams /var/log/messages (bnc#307209)
+ // syslog(LOG_INFO | LOG_USER, GPM_STRING_INFO);
+ // vsyslog(LOG_INFO | LOG_USER, text, ap2);
#else
fprintf(stderr,GPM_STRING_INFO);
vfprintf(stderr,text,ap);

View File

@ -0,0 +1,62 @@
Index: src/daemon/cmdline.c
===================================================================
--- src/daemon/cmdline.c.orig 2010-09-08 18:38:23.672261112 +0200
+++ src/daemon/cmdline.c 2010-09-08 19:43:17.467206480 +0200
@@ -46,38 +46,35 @@ void cmdline(int argc, char **argv)
if (optarg)
opt_age_limit = atoi(optarg); break;
case 'b': (which_mouse->opt_baud) = atoi(optarg); break;
- case 'B': (which_mouse->opt_sequence) = optarg; break;
+ case 'B': (which_mouse->opt_sequence) = optarg; break;
case 'd': (which_mouse->opt_delta) = atoi(optarg); break;
case 'D': option.run_status = GPM_RUN_DEBUG; break;
case 'g': (which_mouse->opt_glidepoint_tap)=atoi(optarg); break;
case 'h': exit(usage(NULL));
- case 'i': (which_mouse->opt_time)=atoi(optarg); break;
+ case 'i': (which_mouse->opt_time)=atoi(optarg); break;
case 'k': check_kill(); break;
case 'l': opt_lut = optarg; break;
- case 'm': add_mouse(GPM_ADD_DEVICE,optarg);
- (which_mouse->opt_dev) = optarg; break; /* GO AWAY!*/
+ case 'm': (which_mouse->opt_dev) = optarg; break; /* GO AWAY!*/
case 'M': opt_double++; option.repeater++;
if (option.repeater_type == 0)
option.repeater_type = "msc";
which_mouse=mouse_table+2; break;
- case 'o': add_mouse(GPM_ADD_OPTIONS,optarg);
- gpm_report(GPM_PR_DEBUG,"options: %s",optarg);
- (which_mouse->opt_options) = optarg; break; /* GO AWAY */
+ case 'o': gpm_report(GPM_PR_DEBUG,"options: %s",optarg);
+ (which_mouse->opt_options) = optarg; break; /* GO AWAY */
case 'p': opt_ptrdrag = 0; break;
case 'r':
/* being called responsiveness, I must take the inverse */
(which_mouse->opt_scale)=atoi(optarg);
if(!(which_mouse->opt_scale) || (which_mouse->opt_scale) > 100) (which_mouse->opt_scale)=100; /* the maximum */
- else (which_mouse->opt_scale)=100/(which_mouse->opt_scale); break;
+ else (which_mouse->opt_scale)=100/(which_mouse->opt_scale); break;
case 'R':
option.repeater++;
if (optarg) option.repeater_type = optarg;
else option.repeater_type = "msc"; break;
- case 's': (which_mouse->opt_sample) = atoi(optarg); break;
+ case 's': (which_mouse->opt_sample) = atoi(optarg); break;
case 'S': if (optarg) opt_special = optarg;
else opt_special=""; break;
- case 't': add_mouse(GPM_ADD_TYPE,optarg);
- (which_mouse->opt_type) = optarg; break; /* GO AWAY */
+ case 't': (which_mouse->opt_type) = optarg; break; /* GO AWAY */
case 'u': option.autodetect = 1; break;
case 'T': opt_test++; break;
case 'v': printf(GPM_MESS_VERSION "\n"); exit(0);
Index: src/daemon/startup.c
===================================================================
--- src/daemon/startup.c.orig 2010-09-08 18:38:23.672261112 +0200
+++ src/daemon/startup.c 2010-09-08 19:42:23.770512127 +0200
@@ -139,6 +139,5 @@ void startup(int argc, char **argv)
/****************** OLD CODE from gpn.c END ***********************/
- init_mice(option.micelist); /* reads option.micelist */
atexit(gpm_exited); /* call gpm_exited at the end */
}

View File

@ -1,6 +1,8 @@
--- src/headers/gpmInt.h
+++ src/headers/gpmInt.h
@@ -91,21 +91,27 @@
Index: src/headers/gpmInt.h
===================================================================
--- src/headers/gpmInt.h.orig 2010-09-08 13:25:25.777479285 +0200
+++ src/headers/gpmInt.h 2010-09-08 13:25:31.112878123 +0200
@@ -50,21 +50,27 @@
/*** mouse commands ***/

13
gpm-ps2_read.patch Normal file
View File

@ -0,0 +1,13 @@
Index: src/daemon/getmousedata.c
===================================================================
--- src/daemon/getmousedata.c.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/daemon/getmousedata.c 2010-09-07 19:18:52.107824882 +0200
@@ -70,7 +70,7 @@ char *getMouseData(int fd, Gpm_Type *typ
if((i=(which_mouse->m_type)->packetlen-howmany)) /* still to get */
do {
- j = read(fd,edata-i,i); /* edata is pointer just after data */
+ j = read(fd,edata-i,howmany); /* edata is pointer just after data */
if (kd_mode!=KD_TEXT && fifofd != -1 && opt_rawrep && j > 0)
write(fifofd, edata-i, j);
i -= j;

View File

@ -1,270 +1,8 @@
--- src/gpm.c
+++ src/gpm.c
@@ -71,7 +71,8 @@
DEF_TIME, DEF_CLUSTER, DEF_THREE, DEF_GLIDEPOINT_TAP,
(char *)NULL /* extra */,
(Gpm_Type *)NULL,
- -1
+ -1,
+ 0, 0 /* save byte, is_save_byte */
}
};
struct mouse_features *which_mouse;
@@ -329,25 +330,57 @@
* fetch the actual device data from the mouse device, dependent on
* what Gpm_Type is being passed.
*-------------------------------------------------------------------*/
-static inline char *getMouseData(int fd, Gpm_Type *type, int kd_mode)
+static inline char *getMouseData(int fd, Gpm_Type *type, int kd_mode,
+ unsigned char *save_byte , int *is_save_byte,
+ int *restart)
{
static unsigned char data[32]; /* quite a big margin :) */
char *edata=data+type->packetlen;
int howmany=type->howmany;
+ int preread;
int i,j;
/*....................................... read and identify one byte */
- if (read(fd, data, howmany)!=howmany) {
- if (opt_test) exit(0);
- gpm_report(GPM_PR_ERR,GPM_MESS_READ_FIRST, strerror(errno));
- return NULL;
+ preread = 0;
+ if (*is_save_byte) {
+ /* one byte is saved, howmany must be 1 otherwise this
+ byte hasn't been saved */
+ data[0] = *save_byte;
+ *is_save_byte = 0;
+ preread = 1;
+ } else {
+ if ((preread = read(fd, data, howmany))!=howmany) {
+ if (opt_test) exit(0);
+ gpm_report(GPM_PR_ERR,GPM_MESS_READ_FIRST, strerror(errno));
+ return NULL;
+ }
+ }
+
+ /* try to find sequence AA 00 which is generated by kernel-2.4.9 or higher
+ when PS/2 mouse was replugged */
+ if ((m_type->isPS2 == 1) && (data[0] == 0xaa)) {
+ if (preread == 1) {
+ // read second byte
+ if (read(fd, &(data[1]),1) == 1)
+ preread += 1;
+ }
+ if ((preread >= 2) && (data[1] == 0x0)) {
+ gpm_report(GPM_PR_DEBUG,GPM_MESS_REPLUGGED);
+ *restart = 1;
+ return NULL;
+ }
}
if (kd_mode!=KD_TEXT && fifofd != -1 && opt_rawrep)
write(fifofd, data, howmany);
if ((data[0]&(m_type->proto)[0]) != (m_type->proto)[1]) {
+ if (preread > howmany) {
+ /* second byte was involuntary preread in test for PS/2 replugging */
+ *save_byte = data[1];
+ *is_save_byte = 1;
+ }
if (m_type->getextra == 1) {
data[1]=GPM_EXTRA_MAGIC_1; data[2]=GPM_EXTRA_MAGIC_2;
gpm_report(GPM_PR_DEBUG,GPM_EXTRA_DATA,data[0]);
@@ -357,6 +390,12 @@
return NULL;
}
+ if ((preread > howmany) &&
+ (kd_mode!=KD_TEXT && fifofd != -1 && opt_rawrep))
+ /* one byte was read in test for replugging sequence and will be
+ used as normal data byte */
+ write(fifofd, &(data[1]), 1);
+
/*....................................... read the rest */
/*
@@ -364,13 +403,20 @@
* tried ps2 with the original selection package, which called usleep()
*/
- if((i=m_type->packetlen-howmany)) /* still to get */
+ if((i=m_type->packetlen-preread) > 0) { /* still to get */
do {
j = read(fd,edata-i,howmany); /* edata is pointer just after data */
if (kd_mode!=KD_TEXT && fifofd != -1 && opt_rawrep && j > 0)
write(fifofd, edata-i, j);
i -= j;
} while (i && j);
+ } else {
+ if (preread > m_type->packetlen) {
+ /* second byte was involuntary preread in test for PS/2 replugging */
+ *save_byte = data[1];
+ *is_save_byte = 1;
+ }
+ }
if (i) {
gpm_report(GPM_PR_ERR,GPM_MESS_READ_REST, strerror(errno));
@@ -396,7 +442,7 @@
* the data via repeat_fun() to the repeater device
*-------------------------------------------------------------------*/
static inline int processMouse(int fd, Gpm_Event *event, Gpm_Type *type,
- int kd_mode)
+ int kd_mode, unsigned char *save_byte, int *is_save_byte)
{
char *data;
static int fine_dx, fine_dy;
@@ -408,6 +454,7 @@
fd_set fdSet;
static int newB=0, oldB=0, oldT=0; /* old buttons and Type to chain events */
/* static int buttonlock, buttonlockflag; */
+ int restart;
#define GET_TIME(tv) (gettimeofday(&tv, (struct timezone *)NULL))
#define DIF_TIME(t1,t2) ((t2.tv_sec -t1.tv_sec) *1000+ \
@@ -433,8 +480,11 @@
FD_ZERO(&fdSet); FD_SET(fd,&fdSet); i=0;
do { /* cluster loop */
- if(((data=getMouseData(fd,m_type,kd_mode))==NULL)
+ restart = 0;
+ if(((data=getMouseData(fd,m_type,kd_mode,
+ save_byte,is_save_byte,&restart))==NULL)
|| ((*(m_type->fun))(&nEvent,data)==-1) ) {
+ if (restart) return -1;
if (!i) return 0;
else break;
}
@@ -916,6 +966,32 @@
exit(0);
}
+static inline void initMouse(int i, int *fd, int *maxfd)
+{
+ which_mouse=mouse_table+i; /* used to access options */
+
+ if (!opt_dev) gpm_report(GPM_PR_OOPS,GPM_MESS_NEED_MDEV);
+
+ if(!strcmp(opt_dev,"-")) *fd=0; /* use stdin */
+ else if( (*fd=open(opt_dev,O_RDWR | O_NDELAY)) < 0)
+ gpm_report(GPM_PR_OOPS,GPM_MESS_OPEN,opt_dev);
+
+ /* and then reset the flag */
+ fcntl(*fd,F_SETFL,fcntl(*fd,F_GETFL) & ~O_NDELAY);
+
+ /* create argc and argv for this device */
+ mouse_argv[i] = build_argv(opt_type, opt_options, &mouse_argc[i], ',');
+
+ /* init the device, and use the return value as new mouse type */
+ if (m_type->init)
+ m_type=(m_type->init)(*fd, m_type->flags, m_type, mouse_argc[i],
+ mouse_argv[i]);
+ if (!m_type) gpm_report(GPM_PR_OOPS,GPM_MESS_MOUSE_INIT);
+
+ which_mouse->fd=*fd;
+ *maxfd=max(*fd, *maxfd);
+}
+
/*-------------------------------------------------------------------*/
int old_main()
{
@@ -928,28 +1004,7 @@
Gpm_Event event;
for (i = 1; i <= 1+opt_double; i++) {
- which_mouse=mouse_table+i; /* used to access options */
-
- if (!opt_dev) gpm_report(GPM_PR_OOPS,GPM_MESS_NEED_MDEV);
-
- if(!strcmp(opt_dev,"-")) fd=0; /* use stdin */
- else if( (fd=open(opt_dev,O_RDWR | O_NDELAY)) < 0)
- gpm_report(GPM_PR_OOPS,GPM_MESS_OPEN,opt_dev);
-
- /* and then reset the flag */
- fcntl(fd,F_SETFL,fcntl(fd,F_GETFL) & ~O_NDELAY);
-
- /* create argc and argv for this device */
- mouse_argv[i] = build_argv(opt_type, opt_options, &mouse_argc[i], ',');
-
- /* init the device, and use the return value as new mouse type */
- if (m_type->init)
- m_type=(m_type->init)(fd, m_type->flags, m_type, mouse_argc[i],
- mouse_argv[i]);
- if (!m_type) gpm_report(GPM_PR_OOPS,GPM_MESS_MOUSE_INIT);
-
- which_mouse->fd=fd;
- maxfd=max(fd, maxfd);
+ initMouse(i, &fd, &maxfd);
}
/*....................................... catch interesting signals */
@@ -1063,10 +1118,14 @@
*/
for (i=1; i <= 1+opt_double; i++) {
+ int rc;
which_mouse=mouse_table+i; /* used to access options */
if (FD_ISSET(which_mouse->fd,&selSet)) {
FD_CLR(which_mouse->fd,&selSet); pending--;
- if (processMouse(which_mouse->fd, &event, m_type, kd_mode))
+ rc = processMouse(which_mouse->fd, &event, m_type, kd_mode,
+ &(which_mouse->save_byte),
+ &(which_mouse->is_save_byte));
+ if (rc > 0) {
/* pass it to the client, if any
* or to the default handler, if any
* or to the selection handler
@@ -1075,7 +1134,15 @@
(cinfo[event.vc] && do_client(cinfo[event.vc], &event))
|| (cinfo[0] && do_client(cinfo[0], &event))
|| do_selection(&event);
+ } else if (rc == -1) {
+ /* try to reinitialise the mouse */
+ FD_CLR(which_mouse->fd, &selSet);
+ close(which_mouse->fd);
+ initMouse(i, &fd, &maxfd);
+ FD_CLR(which_mouse->fd, &selSet);
+ which_mouse->is_save_byte=0;
}
+ }
}
/*..................... got connection, process it */
--- src/headers/gpmInt.h
+++ src/headers/gpmInt.h
@@ -142,6 +142,7 @@
int (*repeat_fun)(Gpm_Event *state, int fd); /* repeat this event into fd */
/* itz Mon Jan 11 23:27:54 PST 1999 */
+ int isPS2; /* is 1 for PS/2 mouses, 0 otherwise */
} Gpm_Type;
#define GPM_EXTRA_MAGIC_1 0xAA
@@ -165,6 +166,8 @@
char *opt_options; /* extra textual configuration */
Gpm_Type *m_type;
int fd;
+ unsigned char save_byte;
+ int is_save_byte;
};
extern struct mouse_features mouse_table[3], *which_mouse; /*the current one*/
--- src/headers/message.h
+++ src/headers/message.h
@@ -65,6 +65,7 @@
#define GPM_MESS_VERSION "gpm " GPM_RELEASE " (X-Mas), " GPM_RELEASE_DATE
#define GPM_MESS_STARTED "Started gpm successfully. Entered daemon mode."
#define GPM_MESS_KILLED "Killed gpm(%d)."
+#define GPM_MESS_REPLUGGED "Mouse was replugged"
#define GPM_MESS_SKIP_DATA "Skipping a data packet (?)"
#define GPM_MESS_DATA_4 "Data %02x %02x %02x (%02x)"
#define GPM_MESS_NO_MAGIC "No magic"
--- src/mice.c
+++ src/mice.c
@@ -2217,113 +2217,113 @@
Index: src/mice.c
===================================================================
--- src/mice.c.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/mice.c 2010-09-08 18:38:24.516205731 +0200
@@ -2372,116 +2372,116 @@ Gpm_Type mice[]={
{"mman", "The \"MouseMan\" and similar devices (3/4 bytes per packet).",
"Mouseman", M_mman, I_serial, CS7 | STD_FLG, /* first */
@ -277,7 +15,7 @@
{"acecad", "Acecad tablet absolute mode(Sumagrapics MM-Series mode)",
"", M_summa, I_summa, STD_FLG,
- {0x80, 0x80, 0x00, 0x00}, 7, 1, 0, 1, 0},
+ {0x80, 0x80, 0x00, 0x00}, 7, 1, 0, 1, 0, 0},
+ {0x80, 0x80, 0x00, 0x00}, 7, 1, 0, 1, 0, 0},
{"bare", "Unadorned ms protocol. Needed with some 2-buttons mice.",
"Microsoft", M_bare, I_serial, CS7 | STD_FLG,
- {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0},
@ -298,6 +36,10 @@
"", M_calus_rel, I_calus, CS8 | CSTOPB | STD_FLG,
- {0x80, 0x80, 0x80, 0x00}, 6, 6, 0, 0, 0},
+ {0x80, 0x80, 0x80, 0x00}, 6, 6, 0, 0, 0, 0},
{"etouch", "EloTouch touch-screens (only button-1 events, by now)",
"", M_etouch, I_etouch, STD_FLG,
- {0xFF, 0x55, 0xFF, 0x54}, 7, 1, 0, 1, NULL},
+ {0xFF, 0x55, 0xFF, 0x54}, 7, 1, 0, 1, NULL, 0},
#ifdef HAVE_LINUX_INPUT_H
{"evdev", "Linux Event Device",
"", M_evdev, I_empty, STD_FLG,
@ -307,12 +49,12 @@
{"exps2", "IntelliMouse Explorer (ps2) - 3 buttons, wheel unused",
"ExplorerPS/2", M_imps2, I_exps2, STD_FLG,
- {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0},
+ {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0, 1},
+ {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0, 0},
#ifdef HAVE_LINUX_JOYSTICK_H
{"js", "Joystick mouse emulation",
"Joystick", M_js, NULL, 0,
- {0xFC, 0x00, 0x00, 0x00}, 12, 12, 0, 0, 0},
+ {0xFC, 0x00, 0x00, 0x00}, 12, 12, 0, 0, 0 ,0},
+ {0xFC, 0x00, 0x00, 0x00}, 12, 12, 0, 0, 0, 0},
#endif
{"genitizer", "\"Genitizer\" tablet, in relative mode.",
"", M_geni, I_serial, CS8|PARENB|PARODD,
@ -321,11 +63,11 @@
{"gunze", "Gunze touch-screens (only button-1 events, by now)",
"", M_gunze, I_gunze, STD_FLG,
- {0xF9, 0x50, 0xF0, 0x30}, 11, 1, 0, 1, NULL},
+ {0xF9, 0x50, 0xF0, 0x30}, 11, 1, 0, 1, NULL, 0},
+ {0xF9, 0x50, 0xF0, 0x30}, 11, 1, 0, 1, NULL, 0},
{"imps2","Microsoft Intellimouse (ps2)-autodetect 2/3 buttons,wheel unused",
"", M_imps2, I_imps2, STD_FLG,
- {0xC0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, R_imps2},
+ {0xC0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, R_imps2 , 1},
+ {0xC0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, R_imps2, 1},
{"logi", "Used in some Logitech devices (only serial).",
"Logitech", M_logi, I_logi, CS8 | CSTOPB | STD_FLG,
- {0xe0, 0x80, 0x80, 0x00}, 3, 3, 0, 0, 0},
@ -357,7 +99,7 @@
{"mtouch", "MicroTouch touch-screens (only button-1 events, by now)",
"", M_mtouch, I_mtouch, STD_FLG,
- {0x80, 0x80, 0x80, 0x00}, 5, 1, 0, 1, NULL},
+ {0x80, 0x80, 0x80, 0x00}, 5, 1, 0, 1, NULL, 0},
+ {0x80, 0x80, 0x80, 0x00}, 5, 1, 0, 1, NULL, 0},
{"ncr", "Ncr3125pen, found on some laptops",
"", M_ncr, NULL, STD_FLG,
- {0x08, 0x08, 0x00, 0x00}, 7, 7, 0, 1, 0},
@ -365,7 +107,7 @@
{"netmouse","Genius NetMouse (ps2) - 2 buttons and 2 buttons 'up'/'down'.",
"", M_netmouse, I_netmouse, CS7 | STD_FLG,
- {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0},
+ {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0 ,1},
+ {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0, 1},
{"pnp", "Plug and pray. New mice may not run with '-t ms'.",
"", M_bare, I_pnp, CS7 | STD_FLG,
- {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0},
@ -376,8 +118,8 @@
+ {0xc0, 0x00, 0x00, 0x00}, 3, 1, 0, 0, R_ps2, 1},
{"sun", "'msc' protocol, but only 3 bytes per packet.",
"", M_sun, I_serial, CS8 | CSTOPB | STD_FLG,
- {0xf8, 0x80, 0x00, 0x00}, 3, 1, 0, 0, 0},
+ {0xf8, 0x80, 0x00, 0x00}, 3, 1, 0, 0, 0, 0},
- {0xf8, 0x80, 0x00, 0x00}, 3, 1, 0, 0, R_sun},
+ {0xf8, 0x80, 0x00, 0x00}, 3, 1, 0, 0, R_sun, 0},
{"summa", "Summagraphics or Genius tablet absolute mode(MM-Series)",
"", M_summa, I_summa, STD_FLG,
- {0x80, 0x80, 0x00, 0x00}, 5, 1, 0, 1, R_summa},
@ -385,7 +127,7 @@
{"syn", "The \"Synaptics\" serial TouchPad.",
"synaptics", M_synaptics_serial, I_serial, CS7 | STD_FLG,
- {0x40, 0x40, 0x40, 0x00}, 6, 6, 1, 0, 0},
+ {0x40, 0x40, 0x40, 0x00}, 6, 6, 1, 0, 0 ,0},
+ {0x40, 0x40, 0x40, 0x00}, 6, 6, 1, 0, 0, 0},
{"synps2", "The \"Synaptics\" PS/2 TouchPad",
"synaptics_ps2", M_synaptics_ps2, I_synps2, STD_FLG,
- {0x80, 0x80, 0x00, 0x00}, 6, 1, 1, 0, 0},
@ -393,7 +135,7 @@
{"twid", "Twidddler keyboard",
"", M_twid, I_twid, CS8 | STD_FLG,
- {0x80, 0x00, 0x80, 0x80}, 5, 1, 0, 0, 0},
+ {0x80, 0x00, 0x80, 0x80}, 5, 1, 0, 0, 0 ,0},
+ {0x80, 0x00, 0x80, 0x80}, 5, 1, 0, 0, 0, 0},
{"vsxxxaa", "The DEC VSXXX-AA/GA serial mouse on DEC workstations.",
"", M_vsxxx_aa, I_serial, CS8 | PARENB | PARODD | STD_FLG,
- {0xe0, 0x80, 0x80, 0x00}, 3, 1, 0, 0, 0},
@ -405,7 +147,7 @@
{"wp", "Genius WizardPad tablet",
"wizardpad", M_wp, I_wp, STD_FLG,
- {0xFA, 0x42, 0x00, 0x00}, 10, 1, 0, 1, 0},
+ {0xFA, 0x42, 0x00, 0x00}, 10, 1, 0, 1, 0 ,0},
+ {0xFA, 0x42, 0x00, 0x00}, 10, 1, 0, 1, 0, 0},
{"", "",
"", NULL, NULL, 0,
- {0x00, 0x00, 0x00, 0x00}, 0, 0, 0, 0, 0}
@ -413,3 +155,305 @@
};
/*------------------------------------------------------------------------*/
Index: src/daemon/getmousedata.c
===================================================================
--- src/daemon/getmousedata.c.orig 2010-09-08 18:11:41.925698527 +0200
+++ src/daemon/getmousedata.c 2010-09-08 18:39:50.210572313 +0200
@@ -33,25 +33,58 @@
* fetch the actual device data from the mouse device, dependent on
* what Gpm_Type is being passed.
*-------------------------------------------------------------------*/
-char *getMouseData(int fd, Gpm_Type *type, int kd_mode)
+char *getMouseData(int fd, Gpm_Type *type, int kd_mode,
+ unsigned char *save_byte , int *is_save_byte, int *restart)
{
static unsigned char data[32]; /* quite a big margin :) */
char *edata=data+type->packetlen;
int howmany=type->howmany;
+ int preread;
int i,j;
/*....................................... read and identify one byte */
if (read(fd, data, howmany)!=howmany) {
- if (opt_test) exit(0);
- gpm_report(GPM_PR_ERR,GPM_MESS_READ_FIRST, strerror(errno));
- return NULL;
+ preread = 0;
+ if (*is_save_byte) {
+ /* one byte is saved, howmany must be 1 otherwise this
+ byte hasn't been saved */
+ data[0] = *save_byte;
+ *is_save_byte = 0;
+ preread = 1;
+ } else {
+ if ((preread = read(fd, data, howmany))!=howmany) {
+ if (opt_test) exit(0);
+ gpm_report(GPM_PR_ERR,GPM_MESS_READ_FIRST, strerror(errno));
+ return NULL;
+ }
+ }
+ }
+
+ /* try to find sequence AA 00 which is generated by kernel-2.4.9 or higher
+ when PS/2 mouse was replugged */
+ if (((which_mouse->m_type)->isPS2 == 1) && (data[0] == 0xaa)) {
+ if (preread == 1) {
+ // read second byte
+ if (read(fd, &(data[1]),1) == 1)
+ preread += 1;
+ }
+ if ((preread >= 2) && (data[1] == 0x0)) {
+ gpm_report(GPM_PR_DEBUG,GPM_MESS_REPLUGGED);
+ *restart = 1;
+ return NULL;
+ }
}
if (kd_mode!=KD_TEXT && fifofd != -1 && opt_rawrep)
write(fifofd, data, howmany);
if ((data[0]&((which_mouse->m_type)->proto)[0]) != ((which_mouse->m_type)->proto)[1]) {
+ if (preread > howmany) {
+ /* second byte was involuntary preread in test for PS/2 replugging */
+ *save_byte = data[1];
+ *is_save_byte = 1;
+ }
if ((which_mouse->m_type)->getextra == 1) {
data[1]=GPM_EXTRA_MAGIC_1; data[2]=GPM_EXTRA_MAGIC_2;
gpm_report(GPM_PR_DEBUG,GPM_EXTRA_DATA,data[0]);
@@ -68,13 +101,20 @@ char *getMouseData(int fd, Gpm_Type *typ
* tried ps2 with the original selection package, which called usleep()
*/
- if((i=(which_mouse->m_type)->packetlen-howmany)) /* still to get */
+ if((i=(which_mouse->m_type)->packetlen-preread) > 0) { /* still to get */
do {
j = read(fd,edata-i,howmany); /* edata is pointer just after data */
if (kd_mode!=KD_TEXT && fifofd != -1 && opt_rawrep && j > 0)
write(fifofd, edata-i, j);
i -= j;
} while (i && j);
+ } else {
+ if (preread > (which_mouse->m_type)->packetlen) {
+ /* second byte was involuntary preread in test for PS/2 replugging */
+ *save_byte = data[1];
+ *is_save_byte = 1;
+ }
+ }
if (i) {
gpm_report(GPM_PR_ERR,GPM_MESS_READ_REST, strerror(errno));
Index: src/daemon/gpm.c
===================================================================
--- src/daemon/gpm.c.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/daemon/gpm.c 2010-09-08 18:38:23.256288409 +0200
@@ -73,7 +73,8 @@ struct mouse_features mouse_table[3] = {
DEF_TIME, DEF_CLUSTER, DEF_THREE, DEF_GLIDEPOINT_TAP,
(char *)NULL /* extra */,
(Gpm_Type *)NULL,
- -1
+ -1,
+ 0, 0 /* save byte, is_save_byte */
}
};
struct mouse_features *which_mouse;
Index: src/daemon/old_main.c
===================================================================
--- src/daemon/old_main.c.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/daemon/old_main.c 2010-09-08 19:34:22.279958939 +0200
@@ -37,6 +37,38 @@
#define max(a,b) ((a)>(b) ? (a) : (b))
#endif
+static inline void initMouse(int i, int *fd, int *maxfd)
+{
+ which_mouse=mouse_table+i; /* used to access options */
+
+ if (!(which_mouse->opt_dev))
+ gpm_report(GPM_PR_OOPS,GPM_MESS_NEED_MDEV);
+
+ if(!strcmp((which_mouse->opt_dev),"-"))
+ *fd=0; /* use stdin */
+ else if( (*fd=open((which_mouse->opt_dev),O_RDWR | O_NDELAY)) < 0)
+ gpm_report(GPM_PR_OOPS,GPM_MESS_OPEN,(which_mouse->opt_dev));
+
+ /* and then reset the flag */
+ fcntl(*fd,F_SETFL,fcntl(*fd,F_GETFL) & ~O_NDELAY);
+
+ /* create argc and argv for this device */
+ mouse_argv[i] = build_argv((which_mouse->opt_type),
+ (which_mouse->opt_options),
+ &mouse_argc[i], ',');
+
+ /* init the device, and use the return value as new mouse type */
+ if ((which_mouse->m_type)->init)
+ (which_mouse->m_type)=((which_mouse->m_type)->init)(*fd, (which_mouse->m_type)->flags,
+ (which_mouse->m_type),
+ mouse_argc[i], mouse_argv[i]);
+
+ if (!(which_mouse->m_type)) gpm_report(GPM_PR_OOPS,GPM_MESS_MOUSE_INIT);
+
+ which_mouse->fd=*fd;
+ *maxfd=max(*fd, *maxfd);
+}
+
int old_main()
{
@@ -48,30 +80,8 @@ int old_main()
int pending;
Gpm_Event event;
- for (i = 1; i <= 1+opt_double; i++) {
- which_mouse=mouse_table+i; /* used to access options */
-
- if (!(which_mouse->opt_dev)) gpm_report(GPM_PR_OOPS,GPM_MESS_NEED_MDEV);
-
- if(!strcmp((which_mouse->opt_dev),"-")) fd=0; /* use stdin */
- else if( (fd=open((which_mouse->opt_dev),O_RDWR | O_NDELAY)) < 0)
- gpm_report(GPM_PR_OOPS,GPM_MESS_OPEN,(which_mouse->opt_dev));
-
- /* and then reset the flag */
- fcntl(fd,F_SETFL,fcntl(fd,F_GETFL) & ~O_NDELAY);
-
- /* create argc and argv for this device */
- mouse_argv[i] = build_argv((which_mouse->opt_type), (which_mouse->opt_options), &mouse_argc[i], ',');
-
- /* init the device, and use the return value as new mouse type */
- if ((which_mouse->m_type)->init)
- (which_mouse->m_type)=((which_mouse->m_type)->init)(fd, (which_mouse->m_type)->flags, (which_mouse->m_type), mouse_argc[i],
- mouse_argv[i]);
- if (!(which_mouse->m_type)) gpm_report(GPM_PR_OOPS,GPM_MESS_MOUSE_INIT);
-
- which_mouse->fd=fd;
- maxfd=max(fd, maxfd);
- }
+ for (i = 1; i <= 1+opt_double; i++)
+ initMouse(i, &fd, &maxfd);
/*....................................... catch interesting signals */
@@ -184,10 +194,14 @@ int old_main()
*/
for (i=1; i <= 1+opt_double; i++) {
+ int rc;
which_mouse=mouse_table+i; /* used to access options */
if (FD_ISSET(which_mouse->fd,&selSet)) {
FD_CLR(which_mouse->fd,&selSet); pending--;
- if (processMouse(which_mouse->fd, &event, (which_mouse->m_type), kd_mode))
+ rc = processMouse(which_mouse->fd, &event, (which_mouse->m_type),
+ kd_mode, &(which_mouse->save_byte),
+ &(which_mouse->is_save_byte));
+ if (rc > 0) {
/* pass it to the client, if any
* or to the default handler, if any
* or to the selection handler
@@ -196,7 +210,15 @@ int old_main()
(cinfo[event.vc] && do_client(cinfo[event.vc], &event))
|| (cinfo[0] && do_client(cinfo[0], &event))
|| do_selection(&event);
+ } else if (rc == -1) {
+ /* try to reinitialise the mouse */
+ FD_CLR(which_mouse->fd, &selSet);
+ close(which_mouse->fd);
+ initMouse(i, &fd, &maxfd);
+ FD_CLR(which_mouse->fd, &selSet);
+ which_mouse->is_save_byte=0;
}
+ }
}
/*..................... got connection, process it */
Index: src/daemon/processmouse.c
===================================================================
--- src/daemon/processmouse.c.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/daemon/processmouse.c 2010-09-08 18:11:42.105686598 +0200
@@ -40,7 +40,8 @@
(t2.tv_usec-t1.tv_usec)/1000)
-int processMouse(int fd, Gpm_Event *event, Gpm_Type *type, int kd_mode)
+int processMouse(int fd, Gpm_Event *event, Gpm_Type *type, int kd_mode,
+ unsigned char *save_byte, int *is_save_byte)
{
char *data;
static int fine_dx,
@@ -55,6 +56,7 @@ int processMouse(int fd, Gpm_Event *even
static struct timeval tv1={0,0}, tv2; /* tv1==0: first click is single */
static struct timeval timeout={0,0};
fd_set fdSet;
+ int restart;
oldT = event->type;
@@ -78,9 +80,12 @@ int processMouse(int fd, Gpm_Event *even
FD_SET(fd,&fdSet);
do { /* cluster loop */
- if(((data=getMouseData(fd, (which_mouse->m_type), kd_mode)) == NULL)
+ restart = 0;
+ if(((data=getMouseData(fd, (which_mouse->m_type), kd_mode,
+ save_byte,is_save_byte,&restart)) == NULL)
|| ((*((which_mouse->m_type)->fun))(&nEvent,data)==-1) ) {
-
+
+ if (restart) return -1;
if (!i) {
return 0;
} else {
Index: src/headers/daemon.h
===================================================================
--- src/headers/daemon.h.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/headers/daemon.h 2010-09-08 19:26:01.901761337 +0200
@@ -76,6 +76,7 @@ typedef struct Gpm_Type {
/* repeat this event into fd */
int (*repeat_fun)(Gpm_Event *state, int fd);
+ int isPS2; /* 1 for PS/2 mouses, 0 otherwise */
} Gpm_Type;
/* this structure is used to hide the dual-mouse stuff */
@@ -96,6 +97,8 @@ struct mouse_features {
char *opt_options; /* extra textual configuration */
Gpm_Type *m_type;
int fd;
+ unsigned char save_byte;
+ int is_save_byte;
};
/*************************************************************************
@@ -197,7 +200,9 @@ int do_selection(Gpm_Event *event);
void get_console_size(Gpm_Event *ePtr);
int get_data(Gpm_Connect *where, int whence);
-char *getMouseData(int fd, Gpm_Type *type, int kd_mode);
+char *getMouseData(int fd, Gpm_Type *type, int kd_mode,
+ unsigned char *save_byte , int *is_save_byte,
+ int *restart);
int getsym(const unsigned char *p0, unsigned char *res);
void gpm_exited(void);
@@ -207,7 +212,8 @@ int open_console(const int mode);
int old_main();
int processConn(int fd);
-int processMouse(int fd, Gpm_Event *event, Gpm_Type *type, int kd_mode);
+int processMouse(int fd, Gpm_Event *event, Gpm_Type *type, int kd_mode,
+ unsigned char *save_byte, int *is_save_byte);
int processRequest(Gpm_Cinfo *ci, int vc);
int processSpecial(Gpm_Event *event);
Index: src/headers/message.h
===================================================================
--- src/headers/message.h.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/headers/message.h 2010-09-08 18:38:24.516205731 +0200
@@ -65,6 +65,7 @@
#define GPM_MESS_VERSION "gpm " PACKAGE_VERSION
#define GPM_MESS_STARTED "Started gpm successfully. Entered daemon mode."
#define GPM_MESS_KILLED "Killed gpm(%d)."
+#define GPM_MESS_REPLUGGED "Mouse was replugged"
#define GPM_MESS_SKIP_DATA "Skipping a data packet (?)"
#define GPM_MESS_DATA_4 "Data %02x %02x %02x (%02x)"
#define GPM_MESS_NO_MAGIC "No magic"

20
gpm-quiet_libgpm.patch Normal file
View File

@ -0,0 +1,20 @@
Index: src/lib/report-lib.c
===================================================================
--- src/lib/report-lib.c.orig 2010-09-08 13:35:23.166173284 +0200
+++ src/lib/report-lib.c 2010-09-08 13:36:23.207409061 +0200
@@ -26,6 +26,7 @@
void gpm_report(int line, char *file, int stat, char *text, ... )
{
+#ifndef QUIET_LIBGPM
char *string = NULL;
int log_level;
va_list ap;
@@ -57,5 +58,7 @@ void gpm_report(int line, char *file, in
va_end(ap);
+#endif /* QUIET_LIBGPM */
+
if(stat == GPM_STAT_OOPS) exit(1); /* may a lib function call exit ???? */
}

View File

@ -1,5 +1,7 @@
--- conf/gpm-silitek.conf
+++ conf/gpm-silitek.conf
Index: conf/gpm-silitek.conf
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ conf/gpm-silitek.conf 2010-09-08 18:11:42.205679972 +0200
@@ -0,0 +1,45 @@
+# Standard key mapping for Silitek SM-1000
+# on Linux virtual console (TERM=linux)
@ -46,8 +48,10 @@
+key ShowWiz \033[[B \033[[B
+key WWW \033[[C \033[[C
+key Close \033[[D \033[[D
--- doc/README.silitek
+++ doc/README.silitek
Index: doc/README.silitek
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ doc/README.silitek 2010-09-08 18:14:39.237907111 +0200
@@ -0,0 +1,188 @@
+This README describes the support for the Silitek SM-1000 IR commander
+(also called Netshooter).
@ -237,50 +241,56 @@
+ tic linux.tic
+
+installs the edited terminfo entry for TERM=linux.
--- src/Makefile.in
+++ src/Makefile.in
@@ -13,7 +13,7 @@
Index: src/Makefile.in
===================================================================
--- src/Makefile.in.orig 2010-09-08 18:11:41.885701179 +0200
+++ src/Makefile.in 2010-09-08 18:14:37.778004511 +0200
@@ -13,7 +13,7 @@ include $(top_builddir)/Makefile.include
# Main portion: regular build rules
-GSRC = main.c gpm.c gpn.c mice.c special.c twiddler.c synaptics.c \
+GSRC = main.c gpm.c gpn.c mice.c special.c twiddler.c synaptics.c silitek.c \
startup.c server_tools.c
GOBJ = $(GSRC:.c=.o) report.o tools.o
@@ -24,7 +24,7 @@
-GSRC = mice.c twiddler.c synaptics.c \
+GSRC = mice.c twiddler.c synaptics.c silitek.c \
daemon/add_mouse.c daemon/init_mice.c daemon/reset_mice.c \
daemon/build_argv.c daemon/disable_paste.c daemon/do_client.c \
daemon/do_selection.c daemon/get_console_size.c daemon/get_data.c \
@@ -35,7 +35,7 @@ LOBJ = $(LSRC:.c=.o) tools.o @CURSES_OBJ
PICS = $(LOBJ:.o=.lo)
-HDRS = gpm.h gpmInt.h twiddler.h synaptics.h message.h
+HDRS = gpm.h gpmInt.h twiddler.h synaptics.h silitek.h message.h
PSRC = prog/mev.c prog/hltest.c prog/mouse-test.c prog/disable-paste.c
@@ -144,7 +144,7 @@
PSRC = prog/mev.c prog/hltest.c prog/mouse-test.c prog/disable-paste.c \
prog/display-buttons.c prog/display-coords.c prog/get-versions.c
@@ -152,7 +152,7 @@ prog/gpm-root: prog/gpm-root.c lib/libgp
$(CC) -I. @CPPFLAGS@ $(CPPFLAGS) @CFLAGS@ $(CFLAGS) -c -o $@.o $<
$(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $@.o @LIBS@ $(LIBS) lib/libgpm.a
$(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $@.o @LIBS@ $(LIBS) lib/libgpm.so.@abi_lev@
-prog/mouse-test: mice.o twiddler.o synaptics.o
+prog/mouse-test: mice.o twiddler.o synaptics.o silitek.o
-prog/mouse-test: prog/mouse-test.o mice.o twiddler.o synaptics.o prog/open_console.o
+prog/mouse-test: prog/mouse-test.o mice.o twiddler.o synaptics.o silitek.o prog/open_console.o
$(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $^ @LIBS@ $(LIBS) -lm
$(PROG): lib/libgpm.so lib/@SHLIB@ lib/libgpm.a
--- src/headers/message.h
+++ src/headers/message.h
@@ -194,6 +194,10 @@
#define GPM_MESS_INCORRECT_LINE "%s: %s :%i: Incorrect line:\"%s\""
$(PROG): lib/libgpm.so.@abi_lev@
Index: src/headers/message.h
===================================================================
--- src/headers/message.h.orig 2010-09-08 18:11:42.173682092 +0200
+++ src/headers/message.h 2010-09-08 18:14:37.518021855 +0200
@@ -196,6 +196,10 @@
#define GPM_MESS_FIRST_DEV "Use -m device -t protocol [-o options]!"
#define GPM_MESS_ELO_CALIBRATE "%s: etouch: calibration file %s absent or invalid, using defaults"
+#define GPM_MESS_SILIPS2_ENABLE "silips2: enable error"
+#define GPM_MESS_SILIPS2_DISABLE "silips2: disable error"
+#define GPM_MESS_SILIPS2_RESET "silips2: reset error"
+
/* warnings */
#define GPM_MESS_REQUEST_ON "Request on vc %i > %i"
--- src/headers/silitek.h
+++ src/headers/silitek.h
#define GPM_MESS_FAILED_CONNECT "Failed gpm connect attempt by uid %d for vc %s"
Index: src/headers/silitek.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ src/headers/silitek.h 2010-09-08 18:14:39.409895637 +0200
@@ -0,0 +1,33 @@
+/*
+ * silitek.h - support for the Silitek SM-1000 (Netshooter) with its IR
@ -315,17 +325,19 @@
+#define SILISTRLEN 32
+#define SILISTRSCN "key %32s %32s %32s"
+extern void silitek_mapping(void);
--- src/mice.c
+++ src/mice.c
@@ -74,6 +74,7 @@
#include "headers/gpmInt.h"
Index: src/mice.c
===================================================================
--- src/mice.c.orig 2010-09-08 18:11:41.941697467 +0200
+++ src/mice.c 2010-09-08 18:11:42.401666981 +0200
@@ -75,6 +75,7 @@
#include "headers/daemon.h"
#include "headers/twiddler.h"
#include "headers/synaptics.h"
+#include "headers/silitek.h"
#include "headers/message.h"
/*========================================================================*/
@@ -667,6 +668,86 @@
@@ -685,6 +686,86 @@ static int M_imps2(Gpm_Event *state, un
}
@ -349,7 +361,7 @@
+ {
+ silitek_keys_ps2(data, &drag);
+ return -1; /* Do not highlight, but success */
+ }
+ }
+
+ state->buttons = ((data[0]&0x01)<<2)|(data[0]&0x02)|((data[0]&0x04)>>2);
+
@ -412,7 +424,7 @@
static int M_netmouse(Gpm_Event *state, unsigned char *data)
{
/* Avoid these beasts if you can. They connect to normal PS/2 port,
@@ -745,7 +826,6 @@
@@ -763,7 +844,6 @@ static Gpm_Type *I_netmouse(int fd, unsi
return type;
}
@ -420,7 +432,7 @@
static int M_mman(Gpm_Event *state, unsigned char *data)
{
/*
@@ -1828,7 +1908,7 @@
@@ -1928,7 +2008,7 @@ static int read_mouse_id(int fd)
*
* Returns 0 if OK, or >0 if 1 or more errors occurred.
*/
@ -429,7 +441,7 @@
{
int i;
int error = 0;
@@ -1845,6 +1925,89 @@
@@ -1945,6 +2025,89 @@ static int write_to_mouse(int fd, unsign
return(error);
}
@ -519,7 +531,7 @@
/* intellimouse, ps2 version: Ben Pfaff and Colin Plumb */
/* Autodetect: Steve Bennett */
@@ -2297,6 +2460,12 @@
@@ -2455,6 +2618,12 @@ Gpm_Type mice[]={
{"ps2", "Busmice of the ps/2 series. Most busmice, actually.",
"PS/2", M_ps2, I_ps2, STD_FLG,
{0xc0, 0x00, 0x00, 0x00}, 3, 1, 0, 0, R_ps2, 1},
@ -531,10 +543,12 @@
+ {0x20, 0x20, 0x00, 0x00}, 1, 1, 0, 0, 0, 0},
{"sun", "'msc' protocol, but only 3 bytes per packet.",
"", M_sun, I_serial, CS8 | CSTOPB | STD_FLG,
{0xf8, 0x80, 0x00, 0x00}, 3, 1, 0, 0, 0, 0},
--- src/silitek.c
+++ src/silitek.c
@@ -0,0 +1,580 @@
{0xf8, 0x80, 0x00, 0x00}, 3, 1, 0, 0, R_sun, 0},
Index: src/silitek.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ src/silitek.c 2010-09-08 18:28:24.235054869 +0200
@@ -0,0 +1,570 @@
+/*
+ * silitek.c - support for the Silitek SM-1000 (Netshooter) with its IR
+ * receiver plugged serial connector and also with the IR
@ -613,7 +627,7 @@
+ * (byte1 & 0x7f) & (byte2 & 0x7f) == 0x40
+ * (byte1 & 0x7f) | (byte2 & 0x7f) == 0x7f
+ * (byte1 & 0x1f) == keycode
+ *
+ *
+ * No mouse move but mouse button:
+ * 0x80 0x80
+ * Mouse move but no button:
@ -671,7 +685,7 @@
+ * Which provides: byte1 & byte2 == 0x00
+ * byte1 | byte2 == 0xff
+ * byte1 == keycode
+ *
+ *
+ * Mouse is standard PS2 mouse
+ */
+
@ -697,6 +711,7 @@
+#include <fcntl.h>
+
+#include "headers/gpm.h"
+#include "headers/daemon.h"
+#include "headers/silitek.h"
+#include "headers/gpmInt.h"
+#include "headers/message.h"
@ -743,17 +758,6 @@
+};
+#define SILITEK_KEYS (sizeof(K_silitek)/sizeof(struct silitek_key_struct))
+
+/* From twiddler.c: The same silly function as in gpm.c */
+static inline int open_console(const int mode)
+{
+ int fd;
+ extern struct options option;
+
+ if ((fd=open(option.consolename, mode)) < 0)
+ gpm_report(GPM_PR_OOPS,GPM_MESS_OPEN,option.consolename);
+ return fd;
+}
+
+static inline int silitek_wait(int timeout)
+{
+ fd_set Set;
@ -865,7 +869,7 @@
+#undef GET_TIME
+#undef DIF_TIME
+
+ if (timediff && timediff < opt_time)
+ if (timediff && timediff < (which_mouse->opt_time))
+ return;
+
+ item = K_silitek[but].item;
@ -961,7 +965,7 @@
+#undef GET_TIME
+#undef DIF_TIME
+
+ if (timediff && timediff < opt_time)
+ if (timediff && timediff < (which_mouse->opt_time))
+ return;
+
+ item = K_silitek[but].item;

View File

@ -0,0 +1,13 @@
Index: src/daemon/processspecial.c
===================================================================
--- src/daemon/processspecial.c.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/daemon/processspecial.c 2010-09-08 17:41:17.533664061 +0200
@@ -157,7 +157,7 @@ int processSpecial(Gpm_Event *event)
open(option.consolename,O_WRONLY); /* stdout */
dup(1); /* stderr */
int open_max = sysconf(_SC_OPEN_MAX);
- if (open_max == -1) open_max = 1024;
+ if (open_max == -1) open_max = getdtablesize();
for (i=3;i<open_max; i++) close(i);
execl("/bin/sh","sh","-c",command,(char *)NULL);
exit(1); /* shouldn't happen */

66
gpm-va_arg.patch Normal file
View File

@ -0,0 +1,66 @@
Index: src/lib/report-lib.c
===================================================================
--- src/lib/report-lib.c.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/lib/report-lib.c 2010-09-08 13:34:13.721996934 +0200
@@ -55,5 +55,7 @@ void gpm_report(int line, char *file, in
fprintf(stderr,"\n");
#endif
+ va_end(ap);
+
if(stat == GPM_STAT_OOPS) exit(1); /* may a lib function call exit ???? */
}
Index: src/report.c
===================================================================
--- src/report.c.orig 2009-02-09 10:58:53.000000000 +0100
+++ src/report.c 2010-09-08 13:34:45.694394879 +0200
@@ -76,6 +76,9 @@ void gpm_report(int line, char *file, in
#ifdef HAVE_VSYSLOG
va_list ap2;
#endif
+ int exit_request = 0; /* 0 -> return is requested
+ 1 -> exit(1) is requested
+ 2 -> _exit(1) is requested */
va_start(ap,text);
va_copy(ap3, ap);
@@ -129,7 +132,7 @@ void gpm_report(int line, char *file, in
vfprintf(stderr,text,ap);
fprintf(stderr,"\n");
- exit(1); /* we should have a oops()-function,but this works,too*/
+ exit_request = 1; /* we should have an oops()-function,but this works,too*/
break;
}
break; /* startup sequence */
@@ -188,7 +191,7 @@ void gpm_report(int line, char *file, in
vfprintf(stderr,text,ap);
fprintf(stderr,"\n");
- _exit(1); /* we are the fork()-child */
+ exit_request = 2; /* we are the fork()-child */
break;
}
break; /* running gpm */
@@ -216,7 +219,7 @@ void gpm_report(int line, char *file, in
vfprintf(console,text,ap);
fprintf(console,"\n");
- if(stat == GPM_STAT_OOPS) exit(1);
+ if(stat == GPM_STAT_OOPS) exit_request = 1;
break;
} /* switch for current modus */
@@ -226,6 +229,12 @@ void gpm_report(int line, char *file, in
#ifdef HAVE_VSYSLOG
va_end(ap2);
#endif
+ if (exit_request == 2)
+ _exit(1);
+ if (exit_request == 1)
+ exit(1);
+
+ return;
} /* gpm_report */

42
gpm-verbosity.patch Normal file
View File

@ -0,0 +1,42 @@
Index: src/prog/gpm-root.y
===================================================================
--- src/prog/gpm-root.y.orig 2010-09-08 17:00:51.668569297 +0200
+++ src/prog/gpm-root.y 2010-09-08 17:00:52.032543941 +0200
@@ -870,7 +870,6 @@ int usage(void)
" -m <number-or-name> modifier to use\n"
" -u inhibit user configuration files\n"
" -D don't auto-background and run as daemon\n"
- " -V <verbosity-delta> increase amount of logged messages\n"
);
return 1;
Index: src/daemon/cmdline.c
===================================================================
--- src/daemon/cmdline.c.orig 2010-09-08 17:00:51.788560939 +0200
+++ src/daemon/cmdline.c 2010-09-08 17:01:43.769151777 +0200
@@ -78,8 +78,9 @@ void cmdline(int argc, char **argv)
case 'u': option.autodetect = 1; break;
case 'T': opt_test++; break;
case 'v': printf(GPM_MESS_VERSION "\n"); exit(0);
- case '2': (which_mouse->opt_three) = -1; break;
- case '3': (which_mouse->opt_three) = 1; break;
+ case 'V': break; /* gpm_debug_level not supported anymore */
+ case '2': (which_mouse->opt_three) = -1; break;
+ case '3': (which_mouse->opt_three) = 1; break;
default: exit(usage("commandline"));
}
}
Index: src/headers/message.h
===================================================================
--- src/headers/message.h.orig 2010-09-08 17:00:51.984547286 +0200
+++ src/headers/message.h 2010-09-08 17:00:53.060472330 +0200
@@ -98,8 +98,7 @@
" -t mouse-type sets mouse type (default '%s')\n" \
" Use a non-existent type (e.g. \"help\") to get a list\n" \
" -T test: read mouse, no clients\n" \
- " -v print version and exit\n" \
- " -V verbosity increase number of logged messages\n\n\n" \
+ " -v print version and exit\n\n\n" \
" Examples:\n\n" \
" gpm -m /dev/misc/psaux -t ps2 to start with a ps2 mouse\n" \
" gpm -m /dev/tts/0 -t mman to use mouse man on COM1\n\n"

View File

@ -1,3 +1,34 @@
-------------------------------------------------------------------
Wed Sep 8 19:59:58 CEST 2010 - pth@suse.de
- Fix patches.
-------------------------------------------------------------------
Wed Sep 8 17:17:02 CEST 2010 - pth@suse.de
- Update to latest stable version 1.20.6. Notable changes since
1.20.1:
* Fix default handler in liblow.c
* Fixed SONAME (praise the Debian guys, Jonathan Nieder)
* Fix possible segfault (FD_SET/negative)
* Allow specifying ELISP variable on commandline
* Fix broken code semantics
* Fix socklen_t issue: Require posix header
* Fix building with glibc 2.8
* Updated library to version 2.1.0
* Gpm_GetLibVersion behaves more consistent (all numbers are one or two digits)
- Remove version number from patch name.
- Adapt and clean out patches.
- Split out contained patches to a separate tar ball as not to
confuse quilt.
- Use lzma instead of bzip2 to compress tarball.
-------------------------------------------------------------------
Tue Sep 7 11:06:22 UTC 2010 - aj@suse.de
- Split up devel package, do not package static library.
- Remove support for updating from SUSE Linux 8.2.
-------------------------------------------------------------------
Sun Jan 10 19:07:40 UTC 2010 - coolo@novell.com

116
gpm.spec
View File

@ -1,5 +1,5 @@
#
# spec file for package gpm (Version 1.20.1)
# spec file for package gpm (Version 1.20.6)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -19,7 +19,7 @@
Name: gpm
BuildRequires: bison ncurses-devel
BuildRequires: bison lzma ncurses-devel
Url: http://linux.schottelius.org/gpm/
License: GPLv2+
Group: System/Console
@ -31,33 +31,33 @@ AutoReqProv: on
Obsoletes: gpm-64bit
%endif
#
Version: 1.20.1
Release: 455
Version: 1.20.6
Release: 1
Summary: Console Mouse Support
Source0: http://arcana.linux.it/pub/gpm/gpm-%{version}.tar.bz2
Source1: rcgpm
Source2: sysconfig.mouse-%{name}
Source3: README.SuSE
Source4: baselibs.conf
Patch0: gpm-%{version}.patch
Patch1: gpm-%{version}-ps2_command_bytes.patch
Patch2: gpm-%{version}-ps2_read.patch
Patch3: gpm-%{version}-ps2_reconnection.patch
Patch4: gpm-%{version}-syn_conf.patch
Patch5: gpm-%{version}-silitek.patch
Patch6: gpm-%{version}-conf.patch
Patch7: gpm-%{version}-va_arg.patch
Patch8: gpm-%{version}-quiet_libgpm.patch
Patch9: gpm-%{version}-no_templates_for_new_multiple_mode.patch
Patch10: gpm-%{version}-ceil.patch
Patch11: gpm-%{version}-Gpm_Open.patch
Patch12: gpm-%{version}-daemon_mode.patch
Patch13: gpm-%{version}-gunze-overflow.patch
Patch14: gpm-%{version}-warnings.patch
Patch15: gpm-%{version}-verbosity.patch
Patch16: gpm-%{version}-OPEN_MAX.patch
Patch17: %{name}-%{version}-log.patch
Patch18: %{name}-%{version}-glibc210.patch
Source0: gpm-%{version}.tar.lzma
Source1: gpm-%{version}-patches.tar.lzma
Source2: rcgpm
Source3: sysconfig.mouse-%{name}
Source4: README.SuSE
Source5: baselibs.conf
Patch0: gpm-DESTDIR.patch
Patch1: gpm-ps2_command_bytes.patch
Patch2: gpm-ps2_read.patch
Patch3: gpm-ps2_reconnection.patch
Patch4: gpm-syn_conf.patch
Patch5: gpm-silitek.patch
Patch6: gpm-conf.patch
Patch7: gpm-va_arg.patch
Patch8: gpm-quiet_libgpm.patch
Patch9: gpm-no_templates_for_new_multiple_mode.patch
Patch10: gpm-ceil.patch
Patch11: gpm-Gpm_Open.patch
Patch12: gpm-daemon_mode.patch
Patch15: gpm-verbosity.patch
Patch17: gpm-log.patch
Patch18: gpm-glibc210.patch
Patch19: gpm-use_getdtablesize.patch
Patch20: gpm-int_ptr_casts.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: %install_info_prereq
@ -71,8 +71,17 @@ provides console cut and paste operations.
Authors:
--------
Alessandro Rubini <rubini@ipvvis.unipv.it>
Nico Schottelius <nico@schottelius.net>
Alessandro Rubini <rubini at ipvvis.unipv.it>
Nico Schottelius <nico at schottelius.org>
%package devel
License: GPLv2+
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
Summary: Development files for gpm (Console Mouse Support)
%description devel
Development files for the gpm (general purpose mouse) package.
%prep
%setup -q
@ -89,14 +98,13 @@ Authors:
%patch10
%patch11
%patch12
%patch13
%patch14
%patch15
%patch16 -p1
%patch17
%patch18 -p1
#
cp %{S:1} %{S:2} %{S:3} .
%patch18
%patch19
%patch20
cp %{S:2} %{S:3} %{S:4} .
%build
# This package failed when testing with -Wl,-as-needed being default.
@ -112,10 +120,12 @@ make CC="gcc -lm"
make
%install
make DESTDIR=$RPM_BUILD_ROOT install
make ROOT="" DESTDIR=$RPM_BUILD_ROOT install
#
# gpm confings
install -d $RPM_BUILD_ROOT/etc/${file/conf\/gpm-/gpm\/}
for file in conf/gpm-* ; do
install -d $RPM_BUILD_ROOT/etc/${file/conf\/gpm-/gpm\/}
install -m 644 $file $RPM_BUILD_ROOT/etc/${file/conf\/gpm-/gpm\/}
done
#
@ -131,19 +141,6 @@ install -m 755 -d $RPM_BUILD_ROOT/usr/sbin
install -m 644 sysconfig.mouse-%{name} $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 755 rcgpm $RPM_BUILD_ROOT/etc/init.d/gpm
ln -sf ../../etc/init.d/gpm $RPM_BUILD_ROOT/usr/sbin/rcgpm
%preun
%stop_on_removal gpm
%post
/sbin/ldconfig
# rename variable in all possible locations for update
for i in etc/rc.config etc/sysconfig/mouse ; do
if test -f $i ; then
sed -e "s@^MOUSE=@MOUSEDEVICE=@" $i > $i.t && mv $i.t $i
rm -f $i.t
fi
done
# there were two variables with the same value GPM_PROTOCOL and MOUSETYPE
# in SuLi 8.2. The MOUSETYPE variable better conforms with with other
# variable names MOUSEDEVICE and XMOUSETYPE name scheme, so get rid of
@ -156,6 +153,15 @@ if grep "^GPM_PROTOCOL=" /etc/sysconfig/mouse 1>/dev/null 2>/dev/null ; then
# rename GPM_PROTOCOL to MOUSETYPE
perl -pi -e "s|^GPM_PROTOCOL=(.*)$|\# the variable GPM_PROTOCOL was renamed to MOUSETYPE\nMOUSETYPE=\$1|" /etc/sysconfig/mouse
fi
# Do not package static library
rm -f $RPM_BUILD_ROOT/%{_libdir}/libgpm.a
%preun
%stop_on_removal gpm
%post
/sbin/ldconfig
%{fillup_and_insserv gpm}
%{fillup_only -an mouse}
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
@ -171,7 +177,7 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc BUGS COPYING Changes README README.SuSE TODO
%doc BUGS COPYING README README.SuSE TODO doc/changes
%doc doc/Announce doc/FAQ doc/README*
%{_infodir}/*
%{_mandir}/*/*
@ -180,8 +186,12 @@ rm -rf $RPM_BUILD_ROOT
%config /etc/init.d/gpm
%{_bindir}/*
%{_sbindir}/*
%{_includedir}/*.h
%{_libdir}/lib*
%{_libdir}/libgpm.so.*
/var/adm/fillup-templates/*
%files devel
%defattr(-,root,root)
%{_includedir}/*.h
%{_libdir}/libgpm.so
%changelog