2

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.

3

1 Answer 1

1

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 &
fi;

/system/bin/adb_to_tcp

#!/system/bin/sh

# Close STDOUT file descriptor
exec 1<&-
# Close STDERR FD
exec 2<&-

# Open STDOUT as $LOG_FILE file for read and write.
exec 1<>/sdcard/did_adb_tcp

# Redirect STDERR to STDOUT
exec 2>&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
> su
> kill -9 $PID_OF_SH

Not the answer you're looking for? Browse other questions tagged .