Hi,

I just did quick hack to enable 2 things:
 * Enable flexible device name
 * Enable DEBUG LEVEL change withiut recompile

I am not C coder so please think this patch as just my thought
expression which requires rewrite.  So far it works for me.

SYNOPSIS
       tpconfig [123] [/dev/mouse] [ OPTIONS ]

I will file updated version on Debian with manual page updates etc for
Debian package.

Osamu

diff -Nru tpconfig-3.1.3-orig/tpconfig.c tpconfig-3.1.3/tpconfig.c
--- tpconfig-3.1.3-orig/tpconfig.c      2005-04-08 02:20:18.000000000 +0200
+++ tpconfig-3.1.3/tpconfig.c   2005-04-08 01:40:25.000000000 +0200
@@ -9,8 +9,11 @@
 
 
 /*$Log: tpconfig.c,v $
+ *Revision 2.13.1  2005-04-08T00:21:38 CEST osamu
+ *Added DEBUG and device name
+ *
  *Revision 2.13  2002/02/22 20:33:11  bruce
- *Aded for Mode 3 and Mode 4 options.
+ *Added for Mode 3 and Mode 4 options.
  *
  *Revision 2.12  2000/11/15 15:37:50  bruce
  *Added back in copyright call().
@@ -115,6 +118,7 @@
 extern int is_Synaptics(int fd);
 
 int DEBUG_LEVEL;
+char mousedev[128] = "/dev/psaux";
 int silent;
 float firmware_rev;
 char single_mode_byte;
@@ -126,26 +130,30 @@
 int status;
 if (*fd<0)
   {
-  *fd = open("/dev/psaux", O_RDWR|O_NDELAY);
+  if (DEBUG_LEVEL) printf ("Probing mouse port at '%s'\n", mousedev);
+  *fd = open(mousedev, O_RDWR|O_NDELAY);
   if (*fd < 0)
-    fatal("Could not open PS/2 Port [/dev/psaux]");
+    fatal("Could not open PS/2 PortPort.");
 #ifdef __linux
   /* If AUX_GRAB kernel patch present, use it. */
+  if (DEBUG_LEVEL) printf ("Grabing mouse port at '%s'\n", mousedev);
   while (ioctl (*fd, AUX_GRAB, 0) < 0)
     {
       if (errno == ENOTTY)
        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) printf ("Trying Synaptics detection.\n");
   if (!is_Synaptics(*fd))
     {
+    if (DEBUG_LEVEL) printf ("Trying Alps detection.\n");
     status = is_ALPS(*fd);
     if(status == 0)
       {
@@ -181,6 +189,7 @@
 int fd = -1;
 int c = 0;
 int option_index = 0;
+int i;
 
 silent = 0;
 firmware_rev = 0.0;
@@ -208,6 +217,23 @@
     return (0);
   }
 
+while (argc > 0)
+  {
+    if (argv[1][0] == '0') DEBUG_LEVEL = 0;
+    else if (argv[1][0] == '1') DEBUG_LEVEL = 1;
+    else if (argv[1][0] == '2') DEBUG_LEVEL = 2;
+    else if (argv[1][0] == '3') DEBUG_LEVEL = 3;
+    else if (strncmp (argv[1], "/dev/", 5) == 0) strncpy (mousedev, argv[1], 
127);
+    else break;
+    /* shift */
+    printf ("DEBUG: %i, mousedev='%s'\n", DEBUG_LEVEL, mousedev);
+    argc--;
+    for (i=1; i<argc; i++) 
+      {
+        argv[i]=argv[i+1];
+      }
+  }
+
 /* Open file descriptor and determine if we are connected to a touchpad */
 init_fd(&fd);
 

Attachment: signature.asc
Description: Digital signature

Reply via email to