b004d06c23
This is a daemon which allows you to emulate middle and right click as well as a mouse wheel. It was originally written for Apple PowerPC laptops with a single button, but can be used on any hardware.
31 lines
838 B
Diff
31 lines
838 B
Diff
Author: Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>
|
|
Description: create pidfile in /run/mouseemu.pid
|
|
|
|
Note @q66: modified to use /run instead of /var/run
|
|
|
|
--- a/mouseemu.c
|
|
+++ b/mouseemu.c
|
|
@@ -755,6 +755,7 @@
|
|
|
|
struct sigaction sa;
|
|
sigset_t mask, oldmask;
|
|
+ FILE *pidfile;
|
|
|
|
/* SIGHUP and SIGALRM are only useful in the child */
|
|
memset(&sa, 0, sizeof(sa));
|
|
@@ -762,6 +763,15 @@
|
|
sigaction(SIGHUP, &sa, NULL);
|
|
sigaction(SIGALRM, &sa, NULL);
|
|
|
|
+ /* write PID file so the user can signal us for device rescans */
|
|
+ pidfile = fopen("/run/mouseemu.pid", "w");
|
|
+ if (!pidfile) {
|
|
+ perror("mouseemu: can't open /run/mouseemu.pid");
|
|
+ exit(1);
|
|
+ }
|
|
+ fprintf(pidfile, "%d\n", pid);
|
|
+ fclose(pidfile);
|
|
+
|
|
/*we start only after we received the first sigusr1 from child:*/
|
|
|
|
sigemptyset(&mask);
|