diff options
-rw-r--r-- | release/sysinstall/Makefile | 2 | ||||
-rw-r--r-- | release/sysinstall/config.c | 20 | ||||
-rw-r--r-- | release/sysinstall/menus.c | 138 | ||||
-rw-r--r-- | release/sysinstall/mouse.c | 68 | ||||
-rw-r--r-- | release/sysinstall/sysinstall.h | 8 | ||||
-rw-r--r-- | usr.sbin/sade/Makefile | 2 | ||||
-rw-r--r-- | usr.sbin/sade/config.c | 20 | ||||
-rw-r--r-- | usr.sbin/sade/menus.c | 138 | ||||
-rw-r--r-- | usr.sbin/sade/sade.h | 8 | ||||
-rw-r--r-- | usr.sbin/sysinstall/Makefile | 2 | ||||
-rw-r--r-- | usr.sbin/sysinstall/config.c | 20 | ||||
-rw-r--r-- | usr.sbin/sysinstall/menus.c | 138 | ||||
-rw-r--r-- | usr.sbin/sysinstall/mouse.c | 68 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 8 |
14 files changed, 487 insertions, 153 deletions
diff --git a/release/sysinstall/Makefile b/release/sysinstall/Makefile index 2d86e17..561244f 100644 --- a/release/sysinstall/Makefile +++ b/release/sysinstall/Makefile @@ -10,7 +10,7 @@ CLEANFILES+= keymap.tmp keymap.h SRCS= anonFTP.c attr.c cdrom.c command.c config.c devices.c \ disks.c dispatch.c dist.c dmenu.c doc.c dos.c dosio.c floppy.c \ ftp.c globals.c index.c install.c installUpgrade.c keymap.c \ - label.c lndir.c main.c makedevs.c media.c menus.c misc.c \ + label.c lndir.c main.c makedevs.c media.c menus.c misc.c mouse.c \ msg.c network.c nfs.c options.c package.c register.c system.c \ tape.c tcpip.c termcap.c ufs.c user.c variable.c wizard.c \ uc_eisa.c uc_isa.c uc_kmem.c uc_list.c uc_main.c uc_pci.c \ diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c index 2b37c89..d903b23 100644 --- a/release/sysinstall/config.c +++ b/release/sysinstall/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.103 1997/08/18 21:47:31 jkh Exp $ + * $Id: config.c,v 1.104 1997/09/17 16:18:10 pst Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -513,6 +513,7 @@ configXEnvironment(dialogMenuItem *self) { #ifndef USE_XIG_ENVIRONMENT char *config, *execfile; + char *moused; dialog_clear_norefresh(); if (!dmenuOpenSimple(&MenuXF86Config, FALSE)) @@ -524,8 +525,23 @@ configXEnvironment(dialogMenuItem *self) execfile = string_concat("/usr/X11R6/bin/", config); if (file_executable(execfile)) { dialog_clear_norefresh(); - if (!file_readable("/dev/mouse") && !msgYesNo("Does this system have a mouse attached to it?")) + moused = variable_get(VAR_MOUSED); + while (!moused || strcmp(moused, "YES")) { + if (msgYesNo("The X server may access the mouse in two ways: direct access\n" + "or indirect access via the mouse daemon. You have not\n" + "configured the mouse daemon. Would you like to configure it\n" + "now? If you intend to let the X server access the mouse\n" + "directly, choose \"No\" at this time.")) + break; dmenuOpenSimple(&MenuMouse, FALSE); + dialog_clear(); + moused = variable_get(VAR_MOUSED); + } + if (moused && !strcmp(moused, "YES")) + msgConfirm("You have configured and been running the mouse daemon.\n" + "Choose \"/dev/sysmouse\" as the mouse port and \"SysMouse\" or\n" + "\"MouseSystems\" as the mouse protocol in the X configuration\n" + "utility."); dialog_clear(); systemExecute(execfile); return DITEM_SUCCESS | DITEM_RESTORE; diff --git a/release/sysinstall/menus.c b/release/sysinstall/menus.c index d841192..77fe353 100644 --- a/release/sysinstall/menus.c +++ b/release/sysinstall/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.153 1998/02/10 18:31:27 jkh Exp $ + * $Id: menus.c,v 1.154 1998/02/12 17:53:19 yokota Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -341,56 +341,100 @@ DMenu MenuDocumentation = { { NULL } }, }; -static int -whichMouse(dialogMenuItem *self) -{ - int i; - char buf[BUFSIZ]; - - if (!file_readable("/dev/mouse")) - return FALSE; - if ((i = readlink("/dev/mouse", buf, sizeof buf)) == -1) - return FALSE; - buf[i] = '\0'; - if (!strcmp(self->prompt, "COM1")) - return !strcmp(buf, "/dev/cuaa0"); - else if (!strcmp(self->prompt, "COM2")) - return !strcmp(buf, "/dev/cuaa1"); - if (!strcmp(self->prompt, "COM3")) - return !strcmp(buf, "/dev/cuaa2"); - if (!strcmp(self->prompt, "COM4")) - return !strcmp(buf, "/dev/cuaa3"); - if (!strcmp(self->prompt, "BusMouse")) - return !strcmp(buf, "/dev/mse0"); - if (!strcmp(self->prompt, "PS/2")) - return !strcmp(buf, "/dev/psm0"); - return FALSE; -} +DMenu MenuMouseType = { + DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS, + "Select a protocol type for your mouse", + "If you are not sure, choose \"Auto\". It should always work for bus\n" + "and PS/2 style mice. It may not work for the serial mouse if the mouse\n" + "does not support the PnP standard. But, it won't hurt. Many 2-button\n" + "serial mice are compatible with \"Microsoft\" or \"MouseMan\". 3-button\n" + "serial mice may be compatible with \"MouseSystems\" or \"MouseMan\". If\n" + "the mouse has a wheel, it may be compatible with \"IntelliMouse\".", + NULL, + NULL, + { { "Auto", "Bus mouse, PS/2 style mouse or PnP serial mouse", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=auto" }, + { "GlidePoint", "ALPS GlidePoint pad (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=glidepoint" }, + { "Hitachi","Hitachi tablet (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=mmhittab" }, + { "IntelliMouse", "Microsoft IntelliMouse (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=intellimouse" }, + { "Logitech", "Logitech protocol (old models) (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=logitech" }, + { "Microsoft", "Microsoft protocol (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=microsoft" }, + { "MM Series","MM Series protocol (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=mmseries" }, + { "MouseMan", "Logitech MouseMan/TrackMan models (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=mouseman" }, + { "MouseSystems", "MouseSystems protocol (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=mousesystems" }, + { "ThinkingMouse","Kensington ThinkingMouse (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=thinkingmouse" }, + { NULL } }, +}; -DMenu MenuMouse = { +DMenu MenuMousePort = { DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS, - "Please select your mouse type from the following menu", + "Select your mouse port from the following menu", + "Please note that for PS/2 mice, you need to enable the psm driver\n" + "in the kernel configuration menu when installing for the first time.", + NULL, + NULL, + { { "COM1", "Serial mouse on COM1 (/dev/cuaa0)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/cuaa0" }, + { "COM2", "Serial mouse on COM2 (/dev/cuaa1)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/cuaa1" }, + { "COM3", "Serial mouse on COM3 (/dev/cuaa2)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/cuaa2" }, + { "COM4", "Serial mouse on COM4 (/dev/cuaa3)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/cuaa3" }, + { "BusMouse", "Logitech, ATI or MS bus mouse (/dev/mse0)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/mse0" }, + { "PS/2", "PS/2 style mouse (must enable /dev/psm0)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/psm0" }, + { NULL } }, +}; + +DMenu MenuMouse = { + DMENU_NORMAL_TYPE, + "Please configure your mouse", "There are many different types of mice currently on the market,\n" "but this configuration menu should at least narrow down the choices\n" - "somewhat. Once you've selected one of the below, you can specify\n" - "/dev/mouse as your mouse device when running the X configuration\n" - "utility (see Configuration menu). Please note that for PS/2 mice,\n" - "you need to enable the psm driver in the kernel configuration menu\n" - "when installing for the first time.", - "For more information, visit the Documentation menu", + "somewhat. Once you've done with the following menus, you can specify\n" + "\"/dev/sysmouse\" as your mouse device and \"SysMouse\" or \"MouseSystems\"\n" + "as mouse protocol when running the X configuration utility (see \n" + "Configuration menu).", + "Choose 3 after selecting a protocol and a port.", NULL, - { { "COM1", "Serial mouse on COM1", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/cuaa0 /dev/mouse", '(', '*', ')', 1 }, - { "COM2", "Serial mouse on COM2", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/cuaa1 /dev/mouse", '(', '*', ')', 1 }, - { "COM3", "Serial mouse on COM3", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/cuaa2 /dev/mouse", '(', '*', ')', 1 }, - { "COM4", "Serial mouse on COM4", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/cuaa3 /dev/mouse", '(', '*', ')', 1 }, - { "BusMouse", "Logitech or ATI bus mouse", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/mse0 /dev/mouse", '(', '*', ')', 1 }, - { "PS/2", "PS/2 style mouse (must enable psm0 device)", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/psm0 /dev/mouse", '(', '*', ')', 1 }, + { { "1 Type", "Select mouse protocol", + NULL, dmenuSubmenu, NULL, &MenuMouseType }, + { "2 Port", "Select mouse port", + NULL, dmenuSubmenu, NULL, &MenuMousePort }, + { "3 Daemon", "Test and run the mouse daemon", + NULL, mousedTest, NULL, NULL }, + { "4 No mouse", "Clear mouse configuration", + NULL, dmenuSetVariables, NULL, + VAR_MOUSED "=NO, " VAR_MOUSED_TYPE "=NO, " VAR_MOUSED_PORT "=" }, + { "0 Exit", "Exit this menu (returning to previous)", + NULL, dmenuExit }, { NULL } }, }; @@ -1097,7 +1141,7 @@ DMenu MenuConfigure = { NULL, dmenuSystemCommand, NULL, "tzsetup" }, { "4 Media", "Change the installation media type", NULL, dmenuSubmenu, NULL, &MenuMedia }, - { "5 Mouse", "Select the type of mouse you have", + { "5 Mouse", "Configure your mouse", NULL, dmenuSubmenu, NULL, &MenuMouse, NULL }, { "6 Networking", "Configure additional network services", NULL, dmenuSubmenu, NULL, &MenuNetworking }, diff --git a/release/sysinstall/mouse.c b/release/sysinstall/mouse.c new file mode 100644 index 0000000..c7b6c19 --- /dev/null +++ b/release/sysinstall/mouse.c @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 1998 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHRO AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHRO OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ + +#include "sysinstall.h" +#include <string.h> + +int +mousedTest(dialogMenuItem *self) +{ + char *type; + char *port; + int ret; + + type = variable_get(VAR_MOUSED_TYPE); + port = variable_get(VAR_MOUSED_PORT); + if ((type == NULL) || (port == NULL) + || (strlen(type) <= 0) || (strlen(port) <= 0) + || (strcmp(type, "NO") == 0)) { + msgConfirm("Please select a mouse protocol and a port first."); + return DITEM_FAILURE; + } + + msgNotify("Trying to start the mouse daemon..."); + vsystem("kill `cat /var/run/moused.pid`"); + vsystem("vidcontrol -m on"); + vsystem("moused -t %s -p %s", type, port); + + ret = msgYesNo("Now move the mouse and see if it works.\n" + "(Note that buttons don't have any effect for now.)\n\n" + " Is the mouse cursor moving?\n"); + if (ret) { + vsystem("vidcontrol -m off"); + vsystem("kill `cat /var/run/moused.pid`"); + variable_set(VAR_MOUSED "=NO"); + } else { + variable_set(VAR_MOUSED "=YES"); + } + + return DITEM_SUCCESS; +} diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index 01d30d5..e155070 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.142 1997/10/12 16:21:19 jkh Exp $ + * $Id: sysinstall.h,v 1.143 1997/10/14 18:17:35 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -129,6 +129,9 @@ #define VAR_LABEL_COUNT "labelCount" #define VAR_MEDIA_TYPE "mediaType" #define VAR_MEDIA_TIMEOUT "MEDIA_TIMEOUT" +#define VAR_MOUSED "moused_enable" +#define VAR_MOUSED_PORT "moused_port" +#define VAR_MOUSED_TYPE "moused_type" #define VAR_NAMESERVER "nameserver" #define VAR_NETINTERACTIVE "netInteractive" #define VAR_NETMASK "netmask" @@ -636,6 +639,9 @@ extern WINDOW *savescr(void); extern void restorescr(WINDOW *w); extern char *sstrncpy(char *dst, const char *src, int size); +/* mouse.c */ +extern int mousedTest(dialogMenuItem *self); + /* msg.c */ extern Boolean isDebug(void); extern void msgInfo(char *fmt, ...); diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile index 2d86e17..561244f 100644 --- a/usr.sbin/sade/Makefile +++ b/usr.sbin/sade/Makefile @@ -10,7 +10,7 @@ CLEANFILES+= keymap.tmp keymap.h SRCS= anonFTP.c attr.c cdrom.c command.c config.c devices.c \ disks.c dispatch.c dist.c dmenu.c doc.c dos.c dosio.c floppy.c \ ftp.c globals.c index.c install.c installUpgrade.c keymap.c \ - label.c lndir.c main.c makedevs.c media.c menus.c misc.c \ + label.c lndir.c main.c makedevs.c media.c menus.c misc.c mouse.c \ msg.c network.c nfs.c options.c package.c register.c system.c \ tape.c tcpip.c termcap.c ufs.c user.c variable.c wizard.c \ uc_eisa.c uc_isa.c uc_kmem.c uc_list.c uc_main.c uc_pci.c \ diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c index 2b37c89..d903b23 100644 --- a/usr.sbin/sade/config.c +++ b/usr.sbin/sade/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.103 1997/08/18 21:47:31 jkh Exp $ + * $Id: config.c,v 1.104 1997/09/17 16:18:10 pst Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -513,6 +513,7 @@ configXEnvironment(dialogMenuItem *self) { #ifndef USE_XIG_ENVIRONMENT char *config, *execfile; + char *moused; dialog_clear_norefresh(); if (!dmenuOpenSimple(&MenuXF86Config, FALSE)) @@ -524,8 +525,23 @@ configXEnvironment(dialogMenuItem *self) execfile = string_concat("/usr/X11R6/bin/", config); if (file_executable(execfile)) { dialog_clear_norefresh(); - if (!file_readable("/dev/mouse") && !msgYesNo("Does this system have a mouse attached to it?")) + moused = variable_get(VAR_MOUSED); + while (!moused || strcmp(moused, "YES")) { + if (msgYesNo("The X server may access the mouse in two ways: direct access\n" + "or indirect access via the mouse daemon. You have not\n" + "configured the mouse daemon. Would you like to configure it\n" + "now? If you intend to let the X server access the mouse\n" + "directly, choose \"No\" at this time.")) + break; dmenuOpenSimple(&MenuMouse, FALSE); + dialog_clear(); + moused = variable_get(VAR_MOUSED); + } + if (moused && !strcmp(moused, "YES")) + msgConfirm("You have configured and been running the mouse daemon.\n" + "Choose \"/dev/sysmouse\" as the mouse port and \"SysMouse\" or\n" + "\"MouseSystems\" as the mouse protocol in the X configuration\n" + "utility."); dialog_clear(); systemExecute(execfile); return DITEM_SUCCESS | DITEM_RESTORE; diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c index d841192..77fe353 100644 --- a/usr.sbin/sade/menus.c +++ b/usr.sbin/sade/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.153 1998/02/10 18:31:27 jkh Exp $ + * $Id: menus.c,v 1.154 1998/02/12 17:53:19 yokota Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -341,56 +341,100 @@ DMenu MenuDocumentation = { { NULL } }, }; -static int -whichMouse(dialogMenuItem *self) -{ - int i; - char buf[BUFSIZ]; - - if (!file_readable("/dev/mouse")) - return FALSE; - if ((i = readlink("/dev/mouse", buf, sizeof buf)) == -1) - return FALSE; - buf[i] = '\0'; - if (!strcmp(self->prompt, "COM1")) - return !strcmp(buf, "/dev/cuaa0"); - else if (!strcmp(self->prompt, "COM2")) - return !strcmp(buf, "/dev/cuaa1"); - if (!strcmp(self->prompt, "COM3")) - return !strcmp(buf, "/dev/cuaa2"); - if (!strcmp(self->prompt, "COM4")) - return !strcmp(buf, "/dev/cuaa3"); - if (!strcmp(self->prompt, "BusMouse")) - return !strcmp(buf, "/dev/mse0"); - if (!strcmp(self->prompt, "PS/2")) - return !strcmp(buf, "/dev/psm0"); - return FALSE; -} +DMenu MenuMouseType = { + DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS, + "Select a protocol type for your mouse", + "If you are not sure, choose \"Auto\". It should always work for bus\n" + "and PS/2 style mice. It may not work for the serial mouse if the mouse\n" + "does not support the PnP standard. But, it won't hurt. Many 2-button\n" + "serial mice are compatible with \"Microsoft\" or \"MouseMan\". 3-button\n" + "serial mice may be compatible with \"MouseSystems\" or \"MouseMan\". If\n" + "the mouse has a wheel, it may be compatible with \"IntelliMouse\".", + NULL, + NULL, + { { "Auto", "Bus mouse, PS/2 style mouse or PnP serial mouse", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=auto" }, + { "GlidePoint", "ALPS GlidePoint pad (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=glidepoint" }, + { "Hitachi","Hitachi tablet (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=mmhittab" }, + { "IntelliMouse", "Microsoft IntelliMouse (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=intellimouse" }, + { "Logitech", "Logitech protocol (old models) (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=logitech" }, + { "Microsoft", "Microsoft protocol (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=microsoft" }, + { "MM Series","MM Series protocol (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=mmseries" }, + { "MouseMan", "Logitech MouseMan/TrackMan models (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=mouseman" }, + { "MouseSystems", "MouseSystems protocol (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=mousesystems" }, + { "ThinkingMouse","Kensington ThinkingMouse (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=thinkingmouse" }, + { NULL } }, +}; -DMenu MenuMouse = { +DMenu MenuMousePort = { DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS, - "Please select your mouse type from the following menu", + "Select your mouse port from the following menu", + "Please note that for PS/2 mice, you need to enable the psm driver\n" + "in the kernel configuration menu when installing for the first time.", + NULL, + NULL, + { { "COM1", "Serial mouse on COM1 (/dev/cuaa0)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/cuaa0" }, + { "COM2", "Serial mouse on COM2 (/dev/cuaa1)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/cuaa1" }, + { "COM3", "Serial mouse on COM3 (/dev/cuaa2)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/cuaa2" }, + { "COM4", "Serial mouse on COM4 (/dev/cuaa3)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/cuaa3" }, + { "BusMouse", "Logitech, ATI or MS bus mouse (/dev/mse0)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/mse0" }, + { "PS/2", "PS/2 style mouse (must enable /dev/psm0)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/psm0" }, + { NULL } }, +}; + +DMenu MenuMouse = { + DMENU_NORMAL_TYPE, + "Please configure your mouse", "There are many different types of mice currently on the market,\n" "but this configuration menu should at least narrow down the choices\n" - "somewhat. Once you've selected one of the below, you can specify\n" - "/dev/mouse as your mouse device when running the X configuration\n" - "utility (see Configuration menu). Please note that for PS/2 mice,\n" - "you need to enable the psm driver in the kernel configuration menu\n" - "when installing for the first time.", - "For more information, visit the Documentation menu", + "somewhat. Once you've done with the following menus, you can specify\n" + "\"/dev/sysmouse\" as your mouse device and \"SysMouse\" or \"MouseSystems\"\n" + "as mouse protocol when running the X configuration utility (see \n" + "Configuration menu).", + "Choose 3 after selecting a protocol and a port.", NULL, - { { "COM1", "Serial mouse on COM1", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/cuaa0 /dev/mouse", '(', '*', ')', 1 }, - { "COM2", "Serial mouse on COM2", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/cuaa1 /dev/mouse", '(', '*', ')', 1 }, - { "COM3", "Serial mouse on COM3", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/cuaa2 /dev/mouse", '(', '*', ')', 1 }, - { "COM4", "Serial mouse on COM4", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/cuaa3 /dev/mouse", '(', '*', ')', 1 }, - { "BusMouse", "Logitech or ATI bus mouse", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/mse0 /dev/mouse", '(', '*', ')', 1 }, - { "PS/2", "PS/2 style mouse (must enable psm0 device)", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/psm0 /dev/mouse", '(', '*', ')', 1 }, + { { "1 Type", "Select mouse protocol", + NULL, dmenuSubmenu, NULL, &MenuMouseType }, + { "2 Port", "Select mouse port", + NULL, dmenuSubmenu, NULL, &MenuMousePort }, + { "3 Daemon", "Test and run the mouse daemon", + NULL, mousedTest, NULL, NULL }, + { "4 No mouse", "Clear mouse configuration", + NULL, dmenuSetVariables, NULL, + VAR_MOUSED "=NO, " VAR_MOUSED_TYPE "=NO, " VAR_MOUSED_PORT "=" }, + { "0 Exit", "Exit this menu (returning to previous)", + NULL, dmenuExit }, { NULL } }, }; @@ -1097,7 +1141,7 @@ DMenu MenuConfigure = { NULL, dmenuSystemCommand, NULL, "tzsetup" }, { "4 Media", "Change the installation media type", NULL, dmenuSubmenu, NULL, &MenuMedia }, - { "5 Mouse", "Select the type of mouse you have", + { "5 Mouse", "Configure your mouse", NULL, dmenuSubmenu, NULL, &MenuMouse, NULL }, { "6 Networking", "Configure additional network services", NULL, dmenuSubmenu, NULL, &MenuNetworking }, diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index 01d30d5..e155070 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.142 1997/10/12 16:21:19 jkh Exp $ + * $Id: sysinstall.h,v 1.143 1997/10/14 18:17:35 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -129,6 +129,9 @@ #define VAR_LABEL_COUNT "labelCount" #define VAR_MEDIA_TYPE "mediaType" #define VAR_MEDIA_TIMEOUT "MEDIA_TIMEOUT" +#define VAR_MOUSED "moused_enable" +#define VAR_MOUSED_PORT "moused_port" +#define VAR_MOUSED_TYPE "moused_type" #define VAR_NAMESERVER "nameserver" #define VAR_NETINTERACTIVE "netInteractive" #define VAR_NETMASK "netmask" @@ -636,6 +639,9 @@ extern WINDOW *savescr(void); extern void restorescr(WINDOW *w); extern char *sstrncpy(char *dst, const char *src, int size); +/* mouse.c */ +extern int mousedTest(dialogMenuItem *self); + /* msg.c */ extern Boolean isDebug(void); extern void msgInfo(char *fmt, ...); diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile index 2d86e17..561244f 100644 --- a/usr.sbin/sysinstall/Makefile +++ b/usr.sbin/sysinstall/Makefile @@ -10,7 +10,7 @@ CLEANFILES+= keymap.tmp keymap.h SRCS= anonFTP.c attr.c cdrom.c command.c config.c devices.c \ disks.c dispatch.c dist.c dmenu.c doc.c dos.c dosio.c floppy.c \ ftp.c globals.c index.c install.c installUpgrade.c keymap.c \ - label.c lndir.c main.c makedevs.c media.c menus.c misc.c \ + label.c lndir.c main.c makedevs.c media.c menus.c misc.c mouse.c \ msg.c network.c nfs.c options.c package.c register.c system.c \ tape.c tcpip.c termcap.c ufs.c user.c variable.c wizard.c \ uc_eisa.c uc_isa.c uc_kmem.c uc_list.c uc_main.c uc_pci.c \ diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c index 2b37c89..d903b23 100644 --- a/usr.sbin/sysinstall/config.c +++ b/usr.sbin/sysinstall/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.103 1997/08/18 21:47:31 jkh Exp $ + * $Id: config.c,v 1.104 1997/09/17 16:18:10 pst Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -513,6 +513,7 @@ configXEnvironment(dialogMenuItem *self) { #ifndef USE_XIG_ENVIRONMENT char *config, *execfile; + char *moused; dialog_clear_norefresh(); if (!dmenuOpenSimple(&MenuXF86Config, FALSE)) @@ -524,8 +525,23 @@ configXEnvironment(dialogMenuItem *self) execfile = string_concat("/usr/X11R6/bin/", config); if (file_executable(execfile)) { dialog_clear_norefresh(); - if (!file_readable("/dev/mouse") && !msgYesNo("Does this system have a mouse attached to it?")) + moused = variable_get(VAR_MOUSED); + while (!moused || strcmp(moused, "YES")) { + if (msgYesNo("The X server may access the mouse in two ways: direct access\n" + "or indirect access via the mouse daemon. You have not\n" + "configured the mouse daemon. Would you like to configure it\n" + "now? If you intend to let the X server access the mouse\n" + "directly, choose \"No\" at this time.")) + break; dmenuOpenSimple(&MenuMouse, FALSE); + dialog_clear(); + moused = variable_get(VAR_MOUSED); + } + if (moused && !strcmp(moused, "YES")) + msgConfirm("You have configured and been running the mouse daemon.\n" + "Choose \"/dev/sysmouse\" as the mouse port and \"SysMouse\" or\n" + "\"MouseSystems\" as the mouse protocol in the X configuration\n" + "utility."); dialog_clear(); systemExecute(execfile); return DITEM_SUCCESS | DITEM_RESTORE; diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c index d841192..77fe353 100644 --- a/usr.sbin/sysinstall/menus.c +++ b/usr.sbin/sysinstall/menus.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.153 1998/02/10 18:31:27 jkh Exp $ + * $Id: menus.c,v 1.154 1998/02/12 17:53:19 yokota Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -341,56 +341,100 @@ DMenu MenuDocumentation = { { NULL } }, }; -static int -whichMouse(dialogMenuItem *self) -{ - int i; - char buf[BUFSIZ]; - - if (!file_readable("/dev/mouse")) - return FALSE; - if ((i = readlink("/dev/mouse", buf, sizeof buf)) == -1) - return FALSE; - buf[i] = '\0'; - if (!strcmp(self->prompt, "COM1")) - return !strcmp(buf, "/dev/cuaa0"); - else if (!strcmp(self->prompt, "COM2")) - return !strcmp(buf, "/dev/cuaa1"); - if (!strcmp(self->prompt, "COM3")) - return !strcmp(buf, "/dev/cuaa2"); - if (!strcmp(self->prompt, "COM4")) - return !strcmp(buf, "/dev/cuaa3"); - if (!strcmp(self->prompt, "BusMouse")) - return !strcmp(buf, "/dev/mse0"); - if (!strcmp(self->prompt, "PS/2")) - return !strcmp(buf, "/dev/psm0"); - return FALSE; -} +DMenu MenuMouseType = { + DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS, + "Select a protocol type for your mouse", + "If you are not sure, choose \"Auto\". It should always work for bus\n" + "and PS/2 style mice. It may not work for the serial mouse if the mouse\n" + "does not support the PnP standard. But, it won't hurt. Many 2-button\n" + "serial mice are compatible with \"Microsoft\" or \"MouseMan\". 3-button\n" + "serial mice may be compatible with \"MouseSystems\" or \"MouseMan\". If\n" + "the mouse has a wheel, it may be compatible with \"IntelliMouse\".", + NULL, + NULL, + { { "Auto", "Bus mouse, PS/2 style mouse or PnP serial mouse", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=auto" }, + { "GlidePoint", "ALPS GlidePoint pad (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=glidepoint" }, + { "Hitachi","Hitachi tablet (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=mmhittab" }, + { "IntelliMouse", "Microsoft IntelliMouse (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=intellimouse" }, + { "Logitech", "Logitech protocol (old models) (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=logitech" }, + { "Microsoft", "Microsoft protocol (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=microsoft" }, + { "MM Series","MM Series protocol (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=mmseries" }, + { "MouseMan", "Logitech MouseMan/TrackMan models (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=mouseman" }, + { "MouseSystems", "MouseSystems protocol (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=mousesystems" }, + { "ThinkingMouse","Kensington ThinkingMouse (serial)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_TYPE "=thinkingmouse" }, + { NULL } }, +}; -DMenu MenuMouse = { +DMenu MenuMousePort = { DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS, - "Please select your mouse type from the following menu", + "Select your mouse port from the following menu", + "Please note that for PS/2 mice, you need to enable the psm driver\n" + "in the kernel configuration menu when installing for the first time.", + NULL, + NULL, + { { "COM1", "Serial mouse on COM1 (/dev/cuaa0)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/cuaa0" }, + { "COM2", "Serial mouse on COM2 (/dev/cuaa1)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/cuaa1" }, + { "COM3", "Serial mouse on COM3 (/dev/cuaa2)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/cuaa2" }, + { "COM4", "Serial mouse on COM4 (/dev/cuaa3)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/cuaa3" }, + { "BusMouse", "Logitech, ATI or MS bus mouse (/dev/mse0)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/mse0" }, + { "PS/2", "PS/2 style mouse (must enable /dev/psm0)", + dmenuVarCheck, dmenuSetVariable, NULL, + VAR_MOUSED_PORT "=/dev/psm0" }, + { NULL } }, +}; + +DMenu MenuMouse = { + DMENU_NORMAL_TYPE, + "Please configure your mouse", "There are many different types of mice currently on the market,\n" "but this configuration menu should at least narrow down the choices\n" - "somewhat. Once you've selected one of the below, you can specify\n" - "/dev/mouse as your mouse device when running the X configuration\n" - "utility (see Configuration menu). Please note that for PS/2 mice,\n" - "you need to enable the psm driver in the kernel configuration menu\n" - "when installing for the first time.", - "For more information, visit the Documentation menu", + "somewhat. Once you've done with the following menus, you can specify\n" + "\"/dev/sysmouse\" as your mouse device and \"SysMouse\" or \"MouseSystems\"\n" + "as mouse protocol when running the X configuration utility (see \n" + "Configuration menu).", + "Choose 3 after selecting a protocol and a port.", NULL, - { { "COM1", "Serial mouse on COM1", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/cuaa0 /dev/mouse", '(', '*', ')', 1 }, - { "COM2", "Serial mouse on COM2", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/cuaa1 /dev/mouse", '(', '*', ')', 1 }, - { "COM3", "Serial mouse on COM3", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/cuaa2 /dev/mouse", '(', '*', ')', 1 }, - { "COM4", "Serial mouse on COM4", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/cuaa3 /dev/mouse", '(', '*', ')', 1 }, - { "BusMouse", "Logitech or ATI bus mouse", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/mse0 /dev/mouse", '(', '*', ')', 1 }, - { "PS/2", "PS/2 style mouse (must enable psm0 device)", whichMouse, dmenuSystemCommand, NULL, - "ln -fs /dev/psm0 /dev/mouse", '(', '*', ')', 1 }, + { { "1 Type", "Select mouse protocol", + NULL, dmenuSubmenu, NULL, &MenuMouseType }, + { "2 Port", "Select mouse port", + NULL, dmenuSubmenu, NULL, &MenuMousePort }, + { "3 Daemon", "Test and run the mouse daemon", + NULL, mousedTest, NULL, NULL }, + { "4 No mouse", "Clear mouse configuration", + NULL, dmenuSetVariables, NULL, + VAR_MOUSED "=NO, " VAR_MOUSED_TYPE "=NO, " VAR_MOUSED_PORT "=" }, + { "0 Exit", "Exit this menu (returning to previous)", + NULL, dmenuExit }, { NULL } }, }; @@ -1097,7 +1141,7 @@ DMenu MenuConfigure = { NULL, dmenuSystemCommand, NULL, "tzsetup" }, { "4 Media", "Change the installation media type", NULL, dmenuSubmenu, NULL, &MenuMedia }, - { "5 Mouse", "Select the type of mouse you have", + { "5 Mouse", "Configure your mouse", NULL, dmenuSubmenu, NULL, &MenuMouse, NULL }, { "6 Networking", "Configure additional network services", NULL, dmenuSubmenu, NULL, &MenuNetworking }, diff --git a/usr.sbin/sysinstall/mouse.c b/usr.sbin/sysinstall/mouse.c new file mode 100644 index 0000000..c7b6c19 --- /dev/null +++ b/usr.sbin/sysinstall/mouse.c @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 1998 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHRO AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHRO OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ + +#include "sysinstall.h" +#include <string.h> + +int +mousedTest(dialogMenuItem *self) +{ + char *type; + char *port; + int ret; + + type = variable_get(VAR_MOUSED_TYPE); + port = variable_get(VAR_MOUSED_PORT); + if ((type == NULL) || (port == NULL) + || (strlen(type) <= 0) || (strlen(port) <= 0) + || (strcmp(type, "NO") == 0)) { + msgConfirm("Please select a mouse protocol and a port first."); + return DITEM_FAILURE; + } + + msgNotify("Trying to start the mouse daemon..."); + vsystem("kill `cat /var/run/moused.pid`"); + vsystem("vidcontrol -m on"); + vsystem("moused -t %s -p %s", type, port); + + ret = msgYesNo("Now move the mouse and see if it works.\n" + "(Note that buttons don't have any effect for now.)\n\n" + " Is the mouse cursor moving?\n"); + if (ret) { + vsystem("vidcontrol -m off"); + vsystem("kill `cat /var/run/moused.pid`"); + variable_set(VAR_MOUSED "=NO"); + } else { + variable_set(VAR_MOUSED "=YES"); + } + + return DITEM_SUCCESS; +} diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index 01d30d5..e155070 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.142 1997/10/12 16:21:19 jkh Exp $ + * $Id: sysinstall.h,v 1.143 1997/10/14 18:17:35 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -129,6 +129,9 @@ #define VAR_LABEL_COUNT "labelCount" #define VAR_MEDIA_TYPE "mediaType" #define VAR_MEDIA_TIMEOUT "MEDIA_TIMEOUT" +#define VAR_MOUSED "moused_enable" +#define VAR_MOUSED_PORT "moused_port" +#define VAR_MOUSED_TYPE "moused_type" #define VAR_NAMESERVER "nameserver" #define VAR_NETINTERACTIVE "netInteractive" #define VAR_NETMASK "netmask" @@ -636,6 +639,9 @@ extern WINDOW *savescr(void); extern void restorescr(WINDOW *w); extern char *sstrncpy(char *dst, const char *src, int size); +/* mouse.c */ +extern int mousedTest(dialogMenuItem *self); + /* msg.c */ extern Boolean isDebug(void); extern void msgInfo(char *fmt, ...); |