[Top] [All Lists]

RE: questions about keyboard

To: 'Jan-Benedict Glaw' <>, Linux/MIPS Development <>
Subject: RE: questions about keyboard
From: "Xu, Jiang" <>
Date: Thu, 15 Apr 2004 14:44:25 -0600
Original-recipient: rfc822;
I really really appreciate your help.  
That is a very stupid bug, I should review my code more carefully before I
sent out for help.  Sorry about that, I guess somehow my brain just messed

Anyway, I did turn on the CONFIG_PROC_FS.  
I also mount the usb by "mount -t usbdevfs none /proc/bus/usb"; and if I
"cat /proc/filesystems" it does show "usbdevfs".  
However, is there a "inputdevfs" and is there a similar command line such as
"mount -t inputdevfs none /proc/bus/input"?
I don't see anything like "CONFIG_INPUT_DEVICEFS"?
I am using 2.4.18 kernel.



-----Original Message-----
From: Jan-Benedict Glaw [] 
Sent: Thursday, April 15, 2004 2:22 PM
To: Linux/MIPS Development
Subject: Re: questions about keyboard

On Thu, 2004-04-15 14:08:54 -0600, Xu, Jiang <> wrote
in message <>:
> Thanks for the reply, I did some testing and found some interesting 
> things:
> 1.  Everytime I push the key on the keyboard, I can see something out 
> from /dev/input/event0 by "cat /dev/input/event0". However, I don't 
> see a directory named "proc/input", did I miss configure something in 
> the kernel?

Maybe your kernel isn't configured with CONFIG_PROC_FS=y ? Maybe it's not

> 2.  read() does work and is a blocking read.  However, if I use 
> select, then it does not work.
> Select() never detects the state change.
> Here is the sample code I am using:
> {
>    int test_fd = -1;

No need to initialize - you're assigning a value before accessing it.

>    fd_set rfds;
>    struct timeval tv;
>    tv.tv_sec = 1;
>    tv.tv_usec = 0;

tv_* need to be set before *every* select () invocation, not only once.

>    test_fd = open("/dev/input/event0", O_RDONLY); 
>    if( test_fd < 0 )
>      exit(0);
>    while( 1 )
>    {  
>       FD_ZERO(&rfds);
>       FD_SET(test_fd, &rfds);
>       retval = select( 1, &rfds, NULL, NULL, &tv );

That's wrong. The "1" should be "fd + 1".

>       if( retval )
>          printf("\nDetects something....");

A negative retval would also be != 0 ...

>    }
> }
> What could be wrong?

Most probably it's the hardcoded "1" with the select. That is, select only
looks at all fd's which are smaller than one, so only fd=0 would be testes,
but this one isn't in the set, so...


   Jan-Benedict Glaw    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM |

<Prev in Thread] Current Thread [Next in Thread>