<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: luminia210</title>
    <description>The latest articles on DEV Community by luminia210 (@luminia210).</description>
    <link>https://dev.to/luminia210</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3876600%2Ffc07f618-3dd7-496b-ace3-06a12f23bcea.png</url>
      <title>DEV Community: luminia210</title>
      <link>https://dev.to/luminia210</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/luminia210"/>
    <language>en</language>
    <item>
      <title>I built a C library to inject multitouch into Android over USB — no root, no ADB, no app</title>
      <dc:creator>luminia210</dc:creator>
      <pubDate>Mon, 13 Apr 2026 12:08:49 +0000</pubDate>
      <link>https://dev.to/luminia210/i-built-a-c-library-to-inject-multitouch-into-android-over-usb-no-root-no-adb-no-app-3fd1</link>
      <guid>https://dev.to/luminia210/i-built-a-c-library-to-inject-multitouch-into-android-over-usb-no-root-no-adb-no-app-3fd1</guid>
      <description>&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;I'm 14, and I wanted to automate touch input on Android from a PC&lt;br&gt;
with as little latency as possible — mainly for game automation&lt;br&gt;
and key mapping.&lt;/p&gt;

&lt;p&gt;After researching, I found that AOA (Android Open Accessory)&lt;br&gt;
HID-only mode was the right approach. It's much lower latency&lt;br&gt;
than &lt;code&gt;adb input tap&lt;/code&gt; because it bypasses the ADB stack entirely&lt;br&gt;
and sends raw HID reports directly over USB.&lt;/p&gt;

&lt;p&gt;I found existing projects for mouse and keyboard HID over AOA,&lt;br&gt;
but nothing for touch panels. So I first built a small program&lt;br&gt;
that reads touch events from a CSV and replays them via AOA HID.&lt;br&gt;
Once that worked, I realized the transport layer could be useful&lt;br&gt;
for a lot of other things, so I extracted it into a library.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;libaoa_hid&lt;/strong&gt; registers a virtual HID digitizer on Android over&lt;br&gt;
a plain USB cable and streams raw touch reports to it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No root&lt;/li&gt;
&lt;li&gt;No ADB&lt;/li&gt;
&lt;li&gt;No companion app on the Android side&lt;/li&gt;
&lt;li&gt;Up to 16 simultaneous touch points&lt;/li&gt;
&lt;li&gt;Works on Linux, macOS, and Windows (MinGW-w64)&lt;/li&gt;
&lt;li&gt;Requires Android 4.1+&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The library is a pure transport pipe — no retry logic, no sleep&lt;br&gt;
calls. Timing and error handling are left entirely to the caller.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;AOA 2.0 allows a USB host to register a HID device on Android&lt;br&gt;
without any app on the Android side. The tricky part was getting&lt;br&gt;
the HID descriptor right for a multitouch digitizer — Android&lt;br&gt;
has specific requirements around contact count reporting and&lt;br&gt;
hybrid mode that aren't well documented.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="n"&gt;AoaDevice&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;dev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aoa_hid_connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2560&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;sleep_ms&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// wait for Android to register the HID device&lt;/span&gt;

&lt;span class="n"&gt;HidReport&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;memset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;report_id&lt;/span&gt;                 &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;finger&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;tip_inrange_pad&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;AOA_FINGER_DOWN&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;finger&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;contact_id&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;finger&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;               &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;finger&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;               &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;contact_count&lt;/span&gt;             &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;aoa_hid_send_report&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;aoa_hid_disconnect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dev&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Use cases
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Game automation and key mapping&lt;/li&gt;
&lt;li&gt;UI test automation&lt;/li&gt;
&lt;li&gt;Robotics / embedded setups that need to drive an Android display&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Coming soon
&lt;/h2&gt;

&lt;p&gt;I'm currently working on a companion tool that records tap events&lt;br&gt;
via ADB, converts them to CSV, and replays them through&lt;br&gt;
libaoa_hid — so you can record any interaction and reproduce it&lt;br&gt;
exactly. Will be released when it's ready.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/luminia210/android-hid-multitouch" rel="noopener noreferrer"&gt;https://github.com/luminia210/android-hid-multitouch&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feedback on the API design very welcome.&lt;/p&gt;

</description>
      <category>android</category>
      <category>c</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
