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

Re: Mouse problem



On Saturday February 26 2005 19:35, alexandar_angelov wrote:
> I have Trust 3011A Wireless optical deskset mouse and
> keybord and use Debian  sarge.  I tried in XF86Config-4
> [...]
> but xev did't react when I press the additional sided
> buttons

I have experienced something similar with a Logitech MX501. It seems like some 
mice map their buttons to something that XFree doesn't understand, like a 
high number. The ExplorerPS/2 protocol only supports mouse buttons up to 
number 7 or 8 (it is the protocol with the highest number of buttons 
supported on x86 Linux) and either ignores higher numbers or maps them to 
something lower. The result is somewhat unpredictable.

If xev doesn't even catch those events, it means that this is the situation 
you're facing and there doesn't seem to be a lot you can do but hope and pray 
that the existing USB HID driver is made to work with Linux's input system at 
some time.

I'll attach a small C program that you can run to see if the kernel's input 
system recognizes the button. All it does is print a line (of nonsense) to 
the console for every mouse event. This includes movement, so make sure 
you're holding still while pressing buttons. It is best run from a pure text 
terminal without a running X server or gpm.

Compile it with: gcc -o inputdump inputdump.c
Run as root (permissions of /dev/input/* are restrictive):
  ./inputdump /dev/input/<inputdevice>

DISCLAIMER: This is just a quick hack. I did not build in any nasties, but it 
is still possible that there's something horribly wrong with it. Use it on 
your own risk, no warranty, no guarantee, ...

-- 
Got Backup?

Jabber: Shadowdancer at jabber.fsinf.de
#include <stdlib.h>
#include <stdio.h>
#include <linux/input.h>
#include <sys/types.h>
#include <sys/select.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>

int done;

void breakhandler( int n ) {
  done = 1;
}

int main( int argc, char** argv ) {
  struct input_event ievent;
  struct timeval tv;
  int efhandle;
  fd_set rdset;

  done = 0;
  
  if( argc <= 1 ) {
    printf( "Need an argument!\n" );
    exit( 1 );
  }
  
  signal( SIGINT, breakhandler );
  efhandle = open( argv[1], O_RDONLY | O_NONBLOCK );
  
  if( efhandle < 0 ) {
    printf( "Unable to open event device!\n" );
    exit( 1 );
  }
  
  FD_ZERO( &rdset );
  FD_SET( efhandle, &rdset );
  tv.tv_sec = 1;
  tv.tv_usec = 0;
  
  while( select( efhandle+1, &rdset, NULL, NULL, &tv ) >= 0 ) {  
    while( read( efhandle, &ievent, sizeof( struct input_event ) ) > 0 ) {
      printf( "Input: type = %d, code = %d, value = %d\n", ievent.type, ievent.code, ievent.value );
    }
    
    if( done ) break;
    
    FD_ZERO( &rdset );
    FD_SET( efhandle, &rdset );
    tv.tv_sec = 1;
    tv.tv_usec = 0;
  }
  
  close( efhandle );
  signal( SIGINT, SIG_DFL );
  
  printf( "Regular exit.\n" );
  exit( 0 );
}

Attachment: pgp_blQ2GA9OQ.pgp
Description: PGP signature


Reply to: