[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

tpconfig in 10th day



Hi,

Freeze was just on time to  stop the latest tpconfig to go into testing.

This is the 2nd updates on package tpconfig.

As documented in changelog by Chris Hanson:
   * New maintainer: Osamu Aoki <osamu@debian.org>.  Remaining changes are
     his, with review by me.
   * Make target device and debug mode configurable from command
     line arguments.  (closes: Bug#237984, #139640)
   * Reduce amount of debugging info generated when DEBUG_LEVEL is low.

This maintainer change to me from previous Chris Hanson was the result
of our cooperation for recent package updates.  The original concept
code was written by me but actual code update was by Chris.

The device name is copied with strncpy to be secure.  This is meant to
help people to try using this under devfs and udev which was a major
complain to this package.

Other than adding above commandline option, nothing which affects
operation of binary package is done.   (Error comment reformatings to
unify output styles are quite safe one, I think.)

The intent of this update is to help people to identify issues without
recompiling with DEBUG mode and try different device names.

Here is diff between testing and unstable:

diff -Nru testing/tpconfig-3.1.3/ALPS.c unstable/tpconfig-3.1.3/ALPS.c
--- testing/tpconfig-3.1.3/ALPS.c	2005-05-04 08:40:23.000000000 +0200
+++ unstable/tpconfig-3.1.3/ALPS.c	2005-05-04 07:46:13.000000000 +0200
@@ -80,8 +80,8 @@
   putbyte(fd,c);
   }
 c = 0xe9;
-if(DEBUG_LEVEL)
-  printf("Writing [%x]\n",c);
+if(DEBUG_LEVEL > DEBUG_LOW)
+  printf("Writing [%#04x]\n",c);
 num_written = ps2_write(fd,&c,1);
 if(num_written != 1)
   {
@@ -97,10 +97,10 @@
 
 /* resend enable command for xmission of external mouse data */
 c = 0xf4;
-if(DEBUG_LEVEL)
+if(DEBUG_LEVEL > DEBUG_LOW)
   {
   printf("Resending Enable command\n");
-  printf("Writing [%x]\n",c);
+  printf("Writing [%#04x]\n",c);
   }
 num_written = ps2_write(fd,&c,1);
 if(num_written != 1)
@@ -108,12 +108,12 @@
   fprintf(stderr,"Error writing byte\n");
   return(0);
   }
-if(DEBUG_LEVEL)
+if(DEBUG_LEVEL > DEBUG_LOW)
   {
-  printf("Response 0 [%x]\n",status[0]);
-  printf("Response 1 [%x]\n",status[1]);
-  printf("Response 2 [%x]\n",status[2]);
-  printf("Response 3 [%x]\n",status[3]);
+  printf("Response 0 [%#04x]\n",status[0]);
+  printf("Response 1 [%#04x]\n",status[1]);
+  printf("Response 2 [%#04x]\n",status[2]);
+  printf("Response 3 [%#04x]\n",status[3]);
   }
 return(!ERROR);
 } /* ALPS_status */
@@ -124,7 +124,7 @@
 int tap_on = TRUE;
 int error;
 
-if(DEBUG_LEVEL)
+if(DEBUG_LEVEL > DEBUG_LOW)
   printf("\n\nChecking Whether ALPS Tap status is enabled or disabled\n");
 
 
@@ -148,7 +148,7 @@
   }
 
 
