Description:
 Refit modification by James Troup to improve descriptions of mouse types,
 add a M_listMice function that is a M_listTypes modification, and a new
 M_listTypes, which only lists mnemonics. Modified by Joshua Kwan
 <joshk@debian.org>.
Date: Tue, 10 Aug 2004 13:01:44 -0700

--- a/src/headers/message.h
+++ b/src/headers/message.h
@@ -97,6 +97,7 @@
          "    -S [commands]    enable special commands (see man page)\n" \
          "    -t mouse-type    sets mouse type (default '%s')\n" \
          "                     Use a non-existent type (e.g. \"help\") to get a list\n" \
+         "                     or \"types\" to get a list of just the mnemonics.\n" \
          "    -T               test: read mouse, no clients\n" \
          "    -v               print version and exit\n" \
          "    -V verbosity     increase number of logged messages\n\n\n" \
--- a/src/mice.c
+++ b/src/mice.c
@@ -2373,28 +2373,32 @@
 
 Gpm_Type mice[]={
 
-   {"mman", "The \"MouseMan\" and similar devices (3/4 bytes per packet).",
+   {"mman", "The MouseMan protocol used by new Logitech mice.",
            "Mouseman", M_mman, I_serial, CS7 | STD_FLG, /* first */
                                 {0x40, 0x40, 0x40, 0x00}, 3, 1, 1, 0, 0},
-   {"ms",   "The original ms protocol, with a middle-button extension.",
+   {"ms",   "For Microsoft mice (2 or 3 buttons). Some old 2 button mice\n"
+            "                     send some spurious packets, which can be misunderstood as\n"
+            "                     middle-button events. If this is happening to you, use the\n"
+            "                     'bare' mouse type.",
            "", M_ms, I_serial, CS7 | STD_FLG,
                                 {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0},
-   {"acecad",  "Acecad tablet absolute mode(Sumagrapics MM-Series mode)",
+   {"acecad",  "For Acecad tablet in absolute mode(Sumagrapics MM-Series mode)",
            "", M_summa, I_summa, STD_FLG,
                                 {0x80, 0x80, 0x00, 0x00}, 7, 1, 0, 1, 0}, 
-   {"bare", "Unadorned ms protocol. Needed with some 2-buttons mice.",
+   {"bare", "For some 2 button Microsoft mice. Same as 'ms except that\n"
+            "                     gpm will not attempt to simulate a third button.",
            "Microsoft", M_bare, I_serial, CS7 | STD_FLG,
                                 {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0},
-   {"bm",   "Micro$oft busmice and compatible devices.",
+   {"bm",  "For some busmice, including Microsoft and Logitech busmice.",
            "BusMouse", M_bm, I_empty, STD_FLG, /* bm is sun */
                                 {0xf8, 0x80, 0x00, 0x00}, 3, 3, 0, 0, 0},
-   {"brw",  "Fellowes Browser - 4 buttons (and a wheel) (dual protocol?)",
+   {"brw",  "For the Fellowes Browser - 4 buttons (and a wheel) (dual protocol?).",
            "", M_brw, I_pnp, CS7 | STD_FLG,
                                 {0xc0, 0x40, 0xc0, 0x00}, 4, 1, 0, 0, 0},
-   {"cal", "Calcomp UltraSlate",
+   {"cal", "For a Calcomp UltraSlate",
            "", M_calus, I_calus, CS8 | CSTOPB | STD_FLG,
                                 {0x80, 0x80, 0x80, 0x00}, 6, 6, 0, 1, 0},
-   {"calr", "Calcomp UltraSlate - relative mode",
+   {"calr", "For a Calcomp UltraSlate in relative mode.",
            "", M_calus_rel, I_calus, CS8 | CSTOPB | STD_FLG,
                                 {0x80, 0x80, 0x80, 0x00}, 6, 6, 0, 0, 0},
   {"etouch",  "EloTouch touch-screens (only button-1 events, by now)",
@@ -2409,7 +2413,7 @@
            "ExplorerPS/2", M_imps2, I_exps2, STD_FLG,
                                 {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0},
 #ifdef HAVE_LINUX_JOYSTICK_H
-   {"js",   "Joystick mouse emulation",
+   {"js",   "For joystick mouse emulation",
            "Joystick", M_js, NULL, 0,
                               {0xFC, 0x00, 0x00, 0x00}, 12, 12, 0, 0, 0},
 #endif
@@ -2419,19 +2423,21 @@
    {"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}, 
-   {"imps2","Microsoft Intellimouse (ps2)-autodetect 2/3 buttons,wheel unused",
+   {"imps2","For the Microsoft IntelliMouse on a PS/2 port (round\n"
+            "                     connector with 6 pins), 3 buttons (wheel is repeated).",
            "", M_imps2, I_imps2, STD_FLG,
                                 {0xC0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, R_imps2},
-   {"logi", "Used in some Logitech devices (only serial).",
+   {"logi", "For old serial Logitech mice.",
            "Logitech", M_logi, I_logi, CS8 | CSTOPB | STD_FLG,
                                 {0xe0, 0x80, 0x80, 0x00}, 3, 3, 0, 0, 0},
-   {"logim",  "Turn logitech into Mouse-Systems-Compatible.",
+   {"logim",  "For turning on the MouseSystems compatible mode (3 buttons)\n"
+              "                     of some Logitech mice",
            "", M_logimsc, I_serial, CS8 | CSTOPB | STD_FLG,
                                 {0xf8, 0x80, 0x00, 0x00}, 5, 1, 0, 0, 0},
    {"mm",   "MM series. Probably an old protocol...",
            "MMSeries", M_mm, I_serial, CS8 | PARENB|PARODD | STD_FLG,
                                 {0xe0, 0x80, 0x80, 0x00}, 3, 1, 0, 0, 0},
-   {"ms3", "Microsoft Intellimouse (serial) - 3 buttons, wheel unused",
+   {"ms3", "For the Microsoft Intellimouse (serial), 3 buttons (wheel is repeated).",
            "", M_ms3, I_pnp, CS7 | STD_FLG,
                                 {0xc0, 0x40, 0xc0, 0x00}, 4, 1, 0, 0, R_ms3},
    {"ms+", "Like 'ms', but allows dragging with the middle button.",
@@ -2440,37 +2446,40 @@
    {"ms+lr", "'ms+', but you can reset m by pressing lr (see man page).",
            "", M_ms_plus_lr, I_serial, CS7 | STD_FLG,
                                 {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0},
-   {"msc",  "Mouse-Systems-Compatible (5bytes). Most 3-button mice.",
+   {"msc",  "For most 3 button serial mice.",
            "MouseSystems", M_msc, I_serial, CS8 | CSTOPB | STD_FLG,
                                 {0xf8, 0x80, 0x00, 0x00}, 5, 1, 0, 0, R_msc},
-   {"mtouch",  "MicroTouch touch-screens (only button-1 events, by now)",
+   {"mtouch",  "For MicroTouch touch-screens (only button-1 events right now)",
            "", M_mtouch, I_mtouch, STD_FLG,
                                 {0x80, 0x80, 0x80, 0x00}, 5, 1, 0, 1, NULL}, 
    {"ncr",  "Ncr3125pen, found on some laptops",
            "", M_ncr, NULL, STD_FLG,
                                 {0x08, 0x08, 0x00, 0x00}, 7, 7, 0, 1, 0},
-   {"netmouse","Genius NetMouse (ps2) - 2 buttons and 2 buttons 'up'/'down'.", 
+   {"netmouse","For the 'Genius NetMouse'. This one has two normal buttons plus\n"
+               "                     'up'/'down' buttons.",
            "", M_netmouse, I_netmouse, CS7 | STD_FLG,
                                 {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0},
-   {"pnp",  "Plug and pray. New mice may not run with '-t ms'.",
+   {"pnp",  "For the new 'plug and play' mice produced by Microsoft.\n"
+            "                     Try it if '-t ms' does not work.",
            "", M_bare, I_pnp, CS7 | STD_FLG,
                                 {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0},
-   {"ps2",  "Busmice of the ps/2 series. Most busmice, actually.",
+   {"ps2",  "For most busmice connected to a PS/2 port (round with 6 metal\n"
+            "                     pins).",
            "PS/2", M_ps2, I_ps2, STD_FLG,
                                 {0xc0, 0x00, 0x00, 0x00}, 3, 1, 0, 0, R_ps2},
-   {"sun",  "'msc' protocol, but only 3 bytes per packet.",
+   {"sun",  "For Sun (Sparc) mice.",
            "", M_sun, I_serial, CS8 | CSTOPB | STD_FLG,
                                 {0xf8, 0x80, 0x00, 0x00}, 3, 1, 0, 0, R_sun},
-   {"summa",  "Summagraphics or Genius tablet absolute mode(MM-Series)",
+   {"summa",  "For a Summa/Genius tablet in absolute mode (906, 1212B, EasyPainter...)",
            "", M_summa, I_summa, STD_FLG,
                                 {0x80, 0x80, 0x00, 0x00}, 5, 1, 0, 1, R_summa},
-   {"syn", "The \"Synaptics\" serial TouchPad.",
+   {"syn", "For the 'Synaptics' serial TouchPad.",
            "synaptics", M_synaptics_serial, I_serial, CS7 | STD_FLG,
                                 {0x40, 0x40, 0x40, 0x00}, 6, 6, 1, 0, 0},
-   {"synps2", "The \"Synaptics\" PS/2 TouchPad",
+   {"synps2", "For the 'Synaptics' PS/2 TouchPad",
            "synaptics_ps2", M_synaptics_ps2, I_synps2, STD_FLG,
                                 {0x80, 0x80, 0x00, 0x00}, 6, 1, 1, 0, 0},
-   {"twid", "Twidddler keyboard",
+   {"twid", "For the 'Twidddler' keyboard.",
            "", M_twid, I_twid, CS8 | STD_FLG,
                                 {0x80, 0x00, 0x80, 0x80}, 5, 1, 0, 0, 0},
    {"vsxxxaa", "The DEC VSXXX-AA/GA serial mouse on DEC workstations.",
@@ -2490,7 +2499,7 @@
 /*------------------------------------------------------------------------*/
 /* and the help */
 
-int M_listTypes(void)
+int M_listMice(void)
 {
    Gpm_Type *type;
 
@@ -2505,6 +2514,20 @@
    return 1; /* to exit() */
 }
 
+int M_listTypes(void)
+{
+  Gpm_Type *type;
+
+  /* Only print the mouse mnemonics so that it is easy to parse */
+  for (type = mice; type->fun; type++)
+  {
+    puts(type->name);
+    if (type->synonyms[0] != '\0')
+      puts(type->synonyms);
+  }
+  return 1;
+}
+
 /* indent: use three spaces. no tab. not two or four. three */
 
 /* Local Variables: */
--- a/src/daemon/startup.c
+++ b/src/daemon/startup.c
@@ -106,7 +106,7 @@
       /* look for the mouse type */
       (which_mouse->m_type) = find_mouse_by_name((which_mouse->opt_type));
       if (!(which_mouse->m_type)) /* not found */
-         exit(M_listTypes());
+         exit(M_listMice());
    }
 
    /* Check repeater status */
--- a/src/daemon/add_mouse.c
+++ b/src/daemon/add_mouse.c
@@ -86,6 +86,7 @@
       /*---------------------------------------------------------------------*/
 
       case GPM_ADD_TYPE:
+         if (!strcmp(value, "types")) exit(M_listTypes());
          if(option.micelist == NULL) gpm_report(GPM_PR_OOPS,GPM_MESS_FIRST_DEV);
          
          /* skip to next mouse, where either device or protocol is missing */
