16

I own a Samsung Galaxy S3 and the display is broken and USB debugging is set to off too.

How can I enable it using ./adb commands? I have done these steps already:

  • data/data/com.android.providers.settings/databases/settings.db changed adb_enabled value from 0 to 1.
  • Also edited build.prop in /system.

After doing all this, the phone seems bricked, it's not turning on. All I want to do is enable USB debugging and connect it to Vysor(beta) so I could control it on my computer.

  • 1
    Welcome! Good question. +1. Why do you want to remote-control the phone though? – unforgettableid Aug 26 '15 at 23:35
  • Thanks...Because the screen is broken and I want to browse the data in it. Though I figured it out last night... :) – TheOnlyAnil Aug 27 '15 at 9:04
  • The proper way of enabling USB debugging would be to unpack the boot.img, edit init.rc (enable adb, then disable RSA verificaton), repack boot.img, and boot boot.img without flashing. Once edit has been confirmed working, then flash boot.img to the device. – HasH_BrowN Mar 5 '16 at 15:07
12

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 :)

  • Are you running a custom Recovery? – Firelord Aug 27 '15 at 11:20
  • No. Stock recovery it is. – TheOnlyAnil Aug 27 '15 at 11:26
  • 1
    About the RSA confirmation part by user, if you're booted into Android OS, and are confirmed somehow that the screen is displaying a dialog for confirmation then you may very well use adb shell input keyevent to choose YES. See Keyevent here. It's a shot in the dark but may very well be worth firing. – Firelord Aug 27 '15 at 11:31
  • @Firelord I tried to do that. But it said authorization error. Looks like I have to authorize it first then do anything... – TheOnlyAnil Aug 27 '15 at 11:40
  • 1
    Ahh! Sorry for suggesting something that would not work. What was I thinking? If ADB access is not authorized then no way adb shell input would work. Sorry again! I'll see if there is any way to bypass the authorization somehow. – Firelord Aug 27 '15 at 11:42
4

For the RSA verification that you asked to bypass, I don't know whether it would work in your device, but it worked in my little experiment. In Lollipop, the ADB keys (after authorization) are saved in /data/misc/adb/adb_keys. Your private key is saved in computer. In Linux the directory location is $HOME/.android/. On Windows that usually translates to %USERPROFILE%\.android, but keys might end up in C:\Windows\System32\config\systemprofile\.android in some cases. (Source)

There is a method described here by ashoke which might help out in bypassing the authorization.

However, in my Lollipop, the method varies. I noticed that in my primary and secondary Lollipop ROM the adb_keys had the same key actually. All I did was revoke the authorization from the secondary ROM (file deleted automatically ), disconnected device from PC, copied adb_keys from Primary ROM into secondary ROM, connected the device into PC, and voila! I wasn't asked for that authorization. I double checked the authorization using adb devices and it was all good.

Try the linked answer first. Authorize a different Android phone, copy its keys into your device from Recovery mode and see if it works.

  • Hey thanks. I transferred adb_keys from note 2 to S3 and it worked :) – TheOnlyAnil Aug 27 '15 at 18:13
  • This is the needed info to make the accepted answer correct. Good job. +1 – HasH_BrowN Mar 5 '16 at 15:02
  • 2
    For those running a Unix based OS, adb push ~/.android/adbkey.pub /data/misc/adb/adb_keys works reliably. – Chris Olin Dec 16 '16 at 19:32
  • @ChrisOlin: thank you for your input. But I do suppose that adb should be running in root mode (adb root), otherwise, the user won't be able to directly put a file under /data/misc/. Correct? – Firelord Dec 16 '16 at 21:42
  • Not exactly, but you raise a good question. If you're trying to enable USB debugging through ADB, you'll need to be booted into recovery to accomplish this. Recovery shells (least with TWRP) default to root. If they don't, then yes, the user won't be able to push directly to /data/misc. – Chris Olin Dec 17 '16 at 17:56

protected by Community Aug 29 '16 at 11:56

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.