-if(DEBUG_LEVEL)
+if(DEBUG_LEVEL > DEBUG_LOW)
   {
   if(tap_on)
     printf("Done Checking Status of Tap Enabled/Disable, Tap is ON \n");
@@ -165,8 +165,8 @@
 int num_written;
 
 c = 0xff;
-if(DEBUG_LEVEL)
-  printf("\nWriting Reset [%x], Reading Nothing\n",(int)c);
+if(DEBUG_LEVEL > DEBUG_LOW)
+  printf("\nWriting Reset [%#04x], Reading Nothing\n",(int)c);
 num_written = ps2_write(fd,&c,1);
 if(num_written != 1)
   {
@@ -182,7 +182,7 @@
 { /* ALPS_SP_tap */
 byte c;
 int i;
-if(DEBUG_LEVEL)
+if(DEBUG_LEVEL > DEBUG_LOW)
   {
   if(enable)
     printf("\n\nEnabling SP tap\n");
@@ -203,7 +203,7 @@
   c = 0x0a;
 
 putbyte(fd,c);
-if(DEBUG_LEVEL)
+if(DEBUG_LEVEL > DEBUG_LOW)
   printf("Done Enabling/Disabling SP tap\n");
 return(!ERROR);
 } /* ALPS_SP_tap */
@@ -213,7 +213,7 @@
 { /* ALPS_through_mode */
 byte c;
 int i;
-if(DEBUG_LEVEL)
+if(DEBUG_LEVEL > DEBUG_LOW)
   {
   if(set)
     printf("\n\nEnabling ALPS_through_mode\n");
@@ -235,7 +235,7 @@
 
 /* We may receive 3 more bytes, ignore them */
 tcflush(fd,TCIOFLUSH);
-if(DEBUG_LEVEL)
+if(DEBUG_LEVEL > DEBUG_LOW)
   {
   if(set)
     printf("Done Enabling ALPS_through_mode\n\n\n");
@@ -255,7 +255,7 @@
 int num_written;
 int error;
 
-if(DEBUG_LEVEL)
+if(DEBUG_LEVEL > DEBUG_LOW)
   {
   if(enable)
     printf("\n\nEnabling GP tap\n");
@@ -274,22 +274,22 @@
   }
 
 c = 0xE9;
-if(DEBUG_LEVEL)
-  printf("Writing Initial [%x]\n",(int)c);
+if(DEBUG_LEVEL > DEBUG_LOW)
+  printf("Writing Initial [%#04x]\n",(int)c);
 num_written = ps2_write(fd,&c,1);
 num_read = ps2_read(fd,response,4);
-if(DEBUG_LEVEL)
+if(DEBUG_LEVEL > DEBUG_LOW)
   {
   printf("Just Read num = [%d] bytes",num_read);
   printf("\n");
   }
 if((num_read != 4) || (response[0] != AUX_ACK))
     {
-    printf("-----> Invalid response from Alps Glidepad/Glidepoint [%x] \n",(int)response[0]);
+    printf("-----> Invalid response from Alps Glidepad/Glidepoint [%#04x] \n",(int)response[0]);
     return(ERROR);
     }
-if(DEBUG_LEVEL)
-  printf("Current Settings [%x] [%x] [%x]\n",response[1],response[2],response[3]);
+if(DEBUG_LEVEL > DEBUG_LOW)
+  printf("Current Settings [%#04x] [%#04x] [%#04x]\n",response[1],response[2],response[3]);
 
 for(i = 0;i < 2;i++)
   {
@@ -299,13 +299,13 @@
 
 if(enable)
   {
-  if(DEBUG_LEVEL)
+  if(DEBUG_LEVEL > DEBUG_LOW)
     printf("Enabling Tap\n");
   c = 0xF3;
   }
 else
   {
-  if(DEBUG_LEVEL)
+  if(DEBUG_LEVEL > DEBUG_LOW)
     printf("Disabling Tap\n");
   c = 0xE8;
   }
@@ -372,8 +372,8 @@
   putbyte(fd,c);
   }
 c = 0xe9;
-if(DEBUG_LEVEL)
-  printf("Writing Initial [%x] in is_ALPS\n",(int)c);
+if(DEBUG_LEVEL > DEBUG_LOW)
+  printf("Writing Initial [%#04x] in is_ALPS\n",(int)c);
 num_written = ps2_write(fd,&c,1);
 if(num_written != 1)
   {
@@ -387,8 +387,8 @@
   return(0);
   }
 
-if(DEBUG_LEVEL)
-  printf("ALPS Configuration Info [%2x][%2x][%2x]\n",response[1],response[2],response[3]);
+if(DEBUG_LEVEL > DEBUG_LOW)
+  printf("ALPS Configuration Info [%#04x][%#04x][%#04x]\n",response[1],response[2],response[3]);
 
 return_value = 0;
 for(i = 0;i < NUM_SINGLES;i++)
@@ -426,7 +426,7 @@
   { 
   if(!tap_on)
     { /* reset tap_on to off since we just had to do a reset */
-    if(DEBUG_LEVEL)
+    if(DEBUG_LEVEL > DEBUG_LOW)
       printf("Turning ALPS Tap Back OFF\n");
     if(touchpad_type == ALPS_STICKPOINTER_AND_GLIDEPOINT)
       {
@@ -453,8 +453,10 @@
 	  "                                   0 = tapping off\n"
 	  "                                   1 = tapping on\n"
 	  "  -r, --reset                   reset ALPS device\n"
-	  "      --help                    display this help and exit\n"
-	  "      --version                 output version information\n"
+	  "  -h, --help                    display this help and exit\n"
+	  "  -v, --version                 output version information\n"
+	  "  -D, --debug=[0-3]             generate debug output\n"
+	  "  -d, --device=DEVICE           use alternate device file\n"
 	  "\n");
 }
 
@@ -494,11 +496,11 @@
                 else
                   {
   	          mode = optarg[0]-'0';
-                  if(DEBUG_LEVEL)
+                  if(DEBUG_LEVEL > DEBUG_LOW)
                     printf("User Asked to set Tap mode to [%d]\n",mode);
                   if(mode > 0)
                     {
-                    if(DEBUG_LEVEL)
+                    if(DEBUG_LEVEL > DEBUG_LOW)
                       printf("Turning ALPS Tap ON\n");
                     if(touchpad_type == ALPS_STICKPOINTER_AND_GLIDEPOINT)
                       {
@@ -510,7 +512,7 @@
                     }
                   else
                     { /* disable tap mode */
-                    if(DEBUG_LEVEL)
+                    if(DEBUG_LEVEL > DEBUG_LOW)
                       printf("Turning ALPS Tap OFF\n");
                     if(touchpad_type == ALPS_STICKPOINTER_AND_GLIDEPOINT)
                       {
diff -Nru testing/tpconfig-3.1.3/debian/changelog unstable/tpconfig-3.1.3/debian/changelog
--- testing/tpconfig-3.1.3/debian/changelog	2005-05-04 08:40:23.000000000 +0200
+++ unstable/tpconfig-3.1.3/debian/changelog	2005-05-04 07:46:13.000000000 +0200
@@ -1,3 +1,13 @@
+tpconfig (3.1.3-7) unstable; urgency=low
+
+  * New maintainer: Osamu Aoki <osamu@debian.org>.  Remaining changes are
+    his, with review by me.
+  * Make target device and debug mode configurable from command
+    line arguments.  (closes: Bug#237984, #139640)
+  * Reduce amount of debugging info generated when DEBUG_LEVEL is low.
+
+ -- Chris Hanson <cph@debian.org>  Fri, 22 Apr 2005 01:09:41 -0400
+
 tpconfig (3.1.3-6) unstable; urgency=low
 
   From Osamu Aoki <osamu@debian.org>:
diff -Nru testing/tpconfig-3.1.3/debian/control unstable/tpconfig-3.1.3/debian/control
--- testing/tpconfig-3.1.3/debian/control	2005-05-04 08:40:23.000000000 +0200
+++ unstable/tpconfig-3.1.3/debian/control	2005-05-04 07:46:13.000000000 +0200
@@ -1,7 +1,8 @@
 Source: tpconfig
 Section: utils
 Priority: optional
-Maintainer: Chris Hanson <cph@debian.org>
+Maintainer: Osamu Aoki <osamu@debian.org>
+Uploaders: Chris Hanson <cph@debian.org>
 Build-Depends: debhelper (>= 4.1.16)
 Standards-Version: 3.6.1
 
diff -Nru testing/tpconfig-3.1.3/debian/README.Debian unstable/tpconfig-3.1.3/debian/README.Debian
--- testing/tpconfig-3.1.3/debian/README.Debian	2005-05-04 08:40:23.000000000 +0200
+++ unstable/tpconfig-3.1.3/debian/README.Debian	2005-05-04 07:46:13.000000000 +0200
@@ -2,19 +2,22 @@
 
 Older kernels may require a patch to make tpconfig to work properly.
 Some examples are included here.  Debian sarge should not have issues
-with its 2.4 kernel but, if you chose to install a 2.6 kernel, you may
-encounter problem since sarge uses buggy 2.6.8 (This is true as of
-debian installer RC3, March 2005).  You should use a kernel newer than
-2.6.11.  There may still be more fixes even after this kernel version.
-
-The device name /dev/psaux is hard coded to tpconfig currently.  This
-means tpconfig will not work under the deprecated devfs system in
-which /dev/misc/psaux is used as the PS/2 mouse device name, or under
-unusual udev setups in which devfs-like device names are used.
-Classic device naming or normal udev naming should not cause any
-problem.
+with its 2.4 kernel but if you choose to install a 2.6 kernel you may
+encounter problems.  (As of debian installer RC3, March 2005, sarge
+uses 2.6.8 which has buggy support.)  You should use a kernel newer
+than 2.6.11, but even newer versions are known to have some issues.
 
-USB touch pads aren't currently supported.
+If you want to use a mouse device name other than "/dev/psaux", use
+the "--device" option.  This should enable device names such
+"/dev/misc/psaux" etc. and hopefully should support devices like USB
+touch pads.
 
-  Osamu Aoki <osamu@debian.org>  Wed, 30 Mar 2005 23:47:18 +0200
+ $ sudo tpconfig --device=/dev/misc/psaux -i
+
+If you face difficulty running tpconfig, please use the "--debug"
+option to get diagnostic info.
+
+ $ sudo tpconfig --debug=3 -i
+
+  Osamu Aoki <osamu@debian.org>  Fri, 08 Apr 2005 02:27:19 +0200
   Chris Hanson <cph@debian.org>  Thu, 31 Mar 2005 15:14:52 -0500
diff -Nru testing/tpconfig-3.1.3/debian/tpconfig.1 unstable/tpconfig-3.1.3/debian/tpconfig.1
--- testing/tpconfig-3.1.3/debian/tpconfig.1	2005-05-04 08:40:23.000000000 +0200
+++ unstable/tpconfig-3.1.3/debian/tpconfig.1	2005-05-04 07:46:13.000000000 +0200
@@ -1,4 +1,4 @@
-.TH "tpconfig" "1" "3.1.2" "" ""
+.TH "tpconfig" "1" "3.1.3" "" ""
 .SH "NAME"
 .LP 
 tpconfig \- Configure touchpad devices
@@ -18,6 +18,15 @@
 \fB--help\fP
 Display a help summary and exit.
 .TP
+\fB-D\fP [\fIN\fP], \fB--debug\fP[=\fIN\fP]
+Generate debugging output, where \fIN\fP of 1, 2, or 3 specifies the
+debugging level.  If \fIN\fP is 0, debugging is turned off.  If
+\fIN\fP is not given, it defaults to 1.
+.TP
+\fB-d\fP \fIDEVICE\fP, \fB--debug\fP=\fIDEVICE\fP
+Use \fIDEVICE\fP as the device file for the mouse.  If this option
+isn't given, the device file /dev/psaux is used.
+.TP
 \fB--version\fP
 Display the version and copyright information and exit.
 .TP
diff -Nru testing/tpconfig-3.1.3/synaptics.c unstable/tpconfig-3.1.3/synaptics.c
--- testing/tpconfig-3.1.3/synaptics.c	2005-05-04 08:40:23.000000000 +0200
+++ unstable/tpconfig-3.1.3/synaptics.c	2005-05-04 07:46:13.000000000 +0200
@@ -239,8 +239,10 @@
     }
   printf
     ("\n"
-     "      --help                    display this help and exit\n"
-     "      --version                 output version information\n"
+     "  -h, --help                    display this help and exit\n"
+     "  -v, --version                 output version information\n"
+     "  -D, --debug=[0-3]             generate debug output\n"
+     "  -d, --device=DEVICE           use alternate device file\n"
      "\n");
 }
 
@@ -278,7 +280,7 @@
 static void
 set_modes (int fd, unsigned int modes)
 {
-  if (DEBUG_LEVEL)
+  if (DEBUG_LEVEL > DEBUG_LOW)
     fprintf (stderr, "[set modes: %#02x]\n", modes);
   if (single_mode_byte)
     {
@@ -314,7 +316,9 @@
 {
   byte b1, b2, b3;
   status_rqst (fd, STP_QRY_IDENTIFY, &b1, &b2, &b3);
-  assert (b2 == 0x47);
+  if (!ignore_selected_assertions)
+    /* Recent 2.6 kernels return 0x03 instead.  */
+    assert (b2 == 0x47 || b2 == 0x03);
   if (version_major) (*version_major) = (b3 & 0x0F);
   if (version_minor) (*version_minor) = b1;
   if (model_code)    (*model_code)    = ((b3 & 0xF0) >> 4);
@@ -326,10 +330,13 @@
   byte b1, b2, b3;
   byte b4, b5, b6;
   status_rqst (fd, STP_QRY_READ_MODES, &b1, &b2, &b3);
-  assert (b2 == 0x47);
+  if (!ignore_selected_assertions)
+    /* Recent 2.6 kernels return 0x03 instead.  */
+    assert (b2 == 0x47 || b2 == 0x03);
   if (single_mode_byte)
     {
-      assert (b1 == 0x3B);
+      if (!ignore_selected_assertions)
+	assert (b1 == 0x3B);
       return b3;
     }
   else
@@ -338,7 +345,9 @@
       if (fw_version < QUAD_MODE_BYTE)
 	{
 	  status_rqst (fd, STP_QRY_READ_CAPS, &b4, &b5, &b6);
-	  assert (b5 == 0x47);
+	  if (!ignore_selected_assertions)
+	    /* Recent 2.6 kernels return 0x03 instead.  */
+	    assert (b5 == 0x47 || b5 == 0x03);
 	  return ((unsigned int) b1 << 24) | ((unsigned int) b3 << 16) |
 	    ((unsigned int) b4 << 8) | (unsigned int) b6;
 	}
@@ -388,7 +397,8 @@
 {
   byte b1, b2, b3;
   status_rqst (fd, STP_QRY_READ_RES, &b1, &b2, &b3);
-  assert ((b2 & 0x80) != 0);
+  if (!ignore_selected_assertions)
+    assert ((b2 & 0x80) != 0);
   (*xres) = b1;
   (*yres) = b3;
 }
@@ -409,7 +419,8 @@
       b3 = getbyte (fd);
     }
 #endif
-  retval = (b2 == 0x47);
+  /* Recent 2.6 kernels return 0x03 instead.  */
+  retval = (b2 == 0x47 || b2 == 0x03);
   if (retval)
     {
       fw_version_major = (b3 & 0x0F);
diff -Nru testing/tpconfig-3.1.3/tpconfig.c unstable/tpconfig-3.1.3/tpconfig.c
--- testing/tpconfig-3.1.3/tpconfig.c	2005-05-04 08:40:23.000000000 +0200
+++ unstable/tpconfig-3.1.3/tpconfig.c	2005-05-04 07:46:13.000000000 +0200
@@ -115,6 +115,8 @@
 extern int is_Synaptics(int fd);
 
 int DEBUG_LEVEL;
+int ignore_selected_assertions;
+char mousedev[128] = "/dev/psaux";
 int silent;
 float firmware_rev;
 char single_mode_byte;
@@ -126,10 +128,17 @@
 int status;
 if (*fd<0)
   {
-  *fd = open("/dev/psaux", O_RDWR|O_NDELAY);
+  if (DEBUG_LEVEL)
+    fprintf (stderr, "Probing mouse port [%s]\n", mousedev);
+  *fd = open(mousedev, O_RDWR|O_NDELAY);
   if (*fd < 0)
-    fatal("Could not open PS/2 Port [/dev/psaux]");
+    {
+      fprintf(stderr, "Could not open PS/2 Port [%s].", mousedev);
+      exit (0);
+    }
 #ifdef __linux
+  if (DEBUG_LEVEL)
+    fprintf (stderr, "Grabbing mouse port [%s]\n", mousedev);
   /* If AUX_GRAB kernel patch present, use it. */
   while (ioctl (*fd, AUX_GRAB, 0) < 0)
     {
@@ -137,15 +146,19 @@
 	break;
       if (errno != EAGAIN)
 	{
-	  perror ("/dev/psaux");
+	  perror (mousedev);
 	  fatal ("Unable to get exclusive access to PS/2 Port.");
 	  exit (1);
 	}
     }
 #endif
   tcflush(*fd,TCIOFLUSH);
+  if (DEBUG_LEVEL)
+    fprintf (stderr, "Trying Synaptics detection.\n");
   if (!is_Synaptics(*fd))
     {
+    if (DEBUG_LEVEL)
+      fprintf (stderr, "Trying Alps detection.\n");
     status = is_ALPS(*fd);
     if(status == 0)
       {
@@ -191,22 +204,97 @@
 DEBUG_LEVEL = DEBUG_LOW;
 #endif
 
-if ((argc == 2)
-    && (((strcmp ((argv[1]), "--version")) == 0)
-	|| ((strcmp ((argv[1]), "-v")) == 0)))
+static struct option synaptics_long_options[] =
   {
-    copyright ();
-    return (0);
-  }
+    {"help",          no_argument, NULL, 'h'}, /* -h */
+    {"version",       no_argument, NULL, 'v'}, /* -v */
+    {"debug",         optional_argument, NULL, 'D'}, /* -D */
+    {"device",        required_argument, NULL, 'd'}, /* -d */
+    {"silent",        no_argument, NULL, 'q'}, /* -q */
+    {"quiet",         no_argument, NULL, 'q'}, /* -q */
+    {"info",          no_argument, NULL, 'i'}, /* -i */
+    {"reset",         no_argument, NULL, 'x'}, /* -x */
+    /* Mode 1 options */
+    {"zthreshold",    optional_argument, NULL, 'z'}, /* -z */
+    {"threshold",     optional_argument, NULL, 'z'}, /* -z */
+    {"corner",        optional_argument, NULL, 'c'}, /* -c */
+    {"tapmode",       optional_argument, NULL, 't'}, /* -t */
+    {"edgemode",      optional_argument, NULL, 'e'}, /* -e */
+    /* Mode 2 options */
+    {"absolute",      no_argument, NULL, 'A'},       /* similar to -a */
+    {"relative",      no_argument, NULL, 'R'},       /* similar to -a */
+    {"rate",          optional_argument, NULL, 'r'}, /* -r */
+    {"two-button",    no_argument, NULL, '2'},       /* -2 */
+    {"three-button",  no_argument, NULL, '3'},       /* -3 */
+    {"middle-button", no_argument, NULL, '<'},       /* similar to -m */
+    {"right-button",  no_argument, NULL, '>'},       /* similar to -m */
+    {"sleep",         optional_argument, NULL, 's'}, /* -s */
+    /* Mode 3 options */
+    {"right-margin",  optional_argument, NULL, '4'}, /* similar to -M */
+    {"left-margin",   optional_argument, NULL, '5'}, /* similar to -M */
+    /* Mode 4 options */
+    {"top-margin",    optional_argument, NULL, '6'}, /* similar to -M */
+    {"bottom-margin", optional_argument, NULL, '7'}, /* similar to -M */
+    {NULL,            no_argument, NULL, 0}
+  };
+const char * synaptics_short_options = "hvD::d:qizx::c::t::e::a::r::23m::s::M";
 
-if ((argc < 2) || ((argc == 2) && ((strcmp ((argv[1]), "--help")) == 0)))
+static struct option ALPS_long_options[] = 
   {
-    printf ("Usage: %s [OPTION]...\n", (argv[0]));
-    synaptics_usage ();
-    ALPS_usage ();
-    printf ("Report bugs to <kall@compass.com>\n");
-    return (0);
+    {"help",          no_argument, NULL, 'h'}, /* -h */
+    {"version",       no_argument, NULL, 'v'}, /* -v */
+    {"debug",         optional_argument, NULL, 'D'}, /* -D */
+    {"device",        required_argument, NULL, 'd'}, /* -d */
+    {"info",		no_argument, NULL, 'i'}, /* -i */
+    {"reset",         no_argument, NULL, 'x'}, /* -x */
+    {"tapmode",	optional_argument, NULL, 't'}, /* -t */
+    {NULL, 		no_argument, NULL, 0}
+  };
+
+/* Initial option processing to handle special options.  */
+optind = 1;
+while (1)
+  {
+    switch (getopt_long (argc, argv, synaptics_short_options,
+			 synaptics_long_options, &option_index))
+      {
+      case 'h':
+	printf ("Usage: %s [OPTION]...\n", (argv[0]));
+	synaptics_usage ();
+	ALPS_usage ();
+	printf ("Report bugs to <kall@compass.com>\n");
+	return (0);
+
+      case 'v':
+	copyright ();
+	return (0);
+
+      case 'D':
+	if (optarg == 0)
+	  DEBUG_LEVEL = DEBUG_LOW;
+	else if ((strcmp (optarg, "0")) == 0)
+	  DEBUG_LEVEL = DEBUG_NONE;
+	else if ((strcmp (optarg, "1")) == 0)
+	  DEBUG_LEVEL = DEBUG_LOW;
+	else if ((strcmp (optarg, "2")) == 0)
+	  DEBUG_LEVEL = DEBUG_MEDIUM;
+	else
+	  DEBUG_LEVEL = DEBUG_HIGH;
+	break;
+
+      case 'd':
+	strncpy (mousedev, optarg, ((sizeof (mousedev)) - 1));
+	break;
+
+      case -1:
+	goto initial_options_done;
+
+      default:
+	break;
+      }
   }
+initial_options_done:
+
 
 /* Open file descriptor and determine if we are connected to a touchpad */
 init_fd(&fd);
@@ -214,64 +302,37 @@
 if(touchpad_type == SYNAPTICS_TOUCHPAD)
   set_firmware_options(fd,stdout);
 
+optind = 1;
 opterr=1;
 while (1) 
   {
-  static struct option synaptics_long_options[] =
-    {
-      {"help",          no_argument, NULL, 'h'},
-      {"silent",        no_argument, NULL, 'q'}, /* -q */
-      {"quiet",         no_argument, NULL, 'q'}, /* -q */
-      {"info",          no_argument, NULL, 'i'}, /* -i */
-      {"reset",         no_argument, NULL, 'x'}, /* -x */
-      /* Mode 1 options */
-      {"zthreshold",    optional_argument, NULL, 'z'}, /* -z */
-      {"threshold",     optional_argument, NULL, 'z'}, /* -z */
-      {"corner",        optional_argument, NULL, 'c'}, /* -c */
-      {"tapmode",       optional_argument, NULL, 't'}, /* -t */
-      {"edgemode",      optional_argument, NULL, 'e'}, /* -e */
-      /* Mode 2 options */
-      {"absolute",      no_argument, NULL, 'A'},       /* similar to -a */
-      {"relative",      no_argument, NULL, 'R'},       /* similar to -a */
-      {"rate",          optional_argument, NULL, 'r'}, /* -r */
-      {"two-button",    no_argument, NULL, '2'},       /* -2 */
-      {"three-button",  no_argument, NULL, '3'},       /* -3 */
-      {"middle-button", no_argument, NULL, '<'},       /* similar to -m */
-      {"right-button",  no_argument, NULL, '>'},       /* similar to -m */
-      {"sleep",         optional_argument, NULL, 's'}, /* -s */
-      /* Mode 3 options */
-      {"right-margin",  optional_argument, NULL, '4'}, /* similar to -M */
-      {"left-margin",   optional_argument, NULL, '5'}, /* similar to -M */
-      /* Mode 4 options */
-      {"top-margin",    optional_argument, NULL, '6'}, /* similar to -M */
-      {"bottom-margin", optional_argument, NULL, '7'}, /* similar to -M */
-      {NULL,            no_argument, NULL, 0}
-    };
-
-  static struct option ALPS_long_options[] = 
-    {
-      {"help",		no_argument, NULL, 'h'},
-      {"info",		no_argument, NULL, 'i'}, /* -i */
-      {"reset",         no_argument, NULL, 'x'}, /* -x */
-      {"tapmode",	optional_argument, NULL, 't'}, /* -t */
-      {NULL, 		no_argument, NULL, 0}
-    };
-
   if(touchpad_type == SYNAPTICS_TOUCHPAD)
-    c = getopt_long (argc, argv, "qivzx::c::t::e::a::r::23m::s::M",
+    c = getopt_long (argc, argv, synaptics_short_options,
       synaptics_long_options, &option_index);
   else if((touchpad_type == ALPS_STICKPOINTER_AND_GLIDEPOINT) || (touchpad_type == ALPS_GLIDEPAD))
-    c = getopt_long (argc, argv, "hirtv",
+    c = getopt_long (argc, argv, "hvD::d:irt",
       ALPS_long_options, &option_index);
 
-  if (c == -1)
-    break;
-  
-  if(touchpad_type == SYNAPTICS_TOUCHPAD)
-    synaptics_functions(c,fd,argv);
-  else if((touchpad_type == ALPS_STICKPOINTER_AND_GLIDEPOINT) || (touchpad_type == ALPS_GLIDEPAD))
-    alps_functions(c,fd,argv);
+  switch (c)
+    {
+    case 'h':
+    case 'v':
+    case 'D':
+    case 'd':
+      break;
+
+    case -1:
+      goto options_done;
+
+    default:
+      if (touchpad_type == SYNAPTICS_TOUCHPAD)
+	synaptics_functions (c, fd, argv);
+      else if ((touchpad_type == ALPS_STICKPOINTER_AND_GLIDEPOINT)
+	       || (touchpad_type == ALPS_GLIDEPAD))
+	alps_functions (c, fd, argv);
+    }
   }
+options_done:
 if (optind < argc) 
   {
   fprintf(stderr, "Extra options: ");
diff -Nru testing/tpconfig-3.1.3/tpconfig.h unstable/tpconfig-3.1.3/tpconfig.h
--- testing/tpconfig-3.1.3/tpconfig.h	2000-12-01 16:29:47.000000000 +0100
+++ unstable/tpconfig-3.1.3/tpconfig.h	2005-05-04 07:46:13.000000000 +0200
@@ -73,6 +73,7 @@
 typedef unsigned char byte;
 
 extern int DEBUG_LEVEL;
+extern int ignore_selected_assertions;
 extern int silent;
 extern float firmware_rev;
 extern char single_mode_byte;
diff -Nru testing/tpconfig-3.1.3/utils.c unstable/tpconfig-3.1.3/utils.c
--- testing/tpconfig-3.1.3/utils.c	2005-05-04 08:40:23.000000000 +0200
+++ unstable/tpconfig-3.1.3/utils.c	2005-05-04 07:46:13.000000000 +0200
@@ -98,7 +98,7 @@
   {
     fprintf (stderr, "PS2_write:");
     for (i = 0; i < num_bytes; i++)
-      fprintf (stderr, " %#2x", *(buffer + i));
+      fprintf (stderr, " %#02x", *(buffer + i));
     fprintf (stderr, "\n");
   }
 
@@ -218,6 +218,7 @@
     fprintf (stderr, "Read %#02x, expected %#02x in %s.\n", b, expected, what);
 #if 0
   /* Upstream recommends commenting this out for 2.6 kernels.  */
-  assert (b == expected);
+  if (!ignore_selected_assertions)
+    assert (b == expected);
 #endif
 }



Reply to: