Note that there are some explanatory texts on larger screens.

plurals
  1. POWhich device file receives keys which I inject on Android?
    primarykey
    data
    text
    <p>I managed to inject multitouch events on my LG device programmatically ( C code ) injecting them into <code>/dev/input/event0</code>. But no success with key press injection. I do able to inject keys via <code>adb shell input keyevent</code> but i don't see anything happens in <code>/dev/input/event*</code> files. Looks like none of them receives nothing. Does anybody know how to localize the file where to inject keys ? Thanks in advance.</p> <p>Update:</p> <p>init device code :</p> <pre><code>ioctl (obj-&gt;m_fd, UI_SET_EVBIT, EV_KEY); ioctl (obj-&gt;m_fd, UI_SET_KEYBIT, BTN_TOUCH); ioctl (obj-&gt;m_fd, UI_SET_KEYBIT, KEY_BACK); ioctl (obj-&gt;m_fd, UI_SET_KEYBIT, KEY_HOMEPAGE); for (i = KEY_RESERVED; i &lt;= KEY_UNKNOWN; i++) ioctl(obj-&gt;m_fd, UI_SET_KEYBIT, i); ioctl (obj-&gt;m_fd, UI_SET_EVBIT, EV_ABS); ioctl (obj-&gt;m_fd, UI_SET_ABSBIT, ABS_X); ioctl (obj-&gt;m_fd, UI_SET_ABSBIT, ABS_Y); ioctl (obj-&gt;m_fd, UI_SET_ABSBIT, ABS_MT_TOUCH_MAJOR); ioctl (obj-&gt;m_fd, UI_SET_ABSBIT, ABS_MT_POSITION_X); ioctl (obj-&gt;m_fd, UI_SET_ABSBIT, ABS_MT_POSITION_Y); ioctl (obj-&gt;m_fd, UI_SET_ABSBIT, ABS_MT_TRACKING_ID); ioctl (obj-&gt;m_fd, UI_SET_ABSBIT, ABS_MT_PRESSURE); </code></pre> <p>inject touch event code (working)</p> <pre><code>intSendEvent( obj-&gt;m_fd, EV_ABS, ABS_MT_TRACKING_ID, 0 ); intSendEvent( obj-&gt;m_fd, EV_ABS, ABS_MT_POSITION_X, obj-&gt;x ); intSendEvent( obj-&gt;m_fd, EV_ABS, ABS_MT_POSITION_Y, obj-&gt;y ); intSendEvent( obj-&gt;m_fd, EV_ABS, ABS_MT_TOUCH_MAJOR, obj-&gt;sq ); intSendEvent( obj-&gt;m_fd, EV_ABS, ABS_MT_PRESSURE, obj-&gt;pr ); intSendEvent( obj-&gt;m_fd, EV_SYN, SYN_MT_REPORT, 0); intSendEvent( obj-&gt;m_fd, EV_SYN, SYN_REPORT, 0); intSendEvent( obj-&gt;m_fd, EV_SYN, SYN_MT_REPORT, 0); intSendEvent( obj-&gt;m_fd, EV_SYN, SYN_REPORT, 0); </code></pre> <p>inject key press code where <code>KEY_RESERVED &lt;= obj-&gt;keyCode &lt;=KEY_UNKNOWN</code> (not working) </p> <pre><code>intSendEvent(obj-&gt;m_fd, EV_KEY, obj-&gt;keyCode, 1); intSendEvent( obj-&gt;m_fd, EV_SYN, SYN_REPORT, 0); intSendEvent(obj-&gt;m_fd, EV_KEY, obj-&gt;keyCode, 0); intSendEvent( obj-&gt;m_fd, EV_SYN, SYN_REPORT, 0); </code></pre> <p>send event function</p> <pre><code>void intSendEvent(int fd_kb,int type, int code, int value) { debug("intSendEvent call (%d,%d,%d,%d)", fd_kb, type, code, value); struct uinput_event event; int len; if (fd_kb &lt;= fileno(stderr)) return; memset(&amp;event, 0, sizeof(event)); event.type = type; event.code = code; event.value = value; len = write( fd_kb, &amp;event, sizeof(event) ); debug("intSendEvent done:%d",len); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload