On LineageOS 23.2, how to use `adb`, without having to plug a USB cable or use Wi-Fi, thanks to Magisk `root`? Note that I am aware that Magisk `root` gives me equivalent `shell` access.
May 15, 1:53pm
On LineageOS 23.2 (or any Android device with Magisk root), you can enable ADB over TCP/IP without a USB cable or Wi-Fi by using the adbd daemon directly via a root shell. This method leverages the fact that Magisk provides root access, allowing you to start the ADB daemon in TCP mode manually.
Here’s how to do it:
1. Start adbd in TCP Mode via Root Shell
Run the following commands in a root shell (e.g., via Termux with su, or directly in adbd if already connected via USB once):
bash
su
setprop service.adb.tcp.port 5555
stop adbd
start adbd
This binds adbd to port 5555 on all network interfaces (including local loopback and LAN).
Replace 5555 with your preferred port if needed.
2. Connect from Your Computer
On your computer, run:
bash
adb connect <device-ip>:5555
Replace <device-ip> with your device’s local IP address (e.g., 192.168.1.100).
If you’re on the same machine (e.g., using Termux), you can also use adb connect localhost:5555.
3. Verify the Connection
Check if the device is listed:
bash
adb devices
You should see your device with the IP:port.
4. (Optional) Persist Across Reboots
To make this persistent, create a Magisk module or a root script (e.g., in /data/adb/post-fs-data.d/) to run the above commands at boot.