What is the difference between evdev_event and input_inject_event?
    Tom Xue 
    faninlinux at gmail.com
       
    Thu Sep 20 03:45:47 EDT 2012
    
    
  
Hi,
I did a trial on my Beagle Board which installed with Android
GingerBread2.3.4. That is to sendevent from console and trigger the "mouse
click" action.
Firstly I check what I will receive if I make some *real* mouse click
action.
If I click the right-bottom corner of the screen:
# getevent
/dev/input/event2: 0004 0004 00090001
/dev/input/event2: 0001 0110 00000001
/dev/input/event2: 0000 0000 00000000
/dev/input/event2: 0004 0004 00090001
/dev/input/event2: 0001 0110 00000000
/dev/input/event2: 0000 0000 00000000
That means if I use "sendevent" with the same data and sequence, the "mouse
click" action shoule be triggered.
But the trial failed. Nothing happened.
Then someone gave a solution.  Check this link:
http://e2e.ti.com/support/embedded/android/f/509/p/207113/737993.aspx#737993
And I modified the kernel drivers/input/evdev.c file as below.
--- evdev.c    2012-09-19 21:33:08.239665514 +0800
+++ evdev_modified.c    2012-09-19 21:32:56.307334229 +0800
@@ -352,6 +352,8 @@
    while (retval < count) {
        if (input_event_from_user(buffer + retval, &event)) {
            retval = -EFAULT;
            goto out;
        }
        input_inject_event(&evdev->handle,
                   event.type, event.code, event.value);
         retval += input_event_size();
     }
+    evdev_event(&evdev->handle,event.type, event.code, event.value);
+
  out:
     mutex_unlock(&evdev->mutex);
     return retval;
And then recompile the kernel image and put it on the SD card, booting...
and did the trial again. This time I succeeded.
But why?
evdev_event() has the totally same args as input_inject_event(), and I
found that input_inject_event() was implemented by adding printk().
That shows when applying sendevent, the input_inject_event() will pass the
event to handlers as well (my printk gives INPUT_PASS_TO_HANDLERS for 6
times, due to 6 data were sent).
Could anyone please help to clarify what the difference is between them?
And why only evdev_event() helps in this case?
BTW, I have a HTC Sensation XE phone which installed with Android 4.0.3.
And I checked its kernel source code, it is almost same to above code
(without evdev_event()). But this phone can work when I sendevent to it, no
need to add evdev_event().
Thanks!
BR,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120920/ecb045ab/attachment.html 
    
    
More information about the Kernelnewbies
mailing list