Android with root Git for version control Lircd with Raspberry Pi for IR receiver and sender Tips for Windows Depolying your own password management tool -- KeeWeb Depoly your flask app into Heroku Fix shit IE code manually ISBN to Book Category by Scraping DangDang A Generic Makefile for C/C++ Program Configure Raspberry pi Remove watermark with PyPDF2 tips for docker Anaconda+TensorFlow+CUDA Snippets Configure Remote Mathematica Kernel Build your own ngrok server Access Array SSL VPN 使用Rstudio制作html5幻灯片 tips for Mac OS X system Tips for ipython notebook 配置Ubuntu server + Openbox (Obuntu) tips for Vimperator tips for Vim 安装CUDA My First Jekyll Blog rsync常见选项 在Linux中读取Ipod touch的文件 tip for texmacs 在VPS上建站的一些tip Gnuplot绘图札记 Samba系统和autofs自动挂载 Linux中alsamixer声卡无法录音 搭建自己的RSS订阅器——Tiny Tiny RSS Grub2引导安装Ubuntu awk tips 将Ubuntu系统装入U盘 The Great Rtorrent 编译GCC 再这样剁手!!!该死的libgd 使用ulimit进行资源限制 使用SSH代理上IPV6 使用RCurl抓取网页数据 修复Ubuntu Grub记 openbox中的文件关联 在Ubuntu 12.04下编译qtiplot 处理BCM4312网卡驱动纪实 配置我的Ubuntu Server记 Cygwin杂记 Linux 使普通用户具有以超级权限执行脚本 让firefox自定义地处理文件类型 WordPress优秀主题及插件 在phpcloud上搭建wordpress UBUNTU下用pptpd做VPN server ubuntu升级内核过后的一些问题 安装telnet服务 kubuntu札记 64位kubuntu札记 统计软件R Virtualbox stardict星际译王 Ubuntu重装windows系统后的grub引导修复 SSH服务及花生壳域名解析 采用cbp2make工具由code::blocks工程创建makefile文件 UBUNTU 札记

Android with root

2023年10月13日

Tips:

Termux service with runit

  1. Install and enable runit (sv)
pkg install termux-services

mkdir -p ~/.termux/boot/
cat > ~/.termux/boot/10-sv.rc <<EOF
#!/data/data/com.termux/files/usr/bin/sh
termux-wake-lock
. $PREFIX/etc/profile
EOF
  1. Create service configuration
SV=${SV:-alist}

mkdir -p $PREFIX/var/service/${SV}/log
cd $PREFIX/var/service/${SV}

ln -sf ../../../share/termux-services/svlogger log/run

cat > run <<EOF
#!/data/data/com.termux/files/usr/bin/sh

exec $HOME/.local/bin/alist --data $HOME/.local/opt/alist-data server 2>&1
EOF

chmod +x run
  1. Manage the service
sv-enable alist
sv up alist

Log file can be found under $PREFIX/var/log/sv/${SV}

Magisk script to set ADB TCPIP port at startup

In Magisk, executable general scripts placed in /data/adb/service.d runs in parallel and NON-BLOCKING.

cat > /data/adb/service.d/adb.sh <<EOF
stop adbd
setprop service.adb.tcp.port 7612
start adbd
EOF

chmod +x /data/adb/service.d/adb.sh

Enable “Install via USB” or “USB debugging (Security settings)” without creating MI Account

This requires root, shell access with su, and a way to edit text files as root. I used Termux and and an android root file manager that can edit text files.

First, run the following command (su first, to switch to root):

setprop persist.security.adbinstall 1

If you also want to enable “USB debugging (Security settings)”, for granting permissions, simulating UI input, etc. via ADB, run the following command too:

setprop persist.security.adbinput 1

Next, we need to edit the file /data/data/com.miui.securitycenter/shared_prefs/remote_provider_preferences.xml so that MIUI actually lets us do these things:

sed -i 's,"perm_adb_install_notify" value="true","perm_adb_install_notify" value="false",' /data/data/com.miui.securitycenter/shared_prefs/remote_provider_preferences.xml

Setup Wifi-ADB for scrcpy without root

adb devices
adb tcpid 2120
adb connect 192.168.1.21:2120
adb disconnect
adb kill-server
adb usb