Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: Linux/MIPS Development <linux-mips@linux-mips.org>
Subject: Re: questions about keyboard
Date: Thu, 15 Apr 2004 22:22:18 +0200	[thread overview]
Message-ID: <20040415202218.GI630@lug-owl.de> (raw)
In-Reply-To: <F71A246055866844B66AFEB10654E7860F1B10@riv-exchb6.echostar.com>

[-- Attachment #1: Type: text/plain, Size: 1964 bytes --]

On Thu, 2004-04-15 14:08:54 -0600, Xu, Jiang <Jiang.Xu@echostar.com>
wrote in message <F71A246055866844B66AFEB10654E7860F1B10@riv-exchb6.echostar.com>:
> 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 mounted?

> 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...

MfG, JBG

-- 
   Jan-Benedict Glaw       jbglaw@lug-owl.de    . +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 | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2004-04-15 20:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-15 20:08 questions about keyboard Xu, Jiang
2004-04-15 20:22 ` Jan-Benedict Glaw [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-04-15 20:44 Xu, Jiang
2004-04-14 20:56 Xu, Jiang
2004-04-15  8:36 ` Jan-Benedict Glaw
2004-04-14 20:31 Xu, Jiang
2004-04-14 20:36 ` Geert Uytterhoeven
2004-04-14 20:18 Xu, Jiang
2004-04-14 20:25 ` Jan-Benedict Glaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040415202218.GI630@lug-owl.de \
    --to=jbglaw@lug-owl.de \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox