Update to native-first driver model + user build docs

Confirmed kernel modules on Pixel 10 Pro Fold (rango):
All gamepad drivers native (xpad, hid-playstation, hid-nintendo,
hid-sony, hid-microsoft, hid-logitech, hid-steam, wacom).
SDR uses userspace USB (no kernel modules). WiFi nexmon and
joydev need user-built firmware/modules — documented in
BUILDING_MODULES.md with full instructions.
This commit is contained in:
sssnake
2026-03-31 07:20:55 -07:00
parent 50f4b718ce
commit 7776b6c497
4 changed files with 387 additions and 167 deletions

195
BUILDING_MODULES.md Normal file
View File

@@ -0,0 +1,195 @@
# Building Custom Kernel Modules & Firmware
This module works out of the box for everything that's native to the Pixel 10 Pro Fold kernel.
Some features need extra firmware or kernel modules you build yourself.
## What's Already Native (No Build Needed)
| Component | Driver | Status |
|-----------|--------|--------|
| GPU | pvrsrvkm (PowerVR DXT-48-1536) | Built-in, Vulkan 1.4 / GLES 3.x / OpenCL 3.0 |
| WiFi | bcmdhd4390 (Broadcom BCM4390) | Built-in, Wi-Fi 7 / WFD R2 / P2P |
| Bluetooth | btqca + btbcm + rfcomm + hidp | Built-in |
| Xbox Controllers | xpad | Built-in (CONFIG_JOYSTICK_XPAD=y) |
| PS5 DualSense | hid-playstation | Built-in |
| PS4 DualShock | hid-sony | Built-in |
| Switch Pro / Joy-Con | hid-nintendo | Built-in |
| Xbox One (BT) | hid-microsoft | Built-in |
| Logitech (F310/F710) | hid-logitech + hidpp | Built-in |
| Steam Controller | hid-steam | Built-in |
| Wacom Tablets | wacom | Built-in |
| 8BitDo / Generic | hid-generic | Built-in |
| USB Audio | snd_usb_audio | Built-in |
| USB Serial (FTDI) | ftdi_sio | Built-in |
| USB CDC ACM | cdc_acm | Built-in |
| USB Cameras | uvcvideo | Built-in |
| WireGuard VPN | wireguard | Built-in |
## What Needs User Action
### 1. SDR Devices (RTL-SDR, HackRF, Airspy, LimeSDR)
**No kernel modules needed.** All SDR devices on Android use userspace USB libraries.
The module handles USB permissions automatically.
**Setup in Termux:**
```bash
pkg update && pkg install -y rtl-sdr hackrf
```
This gives you: `rtl_sdr`, `rtl_fm`, `rtl_adsb`, `rtl_power`, `rtl_tcp`, `hackrf_transfer`, `hackrf_sweep`
**Android apps that work with USB OTG SDR:**
- SDR Touch (RTL-SDR)
- RF Analyzer (RTL-SDR)
- Aerial TV (DVB-T via RTL-SDR)
- SDR++ (if compiled for Android via Termux)
**Switching between DVB-T and SDR:**
There's no kernel conflict on this device (no DVB modules compiled in).
Just use the appropriate app — Aerial TV for DVB-T, SDR Touch for scanning.
### 2. Nexmon WiFi Monitor/Injection Mode
The BCM4390 is a new chip. Nexmon does NOT officially support it yet.
**To check for support:**
```bash
git clone https://github.com/seemoo-lab/nexmon
grep -r "4390" nexmon/
```
**If/when BCM4390 patches become available:**
1. Clone nexmon and set up the build environment:
```bash
# In Termux or a Linux build machine
git clone https://github.com/seemoo-lab/nexmon
cd nexmon
source setup_env.sh
make
```
2. Build the patched firmware for BCM4390:
```bash
cd patches/bcm4390/<firmware_version>/nexmon
make
```
3. Copy the firmware files to the module:
```bash
# Monitor mode firmware
cp <built_firmware>.bin /data/adb/modules/driver-manager/firmware/fw_bcm4390_monitor.bin
# Injection mode firmware (if separate)
cp <built_firmware_inject>.bin /data/adb/modules/driver-manager/firmware/fw_bcm4390_injection.bin
```
4. Switch mode via WebUI or manually:
```bash
echo "monitor" > /data/adb/modules/driver-manager/config/wifi_mode
sh /data/adb/modules/driver-manager/service.sh
```
**Currently supported Broadcom chips with nexmon:**
BCM4330, BCM4335b0, BCM4339, BCM43430a1, BCM43439a0, BCM43451b1,
BCM43455c0, BCM43436b0, BCM4375b1, BCM4389c1, BCM4398d0
### 3. Joydev (/dev/input/jsX)
The kernel has `CONFIG_INPUT_JOYDEV` disabled. Most Android games use evdev
(`/dev/input/eventX`) which works fine. If you need joydev for a specific app:
**Option A: Build joydev.ko**
You need the kernel source matching your device's kernel version.
```bash
# Get kernel version
uname -r
# Clone the kernel source
# For Pixel 10 (rango), the source is in the Android kernel common tree
repo init -u https://android.googlesource.com/kernel/manifest -b android-gs-laguna-<version>
repo sync -c
# Build the module
make ARCH=arm64 modules_prepare
make ARCH=arm64 M=drivers/input/joydev modules
```
Copy `joydev.ko` to `/data/adb/modules/driver-manager/modules/` and it will
be loaded on next boot.
**Option B: Use a custom kernel** that has joydev compiled in.
### 4. GPU Driver Updates
The PowerVR GPU driver is updatable via Google Play (Game Update Pack).
This module sets `ro.gfx.driver.1` to request the updatable driver.
**To check current driver version:**
```bash
dumpsys gpu | grep -i version
# or
getprop ro.gfx.driver.1
```
**To force a specific driver version:**
If Google hasn't pushed v25.1+ yet, check:
- Settings > System > System Update (driver updates come with security patches)
- The Android 16 QPR3 update bumps the driver to v1.634.2906
### 5. OpenCL (CUDA Alternative)
There is no CUDA on Android (NVIDIA only). PowerVR supports OpenCL 3.0 instead.
**To use OpenCL on Pixel 10:**
- PowerVR OpenCL library: `/vendor/lib64/libPVROCL.so`
- Use compute mode in this module to enable FP16 and max GPU freq
- Vulkan compute shaders are also an option for GPU workloads
**Termux OpenCL setup:**
```bash
pkg install -y clinfo opencl-headers
clinfo # Should show PowerVR device
```
## Kernel Module Loading via KernelSU
KernelSU supports loading `.ko` files. Place them in:
```
/data/adb/modules/driver-manager/modules/<name>.ko
```
The module will `insmod` any `.ko` files found at boot.
**Important:** Modules must be compiled against the exact kernel version
running on your device. Mismatched modules will fail to load with
"Invalid module format" or segfault.
Check your kernel version:
```bash
uname -r
cat /proc/version
```
## USB Device Reference
| Device | Vendor:Product | Type |
|--------|---------------|------|
| RTL-SDR v1 | 0bda:2832 | Userspace USB |
| RTL-SDR v3 | 0bda:2838 | Userspace USB |
| RTL-SDR v4 | 0bda:2840 | Userspace USB |
| HackRF One | 1d50:6089 | Userspace USB |
| Airspy Mini | 1d50:60a1 | Userspace USB |
| Airspy HF+ | 1d50:6108 | Userspace USB |
| LimeSDR Mini | 04b4:00f3 | Userspace USB |
| SDRplay RSP1 | 1df7:2500 | Userspace USB |
| SDRplay RSP2 | 1df7:3020 | Userspace USB |
| Xbox Controller | 045e:028e | Native xpad |
| PS5 DualSense | 054c:0ce6 | Native hid-playstation |
| PS4 DualShock | 054c:09cc | Native hid-sony |
| Switch Pro | 057e:2009 | Native hid-nintendo |
| 8BitDo | Various | Native hid-generic |

