Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save diyism/bab730c7a337bb093adbd6957c18fa70 to your computer and use it in GitHub Desktop.
用android-keyboard-gadget和magisk root让nexus 6p变成真正的usb键盘
#https://github.com/pelya/android-keyboard-gadget
#重启到bootloader/fastboot:
adb devices
adb reboot bootloader
sudo ./fastboot devices
#先在系统配置developer里allow unlock, 然后再unlock:
sudo ./fastboot flashing unlock
#flash auto root boot(就不需要用刷recovery的方式装supersu了), 与hid gadget boot冲突, 所以要在刷hid gadget boot之前,
#往/system装完su及supersu应用后再被hid gadget boot覆盖就不要紧了:
#sudo ./fastboot boot CF-Auto-Root-angler-angler-nexus6p.img
#但在https://desktop.firmware.mobi/device:12/firmware:18582 看到nexus 6p android 8.1 2018-12-05这boot img没法集成cf auto root脚本, 最后一个支持的是nexus 6p android 7
#所以只能去刷recovery区, 刷上twrp后再用它把supersu刷到system区获得root, 就跟hid gadget的boot区没冲突了
#刷twrp到recovery分区:
sudo ./fastboot flash recovery recovery-twrp-3.4.0-0-angler.img
#音量上下键选recovery, 然后Power button重启到recovery模式
#刷hid gadget到nexus 6p android 8.1 2018-12-05的boot分区:
sudo ./fastboot flash boot boot-hid-gadget-angler-v1.0.img
#twrp刷supersu,而2.76是supersu被中国公司ccmt收购前的最后一个版本(md5sum: 02905e5bc8825cb769f5974e7dc20862), 在twrp模式下可以从pc直接adb push的:
#adb push UPDATE-SuperSU-v2.76-20160630161323.zip /sdcard/
#在twrp里输入系统密码解密mount system, 然后点击Install选supersu v2.76的zip文件刷进手机/system, 然后点Reboot System按钮重启
#但是发现会失败,猜测是因为supersu搞/data/su.img文件overlay需要动boot分区, 不需要动boot分区的最大版本是BETA-SuperSU-v2.52.zip(https://download.chainfire.eu/743/)
#可是还是不行, 可能2016年的supersu已经搞不定nexus 6p的opm7.181205.001的build
#看起来magisk用twrp刷入时不是简单地覆盖boot分区,而是会先备份然后再合并再刷入, 所以不会影响已经刷入的hid gadget boot:
#https://github.com/topjohnwu/Magisk/releases
#下载Magisk-v20.4.zip
adb push Magisk-v20.4.zip /sdcard/
#重启到twrp输入系统密码解密mount system, 然后点击Install选刷入Magisk-v20.4.zip, 点Reboot System按钮重启
#and to use:
USB Keyboard app
hid-gadget-test command
Authorizer app
#用lsusb命令看linux pc里并没有增加新的设备(仍是adb用的那个18d1:4ee7 Google Inc), 但是从手机Authorizer应用里已经可以通过usb线往pc里输入字符了
#启动DriveDroid应用后pc里用lsusb命令看到"18d1:4ee7"变成了"18d1:2d12 Google Inc", 用"lsusb -t"看到它的设备树里既含usbhid设备
#也含usb-storage设备, 应该可以同时启动一个iso系统安装文件, 同时充当系统安装过程中的自动键盘(可以预先把安装命令或操作
#放在Authorizer里免得自己敲键盘).
#boot原版(md5sum: 44048804616014aa2e53ee1b59502645), https://desktop.firmware.mobi/device:12/firmware:18582
#看到kernel version(就是boot分区version)完全一致, 出现问题时可还原boot:
sudo ./fastboot flash boot boot-nexus-6p_angler_opm7.181205.001.img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment