Skip to content

Instantly share code, notes, and snippets.

@pantasio
Created March 29, 2018 08:20
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save pantasio/3d0eb4bb03a1e696aae8696f60730859 to your computer and use it in GitHub Desktop.
Save pantasio/3d0eb4bb03a1e696aae8696f60730859 to your computer and use it in GitHub Desktop.
adb cmd enable USB debug cant touch screeen
I got it to work :)
NOTE: This requires unlocked bootloader.
Connect the device to Mac or PC in recovery mode. (I had to map the process in my mind as the screen was broken).
Now open terminal/CMD in computer and go to platform-tools/. type and enter ./adb devices to check if the device is connected in recovery mode.
Now type ./adb shell mount data and ./adb shell mount system to mount the respective directories.
Get the persist.sys.usb.config file in your system using ./adb pull /data/property/persist.sys.usb.config /Your directory
Now open that file in a texteditor and edit it to mtp,adb and save.
Now push the file back in the device; ./adb push /your-directory/persist.sys.usb.config /data/property
Get the build.prop file; ./adb pull /system/build.prop /your-directory
Add these lines:
persist.service.adb.enable=1
persist.service.debuggable=1
persist.sys.usb.config=mtp,adb
Push build.prop back into the device; ./adb push /your-dir/build.prop /system/
This way you enabled USB debugging on your device. But you still can't connect. Why? Because it asks for RSA verification. If you could view your display then you could easily tap on YES to authorize the device. I am currently figuring out to bypass this. I want to revive my dead phone badly. If you know any way to do this, please share :)
@devdeno
Copy link

devdeno commented Jun 17, 2019

what

@windowsdesktop
Copy link

where is the revision? wtf is this

@Raymond2x
Copy link

Raymond2x commented Sep 19, 2020

I do believe there are a couple of ways that this can be accomplished, the first is a way that im 99% certain is and the second is more of a possibility upon which the viability of it will depend on the device and/or equipment you have access to.

The first method will be by using a cmd in terminal; However, I am not 100% certain of the exact syntax, even if i were aware of which environment you're using for either your adb host or target, I will hopefully point you in the right direction.

What you basically want to look for is one of the following:
'adb shell input keyevent <number_of_event>'
eg: 'adb shell input keyevent 66' (which is the KEYCODE_ENTER and what i would suggest for you to try first given the detail in your example of yes prompt if its highlighted but if no is the highlighted button then you will need to input KEYCODE_DPAD_LEFT/RIGHT(21/22 respectively) before the ENTER event.

'adb shell am start
and/or
'adb shell am broadcast'
With these cmds you can actually do more than i honestly want to explain because everything will be device specific, but for example you could go so far as to do the following: launch the settings; navigate to build number; tap
Build number seven times to 'unhide' dev options; navigate to adb debugging; toggle switch to on; navigate the usb mode and set it to your preference(charge/mtp/etc.).

If charge/power-off adb is available it may be possible to:
adb shell setprop persist.sys.usb.config adb
With this there may be more cmds necessary but that will be device specific as well.

As to the second method, and I'm gonna keep this short because I'm sure the above has peeked your interest if you are anywhere near as intersted in terminal cmds and the many things that can be done with it.
It's likely that you can use either a physical (or virtual keyboard controller from the adb host, maybe) keyboard to navigate to the yes prompt and hit enter. This is definitely possible If the device has multiple usb ports.
If it's possible for you to get on the same wifi network with the device, for instance you have it set to auto-connect to home wifi router, then you could do the following:
Connect via usb then;
'adb shell tcpip 5555' (this sets the targets adb daemon to listen on port 5555)
Then you can use the following cmd to connect to device via adb:
'adb connect target-ip-adress@port-5555'
eg. 'adb connect 192.168.41.100:5555'
Now a usb connection is now longer needed and you can use the usb port to is available so that you can navigate and input keyevents with a physical keyboard.

Hope this helps!
PS-my apologies for the bold portion, i tried to fix it but doesn't seem to want to for some reason, maybe it's because I'm new here and missed something that caused it.

@EnzoPortela
Copy link

Hi! Any updates about it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment