/*****************************************************************************\
*   This program is free software; you can redistribute it and/or modify      *
*   it under the terms of the GNU General Public License as published by      *
*   the Free Software Foundation; either version 2 of the License, or         *
*   (at your option) any later version.                                       *
*                                                                             *
*   This program is distributed in the hope that it will be useful,           *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of            *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
*   GNU General Public License for more details.                              *
*                                                                             *
*   You should have received a copy of the GNU General Public License         *
*   along with this program; if not, write to the Free Software Foundation,   *
*   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.            *
\*****************************************************************************/

#include <stdio.h> 
#include <unistd.h> 
#include <sys/io.h> 

int main() 
  { 
  int i = 0; 
  /* Get access to the port */ 
  if (ioperm(0x201, 1, 1)) 
    { perror("ioperm"); exit(1); } 
  while (i < 0x0F ) 
    { 
    i = inb(0x201);
    /* shift to lower nibble */
    i = i >> 4; 
    printf("Buttons %X\n",i);
    /* Sleep for a while */ 
    sleep(1); 
    } 
  /* We don't need the ports anymore */ 
  if (ioperm(0x201, 1, 0)) 
    { perror("ioperm"); exit(1); } 
  exit(0); 
  }

