2009-09-23 16:09:37     Event questions

Document created by Aaronwu Employee on Aug 19, 2013
Version 1Show Document
  • View in full screen mode

2009-09-23 16:09:37     Event questions

Adam Dershowitz (UNITED STATES)

Message: 80321   


I have two event related questions.


I am using code similar to event_test.  I noticed something odd in my code, and the confirmed that the same thing happens with event test.  The first button push, of each button, after a boot, is missed.  In other words, if I boot the board, and then run event_test, the first button press of BTN0 doesn't show up, but the button release does.  Then the second button press (and all subsequent) seem fine.  Then the same thing happens with BTN1 etc.


So, my first question, is why this happens?  And perhaps more important, is there any way to make it go away?  I don't want my user's first presses to all be ignored.  Is something not being initialized?  Is there some way to initialize it?


My second question is whether there is a programmatic way to generate events?  In other words, if I want to test my code, without having to physically push buttons is there way a way to write a separate app that creates events, so that event_test (and my code etc) will "think" that there have been button pushes?  If so, then I might be able to also use this as a solution to my first question, since I might be able to generate a single "dummy" event for each button at startup to initialize it.


Any insights would be appreciated.








2009-09-23 16:27:40     Re: Event questions

Mike Frysinger (UNITED STATES)

Message: 80322   


please describe the exact hardware (board/input device/etc...) and software (u-boot/kernel/driver/etc...) that is in play here.  you say "button", but what exactly does that boil down to ?  the underlying systems could be causing the trouble.




2009-09-23 20:06:09     Re: Event questions

Adam Dershowitz (UNITED STATES)

Message: 80325   


I am using a 527 core module with the latest uclinux release.


I figured out the solution to both questions, and figured that it might be helpful to others.


1)  From my limited testing, each button push (I have done this on a Bluetechnix board and our custom hardware), sends 4 events.  Button down, reset, button up, reset.   Apparently the events interface comes up effectively with the buttons in a down representation.  So, the first "down" is ignored, and the first "up" then is reported, and the system is then works fine to report future downs and ups.


2)  I found that I can simulate events by just opening and writing to /dev/input/event.  Essentially I do the same thing as event_test, but I fill in data first.


3)  I found that I can get the first actual button presses to be reported, by having part of my application init procedure be to open and write to /dev/input/event with a button up event , and a reset event, for each of my buttons.  Then, when there is an actual button press later, it is properly reported.