I've a Huawei P9 Plus running Android 7 with unlocked bootloader and TWRP installed.

My screen is broken so I need to mirror my screen with scrcpy.

I've tried ton of guides like this one to enable USB Debug and bypass RSA verification via recovery mode and adb but nothing.

I think that adb can't detect my phone because I can't enter my 6 digit PIN, in which way can I bypass it or delete PIN request?

  • I’m wondering, is it possible to plug in a USB keyboard on an Android 7 system ? If yes, maybe you could enter the PIN that way ?
    – NovHak
    Jun 6, 2023 at 0:13
  • @NovHak If the phone supports USB OTG this should be possible. But it also depends on the used keyboard, if it has [RBG] lights, integrated USB-hub, smartcard reader or something like that it often draws too much power and therefore does not work as an OTG keyboard.
    – Robert
    Jun 6, 2023 at 7:50
  • Thank you both, I read that my phone is compatible with USB OTG but even if I connect a keyboard I can't see anything because my screen is broken, I don't know if I can connect my device to an external monitor via HDMI..any ideas?
    – Bug-Gy
    Jun 6, 2023 at 8:56
  • @Bug-Gy It’s not necessary that you see before typing, if you can guess what’s on screen after boot ; you could then type blindly. Another option if you want to remove the PIN request : remove the SIM, Android can perfectly boot without one. Of course if it’s the PIN to unlock the screen that’s another matter, but at least you won’t risk locking your SIM with three consecutive bad PIN codes.
    – NovHak
    Jun 7, 2023 at 14:08
  • @NovHak Thanx for the help, I've already remove my SIM to avoid lock. I've tried many times to swipe and blindly type my PIN to unlock the screen but nothing.
    – Bug-Gy
    Jun 7, 2023 at 21:20

1 Answer 1


Shouldn’t that work ?

  1. adb shell input keyevent 26 (press the lock button to wake up the screen)
  2. adb shell input touchscreen swipe 930 880 930 380 (swipe up to bring the PIN dialog)
  3. adb shell input text XXXX (XXXX is the passcode)
  4. adb shell input keyevent 66 (press OK)

Just a wild guess, according to what I read in the aforementioned question and subsequent replies and comments.

You probably don’t need to send a lock button press via keyevent if the actual lock button still works, especially considering you will have to be quick to swipe up after waking up the screen before it goes off again.

  • Thank you for your effort, since my phone is not detected by PC, I can only connect via recovery mode. In recovery when I digit the command adb shell input I get this error: /sbin/sh: input: not found and I can't proceed
    – Bug-Gy
    Jun 7, 2023 at 21:32
  • Ah yes of course, I suppose it won’t work if USB debugging hasn’t been enabled beforehand. I don’t know what can be done from revovery mode in that respect…
    – NovHak
    Jun 7, 2023 at 21:33
  • 1
    Thank you, your method works but you have to enable USB debug first (tested with a working P9 Lite with debug enabled, specially the "allow USB debug in charge-only mode" option). You've a good guess that could help someone so I vote your answer. About my phone I'm stuck. I've learn my lesson, I'll search for a screen replacement or similar and then I'll enable the debug options manually. Thank you all!
    – Bug-Gy
    Jun 10, 2023 at 16:04

You must log in to answer this question.

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