u/Hungry-Advisor-5152

[ROOT] Gamepad as Mouse on Any Android Devices? - GPad2Mouse

🎮 GPad2Mouse Pro v7.1 [ROOT] (Free Version v3.1)

The ultimate system-level driver to transform your Gamepad into a precision Virtual Mouse on Android. No third-party overlay apps, no input lag, 100% Kernel-level injection.

💎 PRO FEATURES (vs Free Version)

Feature Basic (Free) PRO Hybrid (v7.1)
Auto-Detect & Config ✅ Yes Universal Profile
Smooth Mouse Pointer ✅ Yes ✅ Yes
Left Click (RB) ✅ Yes ✅ Yes
Hybrid Toggle (START + LB) ❌ No Switch Instantly
Exclusive Control (Grab) ❌ No Anti-Ghosting
Speed Modifier (LT/RT) ❌ No Sniper & Turbo
Turbo Scrolling ❌ No LT/RT Boosted
Volume Control (Left Analog Stick) ❌ No Remote Mode
Full Navigation (A,B,X,Y) ❌ No Enter/Back/Home
D-Pad Navigation ❌ No Arrow Keys Mode
System Shortcuts (L3/R3) ❌ No Recents / Notif

🛡️ IS THIS SAFE? (No Malware Guarantee)

We understand your concern regarding Root access. We guarantee that GPad2Mouse is 100% CLEAN from any malware, miners, or trackers.

  • Full Transparency: The source code for the Basic version is available for audit in this repository.
  • Scan It Yourself: You can verify our files (.py, .sh, or .zip) using:
    • VirusTotal (Online): virustotal.com
    • Local Scan: Use Malwarebytes Mobile or Sophos Intercept X. Note: Some antivirus may flag "Root-Tools" as a risk simply because they require Superuser access to function.

🕹️ SUPPORTED CONTROLLERS & ARCHITECTURE

  • Processors: Fully supports 32-bit (ARM) and 64-bit (ARM64) Android systems.
  • Controllers: Optimized for X-Input (Original Xbox 360 / Xbox One / Xbox Series Controllers, Cheap Gamepad X3/T3 with Xbox Mode enabled) and PlayStation (PS3/PS4/PS5).
  • With this update (Pro v7.1 and Free v3.1) it is guaranteed to support all types of Gamepads/Controllers that have Analog Sticks by using gpad2mouse_mapper.py.

📱 TESTED ON DEVICES

GPad2Mouse has been rigorously tested and confirmed working on:

  • Realme 8i (Android 11 - 64-bit / Magisk)
  • STB HG680P (Android 6.0 - 32-bit / SuperSU)
  • Samsung Galaxy Note 3 (HA3G) (Custom ROM Android 7.1.2 - 32-bit / Magisk)
  • (Should work on almost all Rooted Android devices running Android 5.0 up to Android 14+).

🛠️ PREREQUISITES

  1. Root Access: SuperSU, Magisk, KernelSU, or APatch.
  2. Python Environment for 64-bit devices: You MUST install Py2Droid (Python for Magisk). 👉 Download Py2Droid Here
  3. Python Environment for 32-bit devices: If you are using a non-Magisk device (SuperSU) or an old STB, please follow our Python Transplantation Guide here.

📂 FOLDER STRUCTURE

Inside the ZIP file, you will find this exact structure:

GPad2Mouse_Free_v3.1.zip
├── GPad2Mouse/
│   ├── config.json
│   ├── gpad2mouse_mapper.py
│   └── gpad2mouse_free_v3.1.py
├── README.md
└── service.d/
    └── mouse_boot.sh

📦 INSTALLATION GUIDE (NEW EASY METHOD)

  1. Install Python: You can use Py2Droid (Magisk Module) for 64-bit devices or use the Transplant Method for 32-bit devices.
  2. Extract the ZIP: Extract the downloaded GPad2Mouse ZIP file to your internal storage. Download GPad2Mouse from Codeberg or GitHub.
  3. Copy the Core Folder: Move the entire GPad2Mouse folder into your internal storage root: 👉 /sdcard/GPad2Mouse/
  4. Copy the Boot Script: Move the mouse_boot.sh file into the Magisk service directory: 👉 /data/adb/service.d/
  5. Set Permissions & Run: Open your Terminal App (e.g., Terminal Emulator), grant Root access, and run the boot script. This will automatically deploy the files and start the engine:
  6. Wait & Test: Wait about 10 seconds. Connect your Gamepad and move the Right Analog stick. The cursor should appear!

