[gpm] gpm_open fails

Amaresh Ram Amaresh.Ram@lntinfotech.com
Tue Mar 11 05:39:11 CET 2008


Rodney,

Thanks for the reply.

1. return code of Gpm_Open is -1 only but when we print the error code
using perror is display "Invalid Argument".
2. Mouse type is same at all system.
3. I don't understand the your third point.


Meanwhile I have resolved this issues by commenting out the below code of
Gpm_Open in liblow.c.
#if 0
         /* do we really need this check ? */
         if(strncmp(tty,consolename,strlen(consolename)-1)
            || !isdigit(tty[strlen(consolename)-1])) {
            gpm_report(GPM_PR_ERR,"strncmp/isdigit/consolename failed");
            goto err;
         }
#endif

On my platform tty is /dev/console while consolename is /dev/vc/0.

I don't whether my solution is correct but it works now.

regards/Amaresh



                                                                           
             "Rod Berriman"                                                
             <rod@optimail.com                                             
             .au>                                                       To 
             Sent by:                  gpm@lists.linux.it                  
             gpm-bounces+amare                                          cc 
             sh.ram=lntinfotec                                             
             h.com@lists.linux                                     Subject 
             .it                       Re: [gpm] gpm_open fails            
                                                                           
                                                                           
             03/11/2008 09:33                                              
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
             rod@optimail.com.                                             
                    au                                                     
                                                                           
                                                                           




Amaresh,

 1: I'm not clear what you mean by "invalid argument" error code.
 Your code only tests for return of -1, cannot connect:
           if(Gpm_Open(&conn, 0) == -1) ...
 Have you got some other code looking for other errors?

 What is the numeric value of the return code?

 2: Is the mouse type the same on both systems?
 Maybe exps2 is not appropriate on the other system.

 3: Are you running xterm on one system, and console terminal on another?
   return value of -2 is not an error, but an indication of xterm.

regards,
Rodney

Amaresh wrote:
Hi,

I am trying to receive mouse event using libgpm library. I have run the GPM
server as
%gpm -m /dev/input/mice -t exps2

The I am trying to open connection with GPM Server using Gpm_open function.
Gpm_open always fails with invalid argument as error code.

Code Snippets:
/****************************************************************************************************/

#include <stdio.h>
#include <gpm.h>

int my_handler(Gpm_Event *event, void *data)
{       printf("Event Type : %d at x=%d y=%d\n", event->type, event->x,
event->y);
        return 0;
}
int main()
{       Gpm_Connect conn;
        int c;
        conn.eventMask  = ~0;   /* Want to know about all the events */
        conn.defaultMask = 0;   /* don't handle anything by default  */
        conn.minMod     = 0;    /* want everything                   */
        conn.maxMod     = ~0;   /* all modifiers included            */

        if(Gpm_Open(&conn, 0) == -1)
        {
                perror("Cannot connect to mouse server\n");
                return 0;
        }

        gpm_handler = my_handler;
        while((c = Gpm_Getc(stdin)) != EOF)
                printf("%c", c);
        Gpm_Close();
        return 0;
}
/****************************************************************************************************/


I am using GPM version 1.19.6. The above code is working on one of my
server but throwing error on another.
Can some one help me to resolve the issues?


_______________________________________________
gpm mailing list
gpm@lists.linux.it
http://lists.linux.it/listinfo/gpm

______________________________________________________________________



______________________________________________________________________


More information about the gpm mailing list