How to use mouse on pc386 bsp?

Jose Alves josealves at HotPOP.com
Wed Oct 30 21:47:09 UTC 2002


I'm trying use the mouse driver in the pc386 bsp.
I have:

////////////////////////////////////////////////////////////////////////////////

/* List of device drivers loaded by RTEMS at boot time */
rtems_driver_address_table Device_drivers[] = 
{
  CONSOLE_DRIVER_TABLE_ENTRY,
  CLOCK_DRIVER_TABLE_ENTRY,

  SERIAL_MOUSE_DRIVER_TABLE_ENTRY,
};

////////////////////////////////////////////////////////////////////////////////

void GsSelect(void)
{
  struct MW_UID_MESSAGE m;
  int rc;

  /* let's make sure that the type is invalid */
  m.type = MV_UID_INVALID;

  /* wait up to 100 milisecons for events */
  rc = uid_read_message( &m, 100 );

  /* return if timed-out or something went wrong */
  if( rc < 0 )
  {
     if( errno != ETIMEDOUT )
        printf( " rc= %d, errno=%d\n", rc, errno );
     return;
  }

  switch( m.type )
  {
    /* Mouse or Touch Screen event */
    case MV_UID_REL_POS:
    case MV_UID_ABS_POS:
        printf( "Mouse: btns=%X, dx=%d, dy=%d, dz=%d\n",  
                  m.m.pos.btns, m.m.pos.x, m.m.pos.y, m.m.pos.z );
        break;

     default:  ;
  }
}

int rtems_ini()
{
  int rc;
  int mouse_fd;

  /* if this is the first time around, create the message queue */
  rc = uid_open_queue( Q_NAME, O_CREAT | O_RDWR, Q_MAX_MSGS );

 mouse_fd = open( "/dev/mouse", O_NONBLOCK );
 uid_register_device( mouse_fd, Q_NAME );
 
 while( TRUE )
  {
     GsSelect();
  }  

  return 0;
}

////////////////////////////////////////////////////////////////////////////////

I'm not receiving messages from the mouse. I correctly configured the com port and mouse type.
An equivalent method works with the keyboard.

Could someone help me with any tip? or example code?

Thanks
Jose Alves
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20021030/b92d2402/attachment.html>


More information about the users mailing list