BIN
driver-manager-v1.0.0.zip Normal file

Binary file not shown.

View File

@@ -1,6 +1,16 @@
#!/system/bin/sh #!/system/bin/sh
# Driver Manager - late service # Driver Manager - late service
# Manages GPU, WiFi, Bluetooth, SDR, and game controller drivers # Manages GPU, WiFi, Bluetooth, SDR, and game controller drivers
#
# Native kernel support confirmed on Pixel 10 Pro Fold (rango):
# GPU: pvrsrvkm (PowerVR DXT-48-1536) — built-in
# WiFi: bcmdhd4390 (Broadcom BCM4390) — built-in
# Bluetooth: btqca, btbcm, bluetooth, rfcomm, hidp — built-in
# Controllers: xpad, hid-playstation, hid-nintendo, hid-sony,
# hid-microsoft, hid-logitech, hid-steam, wacom — all built-in
# USB: usbhid, usb_storage, ftdi_sio, cdc_acm, snd_usb_audio — built-in
# SDR: No kernel DVB/SDR modules — all SDR uses userspace USB via OTG
# (librtlsdr, libhackrf, libairspy talk directly to USB device)
MODDIR=${0%/*} MODDIR=${0%/*}
LOGFILE="$MODDIR/driver-manager.log" LOGFILE="$MODDIR/driver-manager.log"
@@ -30,91 +40,109 @@ GPU=$(getprop ro.hardware.egl)
mlog "Boot complete. Device=$DEVICE SoC=$SOC Platform=$PLATFORM API=$API GPU=$GPU" mlog "Boot complete. Device=$DEVICE SoC=$SOC Platform=$PLATFORM API=$API GPU=$GPU"
# ============================================================ # ============================================================
# GPU DRIVER MANAGEMENT — PowerVR DXT-48-1536 # GPU — PowerVR DXT-48-1536 (pvrsrvkm, native)
# ============================================================ # ============================================================
# Tensor G5 shipped with outdated v24.3 drivers # Vulkan 1.4, OpenGL ES 3.x, OpenCL 3.0
# v25.1+ adds Vulkan 1.4, better thermal efficiency # Driver: /vendor/lib64/egl/libGLES_powervr.so
# Driver files live in /vendor/lib64/egl/ and /vendor/firmware/ # Firmware: /vendor/firmware/powervr/
GPU_MODE=$(cat "$CONFDIR/gpu_mode" 2>/dev/null || echo "performance") GPU_MODE=$(cat "$CONFDIR/gpu_mode" 2>/dev/null || echo "performance")
case "$GPU_MODE" in case "$GPU_MODE" in
performance) performance)
# Max GPU clock, prefer quality
resetprop vendor.powervr.gpu.freq_hint max
resetprop debug.hwui.renderer skiagl
resetprop debug.renderengine.backend skiavk resetprop debug.renderengine.backend skiavk
resetprop debug.hwui.renderer skiagl
resetprop debug.hwui.use_hint_manager true resetprop debug.hwui.use_hint_manager true
mlog "GPU mode: performance (Vulkan renderer, max freq)" # Request max GPU frequency via thermal hint
echo "max" > /sys/class/powervr/frequency_hint 2>/dev/null
mlog "GPU: performance (Vulkan render, max freq)"
;; ;;
balanced) balanced)
resetprop vendor.powervr.gpu.freq_hint auto
resetprop debug.hwui.renderer skiagl
resetprop debug.renderengine.backend skiaglthreaded resetprop debug.renderengine.backend skiaglthreaded
mlog "GPU mode: balanced" resetprop debug.hwui.renderer skiagl
echo "auto" > /sys/class/powervr/frequency_hint 2>/dev/null
mlog "GPU: balanced"
;; ;;
powersave) powersave)
resetprop vendor.powervr.gpu.freq_hint min
resetprop debug.hwui.renderer skiagl
resetprop debug.renderengine.backend skiagl resetprop debug.renderengine.backend skiagl
mlog "GPU mode: powersave" resetprop debug.hwui.renderer skiagl
echo "min" > /sys/class/powervr/frequency_hint 2>/dev/null
mlog "GPU: powersave"
;; ;;
compute) compute)
# Optimized for OpenCL workloads # OpenCL compute priority — CUDA alternative
resetprop vendor.powervr.opencl.allowfp16 1 resetprop vendor.powervr.opencl.allowfp16 1
resetprop vendor.powervr.opencl.profiling 1 resetprop vendor.powervr.opencl.profiling 1
resetprop vendor.powervr.gpu.freq_hint max echo "max" > /sys/class/powervr/frequency_hint 2>/dev/null
mlog "GPU mode: compute (OpenCL optimized)" mlog "GPU: compute (OpenCL 3.0, FP16 enabled)"
;; ;;
esac esac
# Force Vulkan 1.4 feature level if driver supports it # Updatable GPU driver — Pixel 10 supports Game Update Pack
# v25.1+ brings Vulkan 1.4 and major perf improvements over v24.3
resetprop ro.gfx.driver.1 com.google.pixel.powervr.gfxdriver resetprop ro.gfx.driver.1 com.google.pixel.powervr.gfxdriver
mlog "GPU: PowerVR DXT-48-1536, Vulkan 1.4, OpenGL ES 3.x, OpenCL 3.0" mlog "GPU driver: PowerVR DXT-48-1536 (pvrsrvkm native)"
# ============================================================ # ============================================================
# WIFI DRIVER MANAGEMENT — BCM4390 (bcmdhd4390) # WIFI — BCM4390 (bcmdhd4390, native)
# ============================================================ # ============================================================
# Modes: standard, monitor, injection (nexmon), mesh # Capabilities: Wi-Fi 7, WFD R2, P2P, VHT, DFS
# Firmware: /vendor/firmware/fw_bcmdhd4390.bin
WIFI_MODE=$(cat "$CONFDIR/wifi_mode" 2>/dev/null || echo "standard") WIFI_MODE=$(cat "$CONFDIR/wifi_mode" 2>/dev/null || echo "standard")
case "$WIFI_MODE" in case "$WIFI_MODE" in
standard) standard)
# Normal operation
resetprop wifi.direct.interface p2p-dev-wlan0 resetprop wifi.direct.interface p2p-dev-wlan0
mlog "WiFi mode: standard" resetprop wifi.direct.go_intent 15
mlog "WiFi: standard (P2P enabled)"
;; ;;
monitor) monitor)
# Enable monitor mode on BCM4390 # BCM4390 monitor mode via nexmon firmware patch
# Requires nexmon-patched firmware or native support
if [ -f "$MODDIR/firmware/fw_bcm4390_monitor.bin" ]; then if [ -f "$MODDIR/firmware/fw_bcm4390_monitor.bin" ]; then
# Back up stock firmware on first use
if [ ! -f "$MODDIR/firmware/fw_bcm4390_stock.bin" ]; then
cp /vendor/firmware/fw_bcmdhd4390.bin "$MODDIR/firmware/fw_bcm4390_stock.bin"
mlog "WiFi: backed up stock firmware"
fi
cp "$MODDIR/firmware/fw_bcm4390_monitor.bin" /vendor/firmware/fw_bcmdhd4390.bin cp "$MODDIR/firmware/fw_bcm4390_monitor.bin" /vendor/firmware/fw_bcmdhd4390.bin
mlog "WiFi mode: monitor (nexmon firmware loaded)" # Reload driver
echo 1 > /sys/module/bcmdhd4390/parameters/reload 2>/dev/null
mlog "WiFi: monitor mode (nexmon firmware loaded)"
else else
# Try native monitor via iw/ip mlog "WiFi: monitor mode requested — nexmon firmware not found"
mlog "WiFi mode: monitor (native, nexmon firmware not found)" mlog "WiFi: see BUILDING_MODULES.md for instructions"
fi fi
;; ;;
injection) injection)
# Frame injection — requires nexmon patches for BCM4390
if [ -f "$MODDIR/firmware/fw_bcm4390_injection.bin" ]; then if [ -f "$MODDIR/firmware/fw_bcm4390_injection.bin" ]; then
if [ ! -f "$MODDIR/firmware/fw_bcm4390_stock.bin" ]; then
cp /vendor/firmware/fw_bcmdhd4390.bin "$MODDIR/firmware/fw_bcm4390_stock.bin"
fi
cp "$MODDIR/firmware/fw_bcm4390_injection.bin" /vendor/firmware/fw_bcmdhd4390.bin cp "$MODDIR/firmware/fw_bcm4390_injection.bin" /vendor/firmware/fw_bcmdhd4390.bin
mlog "WiFi mode: injection (nexmon firmware loaded)" echo 1 > /sys/module/bcmdhd4390/parameters/reload 2>/dev/null
mlog "WiFi: injection mode (nexmon firmware loaded)"
else else
mlog "WiFi mode: injection requested but no nexmon firmware" mlog "WiFi: injection requested nexmon firmware not found"
mlog "WiFi: see BUILDING_MODULES.md for instructions"
fi fi
;; ;;
mesh) restore)
# 802.11s mesh networking # Restore stock firmware
resetprop wifi.interface wlan0 if [ -f "$MODDIR/firmware/fw_bcm4390_stock.bin" ]; then
mlog "WiFi mode: mesh (802.11s)" cp "$MODDIR/firmware/fw_bcm4390_stock.bin" /vendor/firmware/fw_bcmdhd4390.bin
echo 1 > /sys/module/bcmdhd4390/parameters/reload 2>/dev/null
mlog "WiFi: stock firmware restored"
fi
echo "standard" > "$CONFDIR/wifi_mode"
mlog "WiFi: restored to standard"
;; ;;
esac esac
# ============================================================ # ============================================================
# BLUETOOTH DRIVER MANAGEMENT — QCA (btqca) # BLUETOOTH — QCA + BCM (btqca, btbcm, native)
# ============================================================ # ============================================================
# rfcomm, hidp, bluetooth all built into kernel
BT_MODE=$(cat "$CONFDIR/bt_mode" 2>/dev/null || echo "standard") BT_MODE=$(cat "$CONFDIR/bt_mode" 2>/dev/null || echo "standard")
@@ -124,178 +152,175 @@ case "$BT_MODE" in
resetprop bluetooth.profile.hfp.ag.enabled true resetprop bluetooth.profile.hfp.ag.enabled true
resetprop bluetooth.profile.hid.host.enabled true resetprop bluetooth.profile.hid.host.enabled true
resetprop bluetooth.profile.pan.nap.enabled true resetprop bluetooth.profile.pan.nap.enabled true
mlog "BT mode: standard" mlog "BT: standard"
;; ;;
pentest) pentest)
# Enable all profiles + raw HCI access for BLE scanning/exploitation # All profiles enabled, raw HCI access
resetprop bluetooth.profile.a2dp.source.enabled true resetprop bluetooth.profile.a2dp.source.enabled true
resetprop bluetooth.profile.hfp.ag.enabled true resetprop bluetooth.profile.hfp.ag.enabled true
resetprop bluetooth.profile.hid.host.enabled true resetprop bluetooth.profile.hid.host.enabled true
resetprop bluetooth.profile.hid.device.enabled true resetprop bluetooth.profile.hid.device.enabled true
resetprop bluetooth.profile.pan.nap.enabled true resetprop bluetooth.profile.pan.nap.enabled true
resetprop bluetooth.profile.opp.enabled true resetprop bluetooth.profile.opp.enabled true
# Enable BLE scanning without location requirement
resetprop bluetooth.le.disable_apcf_extended_features 0 resetprop bluetooth.le.disable_apcf_extended_features 0
mlog "BT mode: pentest (all profiles, raw HCI)" # Allow BLE scan without location
resetprop bluetooth.le.no_location_permission_scan true
mlog "BT: pentest (all profiles + raw HCI)"
;; ;;
disabled) disabled)
resetprop bluetooth.profile.a2dp.source.enabled false resetprop bluetooth.profile.a2dp.source.enabled false
resetprop bluetooth.profile.hfp.ag.enabled false resetprop bluetooth.profile.hfp.ag.enabled false
mlog "BT mode: disabled" resetprop bluetooth.profile.hid.host.enabled false
mlog "BT: disabled"
;; ;;
esac esac
# ============================================================ # ============================================================
# SDR DRIVER MANAGEMENT — RTL-SDR, HackRF, Airspy, LimeSDR # SDR — Userspace USB (no kernel modules needed)
# ============================================================ # ============================================================
# Kernel modules for USB SDR devices via OTG # RTL-SDR, HackRF, Airspy, LimeSDR all use userspace USB libs
# DVB-T vs SDR mode switching for RTL-SDR # Android apps (SDR Touch, RF Analyzer) or Termux tools
# (rtl_sdr, hackrf_transfer, etc.) talk directly to USB device.
#
# The kernel has NO DVB/RTL-SDR modules compiled in, so there's
# no DVB-T vs SDR conflict to manage — it's always userspace.
#
# What we DO manage: USB device permissions and decoder processes
SDR_MODE=$(cat "$CONFDIR/sdr_mode" 2>/dev/null || echo "sdr") SDR_MODE=$(cat "$CONFDIR/sdr_mode" 2>/dev/null || echo "sdr")
# Load USB SDR kernel modules if available # Ensure USB OTG is enabled for SDR dongles
load_sdr_module() { resetprop persist.sys.usb.otg 1
MOD_NAME=$1
MOD_PATH="$MODDIR/modules/$MOD_NAME.ko" # Set USB device permissions for known SDR hardware
if [ -f "$MOD_PATH" ]; then # This runs udev-style permission fixing for USB devices
insmod "$MOD_PATH" 2>/dev/null fix_sdr_permissions() {
if [ $? -eq 0 ]; then # Find USB devices by vendor:product and chmod them
mlog "SDR: loaded $MOD_NAME" for dev in /dev/bus/usb/*/*; do
else [ -e "$dev" ] || continue
mlog "SDR: failed to load $MOD_NAME (kernel mismatch?)" # Read vendor/product from sysfs
fi USBDEV=$(readlink -f "$dev" 2>/dev/null)
fi VENDOR=$(cat "$(dirname "$USBDEV")/idVendor" 2>/dev/null)
PRODUCT=$(cat "$(dirname "$USBDEV")/idProduct" 2>/dev/null)
case "$VENDOR:$PRODUCT" in
0bda:2832|0bda:2838|0bda:2840) # RTL-SDR v1-v4
chmod 666 "$dev" 2>/dev/null
mlog "SDR USB: RTL-SDR at $dev"
;;
1d50:6089) # HackRF One
chmod 666 "$dev" 2>/dev/null
mlog "SDR USB: HackRF at $dev"
;;
1d50:60a1) # Airspy
chmod 666 "$dev" 2>/dev/null
mlog "SDR USB: Airspy at $dev"
;;
1d50:6108) # Airspy HF+
chmod 666 "$dev" 2>/dev/null
mlog "SDR USB: Airspy HF+ at $dev"
;;
0403:6014|04b4:00f3) # LimeSDR (FTDI/Cypress)
chmod 666 "$dev" 2>/dev/null
mlog "SDR USB: LimeSDR at $dev"
;;
1df7:2500|1df7:3020) # SDRplay RSP1/RSP2
chmod 666 "$dev" 2>/dev/null
mlog "SDR USB: SDRplay at $dev"
;;
esac
done
} }
fix_sdr_permissions
case "$SDR_MODE" in case "$SDR_MODE" in
sdr) sdr)
# SDR scanner mode — blacklist DVB-T drivers, use userspace RTL-SDR mlog "SDR: scanner mode (userspace USB, all devices)"
# Remove DVB-T kernel module if loaded (conflicts with librtlsdr)
rmmod dvb_usb_rtl28xxu 2>/dev/null
rmmod dvb_usb_rtl2832u 2>/dev/null
rmmod rtl2832 2>/dev/null
rmmod rtl2832_sdr 2>/dev/null
rmmod dvb_usb_v2 2>/dev/null
# Load HackRF module
load_sdr_module "hackrf"
# Load Airspy module
load_sdr_module "airspy"
# Set USB permissions for SDR devices
# RTL-SDR: vendor 0x0bda, products 0x2832 0x2838
# HackRF: vendor 0x1d50, product 0x6089
# Airspy: vendor 0x1d50, product 0x60a1
# LimeSDR: vendor 0x0403 (FTDI) or 0x04b4 (Cypress)
mlog "SDR mode: scanner (DVB-T blacklisted, userspace SDR)"
;; ;;
dvbt) dvbt)
# DVB-T digital TV mode — load DVB kernel drivers # DVB-T mode — uses same USB device but with DVB-T app
load_sdr_module "dvb_usb_rtl28xxu" # No kernel module switching needed; app handles the protocol
load_sdr_module "rtl2832" mlog "SDR: DVB-T mode (userspace, Aerial TV or similar app)"
load_sdr_module "rtl2832_sdr"
# Remove conflicting SDR modules
rmmod hackrf 2>/dev/null
rmmod airspy 2>/dev/null
mlog "SDR mode: DVB-T (digital TV receiver)"
;; ;;
hackrf) hackrf)
# HackRF-only mode — TX/RX capable mlog "SDR: HackRF TX/RX mode (userspace USB)"
rmmod dvb_usb_rtl28xxu 2>/dev/null
load_sdr_module "hackrf"
mlog "SDR mode: HackRF (TX/RX enabled)"
;; ;;
off) off)
# Unload all SDR modules mlog "SDR: off"
rmmod hackrf 2>/dev/null ;;
rmmod airspy 2>/dev/null esac
rmmod dvb_usb_rtl28xxu 2>/dev/null
rmmod rtl2832 2>/dev/null # SDR decoder management
mlog "SDR mode: off" DECODER_MODE=$(cat "$CONFDIR/decoder_mode" 2>/dev/null || echo "off")
TERMUX_BIN="/data/data/com.termux/files/usr/bin"
case "$DECODER_MODE" in
adsb)
if [ -x "$TERMUX_BIN/rtl_adsb" ]; then
"$TERMUX_BIN/rtl_adsb" > "$MODDIR/adsb_output.txt" 2>/dev/null &
mlog "Decoder: ADS-B started via Termux (1090 MHz)"
else
mlog "Decoder: ADS-B requested — install rtl-sdr in Termux"
fi
;;
fm)
FREQ=$(cat "$CONFDIR/fm_freq" 2>/dev/null || echo "100.0M")
if [ -x "$TERMUX_BIN/rtl_fm" ]; then
"$TERMUX_BIN/rtl_fm" -f "$FREQ" -M wbfm -s 200000 -r 48000 - 2>/dev/null | \
"$TERMUX_BIN/aplay" -r 48000 -f S16_LE -t raw -c 1 2>/dev/null &
mlog "Decoder: FM radio ($FREQ) via Termux"
else
mlog "Decoder: FM requested — install rtl-sdr in Termux"
fi
;;
spectrum)
RANGE=$(cat "$CONFDIR/spectrum_range" 2>/dev/null || echo "24M:1800M")
if [ -x "$TERMUX_BIN/rtl_power" ]; then
"$TERMUX_BIN/rtl_power" -f "$RANGE" -g 50 -i 1 "$MODDIR/spectrum_data.csv" 2>/dev/null &
mlog "Decoder: spectrum scan ($RANGE) via Termux"
else
mlog "Decoder: spectrum requested — install rtl-sdr in Termux"
fi
;;
off)
# Kill any running decoders
pkill -f rtl_adsb 2>/dev/null
pkill -f rtl_fm 2>/dev/null
pkill -f rtl_power 2>/dev/null
mlog "Decoder: off"
;; ;;
esac esac
# ============================================================ # ============================================================
# GAME CONTROLLER DRIVERS — Xbox, PS5, Switch Pro, 8BitDo # GAME CONTROLLERS — All native, all built into kernel
# ============================================================ # ============================================================
# Android already has HID support but some controllers need # xpad (Xbox) — CONFIG_JOYSTICK_XPAD=y
# specific prop tweaks or module loading for full support # hid-playstation (PS5 DualSense, PS4 DualShock) — built-in
# hid-nintendo (Switch Pro, Joy-Con) — built-in
# hid-sony (PS3 Sixaxis, PS4 DS4) — built-in
# hid-microsoft (Xbox One BT) — built-in
# hid-logitech + hidpp (F310, F710, etc.) — built-in
# hid-steam (Steam Controller) — built-in
# wacom (drawing tablets) — built-in
# hid-generic (8BitDo, generic HID gamepads) — built-in
#
# NOTE: CONFIG_INPUT_JOYDEV is NOT set, so /dev/input/jsX
# does not exist. Games use /dev/input/eventX via evdev instead,
# which is standard on Android. Apps that need joydev will need
# a custom kernel — see BUILDING_MODULES.md
GAMEPAD_MODE=$(cat "$CONFDIR/gamepad_mode" 2>/dev/null || echo "auto") GAMEPAD_MODE=$(cat "$CONFDIR/gamepad_mode" 2>/dev/null || echo "auto")
case "$GAMEPAD_MODE" in case "$GAMEPAD_MODE" in
auto) auto)
# Enable all supported gamepad types # All controllers already supported natively
# Just ensure the HID input prop is set
resetprop input.gamepad.enabled true resetprop input.gamepad.enabled true
mlog "Controllers: auto (xpad, hid-playstation, hid-nintendo, hid-sony, hid-microsoft, hid-logitech, hid-steam, wacom — all native)"
# Xbox controller — xpad or xone kernel module
load_sdr_module "xpad"
# PS5 DualSense — hid-playstation
load_sdr_module "hid-playstation"
# Nintendo Switch Pro — hid-nintendo
load_sdr_module "hid-nintendo"
# 8BitDo and generic HID gamepads — standard HID stack
# Ensure hid-generic is loaded
load_sdr_module "hid-generic"
mlog "Gamepad mode: auto (all controllers enabled)"
;;
xbox)
load_sdr_module "xpad"
mlog "Gamepad mode: Xbox"
;;
playstation)
load_sdr_module "hid-playstation"
mlog "Gamepad mode: PlayStation DualSense"
;;
nintendo)
load_sdr_module "hid-nintendo"
mlog "Gamepad mode: Nintendo Switch Pro"
;; ;;
off) off)
mlog "Gamepad mode: off" mlog "Controllers: off (native drivers still loaded, cannot unload built-in)"
;;
esac
# ============================================================
# SDR DECODERS — Auto-start background decoders if configured
# ============================================================
DECODER_MODE=$(cat "$CONFDIR/decoder_mode" 2>/dev/null || echo "off")
case "$DECODER_MODE" in
adsb)
# ADS-B aircraft tracking on 1090 MHz
if command -v rtl_adsb >/dev/null 2>&1; then
rtl_adsb &
mlog "Decoder: ADS-B started (1090 MHz)"
fi
;;
fm)
FREQ=$(cat "$CONFDIR/fm_freq" 2>/dev/null || echo "100.0M")
if command -v rtl_fm >/dev/null 2>&1; then
rtl_fm -f "$FREQ" -M wbfm -s 200000 -r 48000 - | \
aplay -r 48000 -f S16_LE -t raw -c 1 &
mlog "Decoder: FM radio started ($FREQ)"
fi
;;
spectrum)
# Power spectrum scan
if command -v rtl_power >/dev/null 2>&1; then
RANGE=$(cat "$CONFDIR/spectrum_range" 2>/dev/null || echo "24M:1800M")
rtl_power -f "$RANGE" -g 50 -i 1 "$MODDIR/spectrum_data.csv" &
mlog "Decoder: spectrum scan started ($RANGE)"
fi
;;
off)
mlog "Decoder: off"
;; ;;
esac esac