If you are not using Magisk, the mouse_boot.sh script will not run automatically on boot. You need to inject it into your system's recovery script.

Open your Terminal App, grant su, and run these commands exactly:

su
mount -o rw,remount /system
echo "sh /data/adb/service.d/mouse_boot.sh &" >> /system/etc/install-recovery.sh
chmod 755 /system/etc/install-recovery.sh

Now your GPad2Mouse engine will survive reboots even without Magisk!

(Note: Once installed, the script will automatically run in the background every time you reboot your device).

🎥 INSTALLATION GUIDE VIDEO

Watch on YouTube

🛠️ TROUBLESHOOTING: CURSOR NOT MOVING OR NOT APPEAR? (THE MAPPER TOOL)

If you have run the mouse_boot.sh script but your gamepad does not move the cursor, it means your gamepad's Vendor/Product ID is not in our default database.

Don't worry! We included a Universal Configurator (Mapper) to fix this instantly:

  1. Connect your Gamepad to your device.
  2. Open your Terminal App (su) and run:
  3. Follow the on-screen interactive instructions. It will ask you to press buttons and move the analog sticks.
  4. Once completed, the Mapper will automatically save your gamepad profile to config.json and restart the GPad2Mouse engine!
  5. Enjoy your fully supported Gamepad! 🎮🖱️

🎮 CONTROLS & GESTURES

  • MOVEMENT: Right Analog Stick.
  • LEFT CLICK: RB (Right Bumper).

(From here it is only available in the Pro version) (All Controls & Gestures below are only active when Mouse Mode is ON)

  • TOGGLE MODE: Press START + LB simultaneously to switch between Gamepad Mode and Mouse Mode.
  • MOVEMENT: Right Analog Stick.
  • LEFT CLICK: RB (Right Bumper).
  • RIGHT CLICK: LB (Left Bumper).
  • FAST MOVEMENT (Turbo): Hold RT while moving the cursor.
  • SLOW MOVEMENT (Sniper): Hold LT while moving the cursor.
  • SCROLLING: Left Analog Stick (Up/Down).
  • FAST SCROLLING: Hold RT while scrolling with Left Analog Stick (Up/Down)
  • NOTIFICATIONS: Click Right Analog (R3).
  • RECENT APPS: Click Left Analog (L3).
  • ARROW KEY: DPAD Button.
  • ENTER/CONFIRM: A Button.
  • BACK: B button.
  • BACKSPACE: X Button.
  • HOME: Y Button.

(Below are the new updates v7.1)

  • VOLUME CONTROL: Move the Left Analog to the left or right.
  • MENU: SELECT Button.

👉 Full Documentation and How to Use

🙏 CREDITS & ACKNOWLEDGEMENTS

  • Huge thanks to Mrakorez for creating Py2Droid, the incredible Magisk module that makes running system-level Python on Android possible without Termux.
  • Script developed and optimized by ZHStore Tech-Lab © 2026.
reddit.com
u/Hungry-Advisor-5152 — 6 days ago
▲ 15 r/PythonProjects2+2 crossposts

Direct kernel input injection via Python uinput on Android (GPad2Mouse)

Many developers working with Android automation hit a wall when dealing with input latency. Standard accessibility overlays are too slow. The native solution is injecting events directly into /dev/uinput using Python, but it comes with a major hurdle: Kernel Struct Padding.

When using struct.unpack, 64-bit Android kernels expect a 24-byte event struct (llHHi). However, if you run the same Python script on older 32-bit devices (like Android TV Boxes), it expects a 16-byte struct (IIHHi). Failing to handle this dynamically using sys.maxsize causes instant crash errors.

I've implemented a full working architecture for this concept into an open-source project called GPad2Mouse.

Instead of just mapping keys, it uses Python's fcntl.ioctl to grab exclusive hardware control (EVIOCGRAB), reads VID:PID directly from /sys/class/input/, and dynamically calculates analog deadzones to prevent controller drift—all running as a daemon with 0% CPU overhead.

How to study the code? Due to sub rules against dropping external links, I won't post direct links here. But if you want to see the source code implementation or watch the video demonstration of how the kernel injection works in real-time:

👉 Just Google search: GPad2Mouse

Has anyone else here worked extensively with fcntl on Android? I’d love to hear your approach on handling sudden device disconnections gracefully without freezing the read loop. Cheers!

reddit.com
u/Hungry-Advisor-5152 — 9 days ago