How can I enable USB Debugging on an LG G2 (vs980) with a broken screen? I have an LG G2 (vs980 - Verizon). The digitizer and screen is broken - I can view it, but not submit input.

The device has fastboot and TWRP capabilities, and I can get to ADB from TWRP.

The device previously had USB debugging enabled and was associated with my PC's public key.

It seems the only thing preventing me from accessing the device via ADB while booted normally is LG's 'USB connection type' setting, which defaults to 'as a media device' or 'as an installer'. This phone requires me to choose 'as an internet connection' / 'ethernet' once I hook up the USB cable from the notification panel for ADB debugging to work. As the screen is broken, I cannot do this.

How to I write this setting to the system from recovery mode? Perhaps a build.prop tweak or a sqlite3 edit? (I have sqlite3 on the device; I just enabled my wifi with it).

$ adb shell getprop | grep persist.sys.usb.config
[persist.sys.usb.config]: [mtp,adb]




Since I can access ADB from recovery and my rom has a /system/etc/init.d, i can run commands after the system boots from here.

My current plan is to switch ADB to connect over wifi and proceed from there.
In this situation, since you have rooted your phone and can access the device via recovery adb, create a startup init.d script to set adb to wifi listening and then connect via wifi.



/system/etc/init.d/97adb

#!/system/bin/sh

if [ -e /sdcard/adb_wifi ]; then
    /system/bin/adb_to_tcp &amp;
fi;




/system/bin/adb_to_tcp

#!/system/bin/sh

# Close STDOUT file descriptor
exec 1&lt;&amp;-
# Close STDERR FD
exec 2&lt;&amp;-

# Open STDOUT as $LOG_FILE file for read and write.
exec 1&lt;&gt;/sdcard/did_adb_tcp

# Redirect STDERR to STDOUT
exec 2&gt;&amp;1

while :
do

/system/bin/iptables -F
/system/bin/iptables -P INPUT ACCEPT
/system/bin/iptables -P OUTPUT ACCEPT
/system/bin/iptables -P FORWARD ACCEPT

setprop service.adb.tcp.port 5555
stop adbd
start adbd

/system/bin/sleep 120

done




/sdcard/adb_wifi



Ensure the former two files are +x and that the final file exists. Reboot. Wait. You now have 120 second intervals to:

adb connect [yourip]:5555
adb shell ps | grep sh
adb shell
&gt; su
&gt; kill -9 $PID_OF_SH