Android Input Device Events

Hi friends,

I have got task dealing with touch monitor. I have to implement multitouch in our project. In the middle, I wanted to see input events. My teammate gave me the keyword to see the input event and to manually send input event to any devices. I would like to put it here. So, Me and You can refer, when we want it...

Android getevent and sendevent 

ya, as you guess...
  • getevent is to read the input event from the device(/dev/input/device-name) and
  • sendevent is to write the input event to the device(/dev/input/device_name) manually
Before, the getevent and sendevent... Lets have a brief look into the input event...
Input Event : Basically inputs are written has (sequence of ) events in the device(/dev/input/event(device) in case of Linux). All input events comprise of three values namely,
  • Type  : type of the event like Key, Sync, Misc, LED, etc.
  • Code  : value corresponding to the key, which is pressed.
  • Value : Zero for release and One for click/press, in case of key press and mouse click event. some running number in other case( I don't have too much knowledge in it).
With these 3, OS will understand the input given by us and perform the action to the corresponding input.
 
Example : when we press key 2 in the keyboard... event sequence will be like the below

In ubuntu,  (I wrote a c program to read the input even from device and the output is below)
Event: type 4 (Misc), code 4 (ScanCode), value 458783   [Conveying the event is scancode]
Event: type 1 (Key), code 3 (2), value 1                             [key 2 pressed]
Event: type 0 (Sync), code 0 (Sync), value 0                      [sync event]
Event: type 4 (Misc), code 4 (ScanCode), value 458783    [conveying the event is scancode]
Event: type 1 (Key), code 3 (2), value 0                             [key 2 release]
Event: type 0 (Sync), code 0 (Sync), value 0                      [sync event]

In andriod,
Event: type 1 (Key), code 3 (2), value 1                             [key 2 pressed]
Event: type 0 (Sync), code 0 (Sync), value 0                      [sync event]
Event: type 1 (Key), code 3 (2), value 0                             [key 2 release]
Event: type 0 (Sync), code 0 (Sync), value 0                      [sync event]

This is for pressing the key 2 once... This will be written into the device, OS will read it and perform the actions.

ok now...

getevent : will print the event written into the device.
syntax    : getevent device
example : getevent /dev/input/event0
output    :  In android, it didn't say the scancode... but all the inputs are handled as scancodes. output is,
0001 0003 00000001
0000 0000 00000000
0001 0003 00000000
0000 0000 00000000

sendevent : will allow us to give the input in the terminal.
syntax       : sendevent device type code value.
example    : for writing key 2 into the device.
shell@android:/ # sendevent dev/input/event0 0000 0000 00000000
shell@android:/ # sendevent dev/input/event0 0001 0003 00000001
shell@android:/ # sendevent dev/input/event0 0000 0000 00000000
shell@android:/ # sendevent dev/input/event0 0000 0000 00000000


P.S. : Remember the two points below,

  1.  Run it in the android shell.
  2.  Should have root permission.


Mission Venkatagiri: Conquering of old robber’s fort!!! - Trekking


Hi friends,

Do you want to run over the stones, jump through the bushes and thorns, jump over the rocks, climb the mountain and visit a fort built by robbers before centuries???... What you say, “yes” or “no”???

As you say yes, everyone will say yes… because everyone wants their life to be adventurous…

But no one will ask for such an adventure. But few are little different like me. I googled for it... I googled “trekking near Chennai”… I found “Chennai Trekking Club (CTC)”. Members of CTC are people, who want adventure, who like outdoor activities.  I registered in it. Every weekend; organizers in CTC will organize some events like trekking, cycling, running, plantation, etc. Any members of CTC can register and take part in it. Importantly, CTC is non-profitable organization.

So, what is there after registering…? Adventures!!!

I started my adventures with Venkatagiri hills in AP, India.

And here is the story of my first trek…

Mission Venkatagiri: Conquering of old robber’s fort!!!

The story of 19 CTCians…

If I just say “they went and conquered it”, then the story won’t be interesting… So, let’s make it interesting now… So, ready for the story… Ya, here it is…

On sep 7th 2012 Midnight, 19 trekkers under team Emperors went to capture the old robber’s fort at venkatagiri hill on three fighter planes namely, Safari-0001, Ikon and Indica started from Chennai Tidal park, CMBT and Guindy. 

But conquering a fort without some hurdles won’t be possible right???...  ya they started facing problems since they started. At first, the Flight safari-0001’s Head light didn’t work!!! But our pilot Bala managed to ride without headlight.

The next big hurdle aroused in few minute since they started the fighter planes. They faced heavy rain. So, they parked those fighters under a bridge to repack the goods safely and to share the loads properly in all there fighter plane to product it from rain… And they started the journey again, But…………

Second Fighter IKON’s viper went off!!!... So another pilot Raghu had to manage without viper in that heavy rain. So, he followed the safari-0001 slowly. Then and there, our co-pilot Arul went out through the windows and dried the water as a viper (:P) while flying high. 

Then two, three hours went peacefully. Even many went to sleep… Around 5 AM in the Saturday morning, our third fighter Indica hit the road side pavement and got a flat tire. So, five of our warriors tried repair it. So, they took the spare tire out and placed it near the back tire and removed the front tire which got flat.

Wait wait!!! Do you want some twist??? Ok!  Within removing the front tire, our five warriors missed (lost) the spare tire… Dear Readers, I’m not making this twist on my own in the story… really they missed it… Believe me Pls!!! But I seriously feel that those old robbers sent these hurdles… what do you think???... Ok ok , back to the story… So they waited till the dawn and searched for it, but in vain. Hard decision was made to leave warriors Amrita and Tirthank, they bid adieu to them and carried with our journey. (Journey would have been better with you two frnds… Sry… we too missed you in this trek)


Then the 7 seater fighter became 11 seater safari-0001 and 5 seater fighter IKON became 6-seater…

After an hour or two, they reached venkatagiri… Captain Bala and Ravi went to local police station to warn everyone not to help those robbers to escape before they capture their fort… 

Then they went near to the base of the hill and parked the fighter in the near field and started walking. Pilots early had a plan to land the fighter planes right in the peak, but robbers may escape on seeing the fighter planes. So, they parked in the base and started walking to the robber’s fort…

On the way to the fort, they took tasty poli for lunch!!! And then with captain bala as the lead and Ravi as the sweep, they entered old robber’s fort by 4pm in the evening… But L … There were no robbers… 

I think, somehow they got information that the CTCians are coming to capture the fort… They evacuated their fort…

But our commando Raja took the knife out of his bag to slice the heads of those robbers. So, how can he keep the knife back into the bag without slicing something??? So, he sliced the heads of carrot, potatoes, tomatoes, onions… and made an awesome biriyani!!! With that biriyani our 17 warriors went to sleep… 

Next day beings with the temperature less than 16 degree and wind with the speed around 100km/hr… Since it was like, fan was running at full speed and AC was at 16 degree… our 17 warriors slept tight inside the blanket and tent. But, our pilot woke up all of them with a three letter word… any guess, what that word is???...No! He just said “TEA!!!”… With that everyone woke up to drink tea. But our pilot lied to wake up all, there were no tea!! …

Then warrior explored the fort and captured it in their memories and cams!!! Then our Bala, Ravi and Arul made wonderful tea and breakfast. Then they started home from the peak… 

Interesting, on the way back they saw 5 local guys and 2 outsiders climbing up… Our Ravi, Raja and few helped the local guys with water… Then they had rusk for lunch and reached back the base…

But they lost their way from the base to village. So, they explored the base and found our way back to village. 

Those nice villagers thought that our bala & ravi with their team, conquered and defeated those robbers. So, they helped the team to take bath at their pump. Poor villagers, they didn’t know that our     team didn’t even see a single robber there.
Then they loaded back in to the flights. But our pilot had parked the fighter safari safely in a pit. So, they struggled and with the help of the villagers, they lifted the fighter back from the pit. 

Then they came to know that local guys, who were all helped by our caption Ravi and Raja are robbers. They robbed the 2 outsiders, who were climbing up when our CTCian’s climbing down. And one of the Warriors Murali captured those robbers in his cam. But, they knew it only after reaching back Chennai. So, they were not able to help them at that time.

Then, our 17 trekkers left the ventakagiri and reached back Chennai on Sunday night.

Unforgettable Moments....
Tent...

Campfire...
Nature...
 Enjoyment...
Sunrise...
Climbing...
 Fort...

Me...

 From me

I enjoyed a lot... Though everyone was unknown to me until Friday midnight, I feel like, I spent two days with my cousins and close friends... These adventurous trips are dreams for me, since my childhood... "Superb Place, Awesome people, fabulous trip, a winning team.",  what else is needed for an adventurous trip...since we loaded bags in the car near the tidal park, everything was adventurous until we unloaded the bag from car back in CMBT...  Unforgettable weekend and my first trekking... Thanks all...It was really awesome… Looking forward for many more such an adventures treks!


By one among those 17,
ALAGAPPAN…

Newer Posts Older Posts Home

About Me

My photo
Hi everyone,myself Alagappan...electronic and communication engg. student... living in madurai... interested in everything... want to achieve something great in my lifetime...

Followers


Recent Comments