<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="https://amrosia.dev/feed_style.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <tabi:metadata xmlns:tabi="https://github.com/welpo/tabi">
        <tabi:base_url>https:&#x2F;&#x2F;amrosia.dev</tabi:base_url>
        <tabi:separator>
            •
        </tabi:separator>
        <tabi:about_feeds>This is a web feed, also known as an Atom feed. Subscribe by copying the URL from the address bar into your newsreader. Visit About Feeds to learn more and get started. It&#x27;s free.</tabi:about_feeds>
        <tabi:visit_the_site>Visit website</tabi:visit_the_site>
        <tabi:recent_posts>Recent posts</tabi:recent_posts>
        <tabi:last_updated_on>Updated on $DATE</tabi:last_updated_on>
        <tabi:default_theme>dark</tabi:default_theme>
        <tabi:post_listing_date>date</tabi:post_listing_date>
        <tabi:current_section>kernel</tabi:current_section>
    </tabi:metadata><link rel="extra-stylesheet" href="https://amrosia.dev/skins/teal.css?h=bd19e558a52d678a50de" /><title>Segfault diaries - kernel</title>
        <subtitle>Welcome to my blog!</subtitle>
    <link href="https://amrosia.dev/tags/kernel/atom.xml" rel="self" type="application/atom+xml"/>
    <link href="https://amrosia.dev/tags/kernel/" rel="alternate" type="text/html"/>
    <generator uri="https://www.getzola.org/">Zola</generator><updated>2026-11-24T00:00:00+00:00</updated><id>https://amrosia.dev/tags/kernel/atom.xml</id><entry xml:lang="en">
        <title>Adding a USB Wi-Fi adapter to a rooted Android tablet</title>
        <published>2026-11-24T00:00:00+00:00</published>
        <updated>2026-11-24T00:00:00+00:00</updated>
        <author>
            <name>amrosia</name>
        </author>
        <link rel="alternate" href="https://amrosia.dev/blog/adding-a-usb-wifi-adapter-to-a-rooted-android-tablet/" type="text/html"/>
        <id>https://amrosia.dev/blog/adding-a-usb-wifi-adapter-to-a-rooted-android-tablet/</id>
        
            <content type="html">&lt;p&gt;Android tablets make good remote clients, but their radios are fixed inside the device. A USB Wi-Fi adapter adds a second one — the reference hardware here is an ALFA AWUS1900 (Realtek RTL8814AU, &lt;code&gt;0bda:8813&lt;&#x2F;code&gt;) on a Lenovo TB321FU running Android 16.&lt;&#x2F;p&gt;
&lt;p&gt;The USB socket is the easy part. Everything after it is work: the tablet has to treat the port as a host, the kernel has to accept a driver it was never built with, and the driver has to be coaxed into monitor mode before packet capture tools are useful.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;usb-wifi-android&#x2F;two-stacks.gif&quot; alt=&quot;Animated diagram: wlan1 is a plain cfg80211 netdev driven by iw and airodump-ng, while Android’s Settings picker reaches only wlan0 through the vendor Wi-Fi HAL, with no framework path to the USB adapter.&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;what-you-need&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#what-you-need&quot; aria-label=&quot;Anchor link for: what-you-need&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
What you need&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Item&lt;&#x2F;th&gt;&lt;th&gt;Requirement&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Adapter&lt;&#x2F;td&gt;&lt;td&gt;A chip with a maintained out-of-tree driver; the reference is RTL8814AU&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Cable&lt;&#x2F;td&gt;&lt;td&gt;Type-C to A &lt;strong&gt;OTG adapter&lt;&#x2F;strong&gt; that presents a 5.1k Rd on CC, or a hub with a C upstream&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Device&lt;&#x2F;td&gt;&lt;td&gt;Rooted Android; Magisk is enough, SELinux can stay enforcing&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Kernel facts&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;MODULES&lt;&#x2F;code&gt;, &lt;code&gt;MODVERSIONS&lt;&#x2F;code&gt;, &lt;code&gt;CFI_CLANG&lt;&#x2F;code&gt; state, &lt;code&gt;MODULE_SIG_FORCE&lt;&#x2F;code&gt; unset, and the exact kernel build (&lt;code&gt;uname -a&lt;&#x2F;code&gt;, &lt;code&gt;&#x2F;proc&#x2F;config.gz&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Build host&lt;&#x2F;td&gt;&lt;td&gt;The matching kernel source tree, the same Clang major version, &lt;code&gt;pahole&lt;&#x2F;code&gt;, &lt;code&gt;bison&lt;&#x2F;code&gt;, &lt;code&gt;flex&lt;&#x2F;code&gt;, &lt;code&gt;dtc&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Optional&lt;&#x2F;td&gt;&lt;td&gt;A powered hub — the adapter alone can draw more than the port supplies&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Before buying anything, check whether your kernel already has a driver. RTL8814AU support landed in the in-kernel &lt;code&gt;rtw88&lt;&#x2F;code&gt; driver only in &lt;strong&gt;Linux 6.13+&lt;&#x2F;strong&gt;, and Android 14–16 tablets ship 6.1 or 6.6 kernels, so the in-tree option does not exist yet. That leaves the vendor-style out-of-tree module, which is what the rest of this post is about. The Android GKI patches and build instructions for the reference device are in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;amrosia&#x2F;8814au-android&quot;&gt;my 8814au fork&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;why-the-wi-fi-picker-never-lists-it&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#why-the-wi-fi-picker-never-lists-it&quot; aria-label=&quot;Anchor link for: why-the-wi-fi-picker-never-lists-it&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Why the Wi-Fi picker never lists it&lt;&#x2F;h2&gt;
&lt;p&gt;An adapter like this always ends up as a cfg80211 netdev — &lt;code&gt;wlan1&lt;&#x2F;code&gt; next to the built-in &lt;code&gt;wlan0&lt;&#x2F;code&gt;. Android’s Wi-Fi UI does not talk to cfg80211; it talks to the vendor Wi-Fi HAL, which is bound to the built-in chip. There is no path from Settings to your adapter, and there is nothing to enable in Settings to create one.&lt;&#x2F;p&gt;
&lt;p&gt;This has two consequences worth internalising:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Android will not manage the adapter for you. Scanning, association, DHCP and routing are yours to drive with &lt;code&gt;iw&lt;&#x2F;code&gt;, &lt;code&gt;wpa_supplicant&lt;&#x2F;code&gt; and friends.&lt;&#x2F;li&gt;
&lt;li&gt;Everything you do to &lt;code&gt;wlan1&lt;&#x2F;code&gt; is invisible to the framework, including monitor mode, and it also cannot break the built-in Wi-Fi.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;ip link&lt;&#x2F;code&gt; will show the interface, and that is the whole extent of Android’s awareness of it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;get-the-port-into-host-mode&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#get-the-port-into-host-mode&quot; aria-label=&quot;Anchor link for: get-the-port-into-host-mode&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Get the port into host mode&lt;&#x2F;h2&gt;
&lt;p&gt;Host mode is decided on the Type-C port, by the PMIC and UCSI firmware, before any driver is involved. The port becomes a host only when it sees a partner presenting a 5.1k Rd on CC.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;usb-wifi-android&#x2F;usb-host-mode.gif&quot; alt=&quot;Animated diagram: the PMIC&#x2F;UCSI reads CC and decides the data role; a charge-only cable yields USB_DCP with no xHCI controller, a proper 5.1k Rd yields host mode and enumeration, and forcing the role by hand with no partner panics the device. A note shows the 500 mA port budget against roughly 1 A of adapter draw.&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The three outcomes are easy to tell apart:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;# is anything on the bus?
lsusb
ls &#x2F;sys&#x2F;bus&#x2F;usb&#x2F;devices&#x2F;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;# what did the port decide?
cat &#x2F;sys&#x2F;class&#x2F;typec&#x2F;port0&#x2F;data_role &#x2F;sys&#x2F;class&#x2F;typec&#x2F;port0&#x2F;power_role
cat &#x2F;sys&#x2F;class&#x2F;usb_role&#x2F;a600000.ssusb-role-switch&#x2F;role
cat &#x2F;sys&#x2F;class&#x2F;power_supply&#x2F;usb&#x2F;online &#x2F;sys&#x2F;class&#x2F;power_supply&#x2F;usb&#x2F;type
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A charge-only cable gives you VBUS and nothing else: &lt;code&gt;power_supply&#x2F;usb&lt;&#x2F;code&gt; reports &lt;code&gt;online=1 type=USB_DCP&lt;&#x2F;code&gt;, no &lt;code&gt;xhci&lt;&#x2F;code&gt; platform device appears, and the device list stays empty. The tablet is a charger, not a host, and no amount of kernel or driver work changes that. With a real OTG adapter the port flips to &lt;code&gt;[host]&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;[source]&lt;&#x2F;code&gt;, an &lt;code&gt;xhci-hcd&lt;&#x2F;code&gt; controller appears, and the adapter enumerates — in the reference setup at 480 Mb&#x2F;s on &lt;code&gt;usb 1-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;div class=&quot;admonition warning&quot;&gt;
    &lt;div class=&quot;admonition-icon admonition-icon-warning&quot;&gt;&lt;&#x2F;div&gt;
    &lt;div class=&quot;admonition-content&quot;&gt;
        &lt;strong class=&quot;admonition-title&quot;&gt;WARNING&lt;&#x2F;strong&gt;
        &lt;p&gt;Do not force host mode by writing &lt;code&gt;host&lt;&#x2F;code&gt; to &lt;code&gt;&#x2F;sys&#x2F;class&#x2F;usb_role&#x2F;*&#x2F;role&lt;&#x2F;code&gt;. With no partner attached this tablet panics in &lt;code&gt;dwc3_msm_host_notifier&lt;&#x2F;code&gt; with a NULL dereference, and the log contains no call trace and no module frame, so it looks like a driver bug and is not. Host mode has to come from the cable.&lt;&#x2F;p&gt;

    &lt;&#x2F;div&gt;
&lt;&#x2F;div&gt;
&lt;div class=&quot;admonition tip&quot;&gt;
    &lt;div class=&quot;admonition-icon admonition-icon-tip&quot;&gt;&lt;&#x2F;div&gt;
    &lt;div class=&quot;admonition-content&quot;&gt;
        &lt;strong class=&quot;admonition-title&quot;&gt;TIP&lt;&#x2F;strong&gt;
        &lt;p&gt;The port budget is 500 mA while the adapter can draw around 1 A. A powered hub with a C upstream gives back the throughput too: an A-to-C adapter chain negotiated full-speed 12 Mb&#x2F;s in testing, where the direct OTG cable reached high-speed 480 Mb&#x2F;s.&lt;&#x2F;p&gt;

    &lt;&#x2F;div&gt;
&lt;&#x2F;div&gt;
&lt;h2 id=&quot;build-the-driver-for-this-kernel&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#build-the-driver-for-this-kernel&quot; aria-label=&quot;Anchor link for: build-the-driver-for-this-kernel&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Build the driver for this kernel&lt;&#x2F;h2&gt;
&lt;p&gt;An Android GKI kernel will not load a module built for a different kernel, and it fails in four different ways depending on which check you trip.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;usb-wifi-android&#x2F;driver-contract.gif&quot; alt=&quot;Animated diagram: a prebuilt .ko is rejected by four independent kernel checks — vermagic, symbol CRCs under MODVERSIONS, kCFI call-type hashes, and the trimmed export list — each with its real error message, ending with the reminder that a kCFI trap panics rather than returning an error.&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The checks, in the order they usually bite:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Vermagic&lt;&#x2F;strong&gt; — the module records the kernel release string it was built for. A mismatch is a clean refusal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Symbol CRCs&lt;&#x2F;strong&gt; — with &lt;code&gt;CONFIG_MODVERSIONS&lt;&#x2F;code&gt;, every imported symbol carries a CRC of its prototype. Mismatch: &lt;code&gt;disagrees about version of symbol&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;kCFI&lt;&#x2F;strong&gt; — with &lt;code&gt;CONFIG_CFI_CLANG&lt;&#x2F;code&gt;, each indirect call site checks the callee’s type hash. A mismatch is not an error message; it is &lt;code&gt;CFI failure at …&lt;&#x2F;code&gt; followed by a panic.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Trimmed exports&lt;&#x2F;strong&gt; — GKI kernels set &lt;code&gt;CONFIG_TRIM_UNUSED_KSYMS&lt;&#x2F;code&gt;, so functions nothing else in the kernel calls are not exported at all. &lt;code&gt;filp_open&lt;&#x2F;code&gt;, &lt;code&gt;kern_path&lt;&#x2F;code&gt;, &lt;code&gt;kernel_read&lt;&#x2F;code&gt;, &lt;code&gt;kernel_write&lt;&#x2F;code&gt; and &lt;code&gt;yield&lt;&#x2F;code&gt; are all absent on the reference device.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;So the build is: the exact kernel source commit the device runs, the device’s own &lt;code&gt;&#x2F;proc&#x2F;config.gz&lt;&#x2F;code&gt;, and the same Clang major version — 17 in this case, since kCFI hashes and struct layouts are toolchain-dependent. The practical sequence and a template script are in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;amrosia&#x2F;8814au-android&quot;&gt;the driver fork&lt;&#x2F;a&gt;; the non-obvious parts are worth stating here because they cost the most time:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;# the device&amp;#39;s own configuration, not a defconfig
adb shell &amp;#39;cat &#x2F;proc&#x2F;config.gz&amp;#39; | gunzip &amp;gt; device.config

# module_layout is the fingerprint that proves the tree matches
modinfo 8814au.ko | grep -E &amp;#39;vermagic|srcversion&amp;#39;

# build against the pinned source tree
make -C &amp;quot;$KERN&amp;quot; M=&amp;quot;$PWD&amp;quot; ARCH=arm64 LLVM=1 CONFIG_RTL8814AU=m modules
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;type-mismatches-that-do-not-warn&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#type-mismatches-that-do-not-warn&quot; aria-label=&quot;Anchor link for: type-mismatches-that-do-not-warn&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Type mismatches that do not warn&lt;&#x2F;h3&gt;
&lt;p&gt;Two classes of bug compile silently and then trap at runtime, because Clang treats them as compatible while kCFI hashes the exact types:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Tasklet and URB callbacks.&lt;&#x2F;strong&gt; &lt;code&gt;tasklet_init&lt;&#x2F;code&gt; takes &lt;code&gt;void (*)(unsigned long)&lt;&#x2F;code&gt;; a callback declared &lt;code&gt;void f(void *priv)&lt;&#x2F;code&gt; needs a wrapper, not a cast. Likewise USB completion handlers must match &lt;code&gt;void (*)(struct urb *)&lt;&#x2F;code&gt; — the pre-4.14 &lt;code&gt;struct pt_regs *&lt;&#x2F;code&gt; form will trap on the first completion.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;ndo_start_xmit&lt;&#x2F;code&gt;.&lt;&#x2F;strong&gt; It returns &lt;code&gt;netdev_tx_t&lt;&#x2F;code&gt;, and &lt;code&gt;int&lt;&#x2F;code&gt; hashes differently. The failure appears the first time a frame is transmitted: &lt;code&gt;CFI failure at dev_hard_start_xmit … expected type 0x44e57e43&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Both were fixed in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;amrosia&#x2F;8814au-android&quot;&gt;the reference fork&lt;&#x2F;a&gt;. The general lesson: grep the build log for suppressed pointer-type warnings instead of trusting a zero exit code, and compare the module’s &lt;code&gt;__kcfi_typeid_*&lt;&#x2F;code&gt; symbols against the kernel’s expected hashes offline rather than by crashing the device.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-struct-abi-trap&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#the-struct-abi-trap&quot; aria-label=&quot;Anchor link for: the-struct-abi-trap&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
The struct ABI trap&lt;&#x2F;h3&gt;
&lt;p&gt;The kernel also silently checks the &lt;em&gt;layout&lt;&#x2F;em&gt; of structures your driver fills in. On the reference device, &lt;code&gt;wiphy_register()&lt;&#x2F;code&gt; returned &lt;code&gt;-EINVAL&lt;&#x2F;code&gt; with every documented condition satisfied, because the vendor’s &lt;code&gt;cfg80211&lt;&#x2F;code&gt; was compiled with &lt;code&gt;CONFIG_NL80211_TESTMODE=y&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;div class=&quot;admonition info&quot;&gt;
    &lt;div class=&quot;admonition-icon admonition-icon-info&quot;&gt;&lt;&#x2F;div&gt;
    &lt;div class=&quot;admonition-content&quot;&gt;
        &lt;strong class=&quot;admonition-title&quot;&gt;INFO&lt;&#x2F;strong&gt;
        &lt;p&gt;&lt;code&gt;testmode_cmd&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;testmode_dump&lt;&#x2F;code&gt; sit between &lt;code&gt;rfkill_poll&lt;&#x2F;code&gt; and &lt;code&gt;set_bitrate_mask&lt;&#x2F;code&gt; in &lt;code&gt;struct cfg80211_ops&lt;&#x2F;code&gt;. With that config enabled, every later member moves 16 bytes, so the kernel read our &lt;code&gt;end_cac&lt;&#x2F;code&gt; slot where it expected &lt;code&gt;set_mac_acl&lt;&#x2F;code&gt; and rejected the wiphy. Building the driver with &lt;code&gt;-DCONFIG_NL80211_TESTMODE=1&lt;&#x2F;code&gt; made &lt;code&gt;wiphy_register&lt;&#x2F;code&gt; return 0 and &lt;code&gt;wlan1&lt;&#x2F;code&gt; appear. If a struct-driven call fails with &lt;code&gt;-EINVAL&lt;&#x2F;code&gt; and the obvious checks pass, compare field offsets against the vendor module’s disassembly.&lt;&#x2F;p&gt;

    &lt;&#x2F;div&gt;
&lt;&#x2F;div&gt;
&lt;h2 id=&quot;load-it-and-check-that-it-registered&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#load-it-and-check-that-it-registered&quot; aria-label=&quot;Anchor link for: load-it-and-check-that-it-registered&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Load it and check that it registered&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;adb push 8814au.ko &#x2F;data&#x2F;local&#x2F;tmp&#x2F;
adb shell &amp;#39;su -c &amp;quot;insmod &#x2F;data&#x2F;local&#x2F;tmp&#x2F;8814au.ko&amp;quot;&amp;#39;
adb shell &amp;#39;su -c &amp;quot;lsmod | head -2; ip -o link show wlan1&amp;quot;&amp;#39;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Success looks like &lt;code&gt;RTW: module init ret=0&lt;&#x2F;code&gt; in &lt;code&gt;dmesg&lt;&#x2F;code&gt;, a &lt;code&gt;wlan1&lt;&#x2F;code&gt; netdev with the adapter’s MAC, and no &lt;code&gt;wiphy_new_nm&lt;&#x2F;code&gt; WARN. Then prove the radio works before installing any tooling — a scan needs no monitor mode:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;ip link set wlan1 up
iw dev wlan1 scan | grep -E &amp;#39;SSID|freq:&amp;#39;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Android ships no &lt;code&gt;iw&lt;&#x2F;code&gt;, so either build a tiny nl80211 client or do this from the chroot described below. A working scan (101 BSS entries across 2.4 and 5 GHz in testing) proves the cfg80211 scan op, firmware load and RF path all function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;monitor-mode&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#monitor-mode&quot; aria-label=&quot;Anchor link for: monitor-mode&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Monitor mode&lt;&#x2F;h2&gt;
&lt;p&gt;Two traps stand between a working interface and a working capture.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;usb-wifi-android&#x2F;wiphy-lock.gif&quot; alt=&quot;Animated diagram: a first panel shows nl80211 asking cfg80211 for a new interface while cfg80211 holds the wiphy mutex; the driver registers the netdev inside add_virtual_intf, the netdev notifier asks for the same mutex, and everything deadlocks with rtnl held. A second panel shows the fix, cfg80211_register_netdevice, which marks the wdev as registering so the notifier skips the lock.&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The first is a genuine driver bug on 6.0+ kernels. &lt;code&gt;cfg80211&lt;&#x2F;code&gt; takes the wiphy mutex around &lt;code&gt;ops-&amp;gt;add_virtual_intf()&lt;&#x2F;code&gt;, and the driver’s monitor-vif routine calls &lt;code&gt;register_netdevice()&lt;&#x2F;code&gt; inside that callback; the resulting &lt;code&gt;NETDEV_REGISTER&lt;&#x2F;code&gt; notification tries to take the same mutex. The symptom is not a crash: the process sits in uninterruptible sleep holding &lt;code&gt;rtnl&lt;&#x2F;code&gt;, and every later &lt;code&gt;ip&lt;&#x2F;code&gt; command hangs until reboot. The fix is the helper mac80211 itself uses — &lt;code&gt;cfg80211_register_netdevice()&lt;&#x2F;code&gt; — with &lt;code&gt;cfg80211_unregister_wdev()&lt;&#x2F;code&gt; on teardown.&lt;&#x2F;p&gt;
&lt;p&gt;The second trap is specific to this driver, and it changes how you invoke tools.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;usb-wifi-android&#x2F;monitor-main-iface.gif&quot; alt=&quot;Animated diagram: setting wlan1 itself to monitor type reaches change_virtual_intf, sets WIFI_MONITOR_STATE and produces radiotap frames; a separately created mon0 vif registers, its ndo_open returns zero without touching the radio, and it captures nothing. A note explains that channel changes return EBUSY unless only monitor interfaces are up.&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A separate &lt;code&gt;mon0&lt;&#x2F;code&gt; created with &lt;code&gt;iw dev wlan1 interface add&lt;&#x2F;code&gt; is a real netdev with a real radiotap header, and it receives &lt;strong&gt;zero frames&lt;&#x2F;strong&gt;, because this driver only enters monitor state when the &lt;em&gt;main&lt;&#x2F;em&gt; interface changes type. Convert &lt;code&gt;wlan1&lt;&#x2F;code&gt; itself:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;ip link set wlan1 down
iw dev wlan1 set type monitor
ip link set wlan1 up
iw dev wlan1 set channel 6
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Order matters. The type change must happen while the interface is down, and &lt;code&gt;NL80211_CMD_SET_CHANNEL&lt;&#x2F;code&gt; returns &lt;code&gt;-EBUSY&lt;&#x2F;code&gt; unless only monitor interfaces are up — which is why &lt;code&gt;airmon-ng&lt;&#x2F;code&gt; on a managed interface fails and why the bring-up above puts &lt;code&gt;wlan1&lt;&#x2F;code&gt; down first.&lt;&#x2F;p&gt;
&lt;p&gt;Once &lt;code&gt;wlan1&lt;&#x2F;code&gt; is a monitor, &lt;code&gt;airmon-ng start wlan1&lt;&#x2F;code&gt; reports that monitor mode is already enabled and creates nothing new, which is the flow wifite expects. The driver fills radiotap headers, so &lt;code&gt;airodump-ng&lt;&#x2F;code&gt; and everything built on it parse the frames normally.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;add-a-userspace&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#add-a-userspace&quot; aria-label=&quot;Anchor link for: add-a-userspace&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Add a userspace&lt;&#x2F;h2&gt;
&lt;p&gt;Android has no Python, no &lt;code&gt;aircrack-ng&lt;&#x2F;code&gt; and no &lt;code&gt;iw&lt;&#x2F;code&gt;, so the tooling needs a real userland. The reference setup is an Alpine arm64 minirootfs extracted under &lt;code&gt;&#x2F;data&#x2F;local&#x2F;tmp&lt;&#x2F;code&gt; and entered with &lt;code&gt;chroot&lt;&#x2F;code&gt;, which is a few hundred megabytes and needs no image file:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;usb-wifi-android&#x2F;userspace-stack.gif&quot; alt=&quot;Animated diagram: Termux runs su to reach Magisk root, then chroot into Alpine, then tmux, then wifite and airodump-ng, which receive radiotap frames from wlan1 on the AWUS1900. A note shows that Ctrl+C does not reach wifite through the su boundary unless tmux is in the chain.&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;apk add python3 py3-pip iw aircrack-ng wireless-tools iproute2 rfkill procps pciutils tshark tmux
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Three details cost real time:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;tshark&lt;&#x2F;code&gt; is not optional if you use wifite.&lt;&#x2F;strong&gt; wifite parses capture files with tshark to decide whether a handshake exists; without it, &lt;code&gt;wifite --check&lt;&#x2F;code&gt; fails with &lt;code&gt;Cannot find BSSID or ESSID in cap file&lt;&#x2F;code&gt;, and its live detection is equally blind. Its &lt;code&gt;wifite&#x2F;tools&#x2F;tshark.py&lt;&#x2F;code&gt; also passes the display filter pre-quoted, which tshark 4.x rejects — drop the inner quotes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Install wifite from source, not pip.&lt;&#x2F;strong&gt; The PyPI package installs a broken layout (&lt;code&gt;ModuleNotFoundError: No module named wifite.wifite&lt;&#x2F;code&gt;). Run &lt;code&gt;Wifite.py&lt;&#x2F;code&gt; from the upstream tree.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Run it under tmux.&lt;&#x2F;strong&gt; wifite needs a terminal, and &lt;code&gt;Ctrl+C&lt;&#x2F;code&gt; does not survive &lt;code&gt;su&lt;&#x2F;code&gt; plus &lt;code&gt;chroot&lt;&#x2F;code&gt;: the process ends up outside the terminal’s foreground process group, so the keystroke never becomes a signal and the scan simply continues. tmux keeps the terminal raw and forwards the keystroke to a pty it owns, which restores normal control.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A small launcher keeps this repeatable — load the module, wait for the interface with a poll instead of a fixed sleep, force monitor mode, verify the radio is actually receiving by watching &lt;code&gt;rx_packets&lt;&#x2F;code&gt; move, and only then start wifite:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;# &#x2F;data&#x2F;local&#x2F;tmp&#x2F;wifite.sh, run as root from Termux: wifite
insmod &#x2F;data&#x2F;local&#x2F;tmp&#x2F;8814au.ko                 # not persistent across reboots
until [ -e &#x2F;sys&#x2F;class&#x2F;net&#x2F;wlan1 ]; do sleep 1; done
sh &#x2F;data&#x2F;local&#x2F;tmp&#x2F;chroot.sh &amp;quot;sh &#x2F;root&#x2F;mon-up.sh wlan1&amp;quot;   # down, managed, monitor, up
exec sh &#x2F;data&#x2F;local&#x2F;tmp&#x2F;chroot.sh &amp;quot;sh &#x2F;root&#x2F;wifite-tmux.sh&amp;quot; # tmux session runs wifite
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;what-works&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#what-works&quot; aria-label=&quot;Anchor link for: what-works&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
What works&lt;&#x2F;h2&gt;
&lt;p&gt;Verified on the reference hardware with the patched driver:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Capability&lt;&#x2F;th&gt;&lt;th&gt;Result&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Passive scan (nl80211)&lt;&#x2F;td&gt;&lt;td&gt;Works: 101 BSS across 2.4 and 5 GHz&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Monitor capture&lt;&#x2F;td&gt;&lt;td&gt;Works: 461 frames &#x2F; 176 beacons in 10 s at 2437 MHz&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Packet injection&lt;&#x2F;td&gt;&lt;td&gt;Works: &lt;code&gt;aireplay-ng -9&lt;&#x2F;code&gt; reports 30&#x2F;30&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Directed deauth&lt;&#x2F;td&gt;&lt;td&gt;Works: acknowledged by the AP (code 7)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Handshake capture&lt;&#x2F;td&gt;&lt;td&gt;Works: wifite captured a valid 4-way handshake, confirmed by tshark and by aircrack-ng computing the PTK&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;PMKID attack&lt;&#x2F;td&gt;&lt;td&gt;Not tested: requires &lt;code&gt;hcxdumptool&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5 GHz monitor&lt;&#x2F;td&gt;&lt;td&gt;Not tested: scan works, channel setup unverified&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Attacking your own AP&lt;&#x2F;td&gt;&lt;td&gt;Drops the tablet’s own link, since wifite deauths every client including the tablet&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Two operational notes from that table. Deauthing everything includes the client the tablet uses for its own network connection, so auditing the AP you are associated with costs you connectivity; prefer a second uplink or deauth a single client with &lt;code&gt;aireplay-ng --deauth 12 -a &amp;lt;ap&amp;gt; -c &amp;lt;client&amp;gt;&lt;&#x2F;code&gt;. And throughput is bounded by USB 2.0 and by OTG power, not by the radio.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;make-it-survive-a-reboot&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#make-it-survive-a-reboot&quot; aria-label=&quot;Anchor link for: make-it-survive-a-reboot&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Make it survive a reboot&lt;&#x2F;h2&gt;
&lt;p&gt;Nothing about the driver is persistent: the module is unloaded on reboot, and the chroot’s bind mounts disappear with it. Everything else — the kernel module file, the rootfs, the launcher — lives on &lt;code&gt;&#x2F;data&lt;&#x2F;code&gt; and returns intact.&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;# after every reboot, one command:
su -c &amp;#39;sh &#x2F;data&#x2F;local&#x2F;tmp&#x2F;wifite.sh&amp;#39;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The launcher handles the rest: &lt;code&gt;insmod&lt;&#x2F;code&gt;, a poll of up to 30 seconds for &lt;code&gt;wlan1&lt;&#x2F;code&gt; to appear, monitor mode, a liveness check on &lt;code&gt;rx_packets&lt;&#x2F;code&gt;, and one driver reload if the radio came up deaf — which this driver does after Wi-Fi flaps, because it only leaves station state on an explicit type change. If &lt;code&gt;wlan1&lt;&#x2F;code&gt; never appears, the cable is the thing to check, not the software.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#references&quot; aria-label=&quot;Anchor link for: references&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;amrosia&#x2F;8814au-android&quot;&gt;Driver fork with the Android GKI patches and build instructions&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;morrownr&#x2F;8814au&quot;&gt;morrownr&#x2F;8814au, the upstream out-of-tree driver&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.kernel.org&#x2F;doc&#x2F;html&#x2F;latest&#x2F;driver-api&#x2F;80211&#x2F;cfg80211.html&quot;&gt;cfg80211 and mac80211 documentation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;source.android.com&#x2F;docs&#x2F;core&#x2F;architecture&#x2F;kernel&#x2F;generic-kernel-image&quot;&gt;Android Generic Kernel Image and the stable KMI&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;derv82&#x2F;wifite2&quot;&gt;wifite2&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        <summary type="html">Give a rooted tablet a second radio: USB host mode over the Type-C port, a driver built for its exact kernel, and monitor mode for packet capture.</summary>
        </entry>
</feed>
