While working on USB-OTG code for interfacing microcontroller with android phones, I faced a problem that your USB client interface of the phone is reserved with MCU powering and communication via OTG.
So, I came across this solution after surfing the web, for debugging while developing with MCU.
Note add adb to path :-
-NO ROOT is required for this process.
While connected Android device on PC, use this command.
|#On the HOST side ie. your PC|
|#Initiate the connection on port 5555|
|adb tcpip 5555|
After that de-attaching the USB connection from PC use these command to connect to android wirelessly
|#Replace <DEVICE_IP_ADDRESS> with IP of mobile|
|adb connect <DEVICE_IP_ADDRESS>:5555|
You can find the android device IP address from Setting>About Phone>Status> IP address
Also, you can use following commands before line 5 command was intiated to know the IP.
|#To check the android device's IP from Host PC|
|adb shell netcfg|
In case, you want to revert back to USB debugging, you can use following commands
|#To revert back the debugging via USB use|
|adb -s <DEVICE_IP_ADDRESS>:5555 usb|