2 * Copyright (c) 1998 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp)
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote
14 * products derived from this software without specific prior written
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHRO AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHRO OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #include "sysinstall.h"
36 mousedTest(dialogMenuItem *self)
42 type = variable_get(VAR_MOUSED_TYPE);
43 port = variable_get(VAR_MOUSED_PORT);
44 if ((type == NULL) || (port == NULL)
45 || (strlen(type) <= 0) || (strlen(port) <= 0)
46 || (strcmp(type, "NO") == 0)) {
47 msgConfirm("Please select a mouse protocol and a port first.");
51 msgNotify("Trying to start the mouse daemon...");
52 if (file_readable("/var/run/moused.pid"))
53 vsystem("kill `cat /var/run/moused.pid`");
54 systemExecute("vidcontrol -m on");
55 vsystem("moused -t %s -p %s", type, port);
57 ret = msgYesNo("Now move the mouse and see if it works.\n"
58 "(Note that buttons don't have any effect for now.)\n\n"
59 " Is the mouse cursor moving?\n");
60 systemExecute("vidcontrol -m off");
62 if (file_readable("/var/run/moused.pid"))
63 vsystem("kill `cat /var/run/moused.pid`");
64 variable_set2(VAR_MOUSED, "NO", 1);
66 variable_set2(VAR_MOUSED, "YES", 1);
67 vsystem("ln -fs /dev/sysmouse /dev/mouse"); /* backwards compat */
74 mousedDisable(dialogMenuItem *self)
76 if (file_readable("/var/run/moused.pid"))
77 vsystem("kill `cat /var/run/moused.pid`");
78 variable_set2(VAR_MOUSED, "NO", 1);
79 variable_set2(VAR_MOUSED_TYPE, "NO", 1);
80 variable_unset(VAR_MOUSED_PORT);
81 msgConfirm("The mouse daemon is disabled.");