View File

@@ -177,9 +177,9 @@
</div> </div>
<select class="sel" id="wifiMode" onchange="setMode('wifi_mode', this.value)"> <select class="sel" id="wifiMode" onchange="setMode('wifi_mode', this.value)">
<option value="standard">Standard</option> <option value="standard">Standard</option>
<option value="monitor">Monitor</option> <option value="monitor">Monitor (Nexmon)</option>
<option value="injection">Injection (Nexmon)</option> <option value="injection">Injection (Nexmon)</option>
<option value="mesh">Mesh (802.11s)</option> <option value="restore">Restore Stock</option>
</select> </select>
</div> </div>
<div class="row"> <div class="row">
@@ -247,7 +247,7 @@
<div class="row"> <div class="row">
<div> <div>
<div class="row-label">Controller Mode</div> <div class="row-label">Controller Mode</div>
<div class="row-desc">Xbox / PS5 / Switch Pro / 8BitDo / Generic</div> <div class="row-desc">All native: Xbox, PS5, PS4, Switch, Steam, Logitech, 8BitDo, Wacom</div>
</div> </div>
<select class="sel" id="gamepadMode" onchange="setMode('gamepad_mode', this.value)"> <select class="sel" id="gamepadMode" onchange="setMode('gamepad_mode', this.value)">
<option value="auto">Auto (All)</option> <option value="auto">Auto (All)</option>