Thursday, October 13, 2016

Turn on USB debugging using command-line


I have a Samsung Galaxy S2 and a PC running Debian 8. How can I turn on USB debugging using command-line on my PC without touching the phone?



Answer



If the question is simply "using the command-line"


Let it be simple (root possibly[1] required):


settings put global development_settings_enabled 1
settings put global adb_enabled 1

And then you need to



echo "mtp,adb" > /data/property/persist.sys.usb.config

If you want to do this without touching your phone


Then I'm feeling interesting because you won't gain access to command line via PC before enabling ADB, so it's impossible to enable this prior to touching your phone.




1. Actually you only need either 'system' or 'shell' privilege, but 'system' is impossible to access without rooting and 'shell' is granted only if you're already logging in via adb, where it makes no sense to enable adb while it's already active.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...