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:
adbd in TCP Mode via Root ShellRun the following commands in a root shell (e.g., via Termux with su, or directly in adbd if already connected via USB once):
bashsu setprop service.adb.tcp.port 5555 stop adbd start adbd
adbd to port 5555 on all network interfaces (including local loopback and LAN).5555 with your preferred port if needed.On your computer, run:
bashadb connect <device-ip>:5555
<device-ip> with your device’s local IP address (e.g., 192.168.1.100).adb connect localhost:5555.Check if the device is listed:
bashadb devices
You should see your device with the IP:port.
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.
Example Magisk Module:
text/sdcard/Download/adb-tcp/ ├── customize.sh └── post-fs-data.sh
post-fs-data.sh, add:
bash#!/system/bin/sh setprop service.adb.tcp.port 5555 stop adbd start adbd
netstat -tuln).su access. If you lose root, the daemon will revert to USB-only mode.setprop service.adb.tcp.port forces adbd to listen on TCP.stop adbd && start adbd restarts the daemon with the new settings.Alternative: If you have Termux, you can also run adb commands directly from the device itself (e.g., adb shell from Termux to another device).