[ROOT] Navigation keys back light control - Xiaomi Mi A1 Themes, Apps, and Mods

I've been looking for a way how to have navigation keys back light always on while screen on (I was distracted by blinking caused by short timeout value) and at the same time always off for ebook reading and video watching and the solution should be simple and future proof (working on Nougat and Oreo as well). It is partially possible with Xposed and Gravitybox, but I am preparing myself for Oreo update, so I want to replace as many of its functions as possible. Long story short, use Tasker with following:
1. Event, display on, task:
run shell command as root, "chmod 644 /sys/class/leds/button-backlight/brightness"
run shell command as root, "echo 10 > /sys/class/leds/button-backlight/brightness"
run shell command as root, "chmod 444 /sys/class/leds/button-backlight/brightness"
2. Event, display off, task:
run shell command as root, "chmod 644 /sys/class/leds/button-backlight/brightness"
run shell command as root, "echo 0 > /sys/class/leds/button-backlight/brightness"
run shell command as root, "chmod 444 /sys/class/leds/button-backlight/brightness"
3. Application, ebook reader, youtube,..
Enter task
run shell command as root, "chmod 644 /sys/class/leds/button-backlight/brightness"
run shell command as root, "echo 0 > /sys/class/leds/button-backlight/brightness"
run shell command as root, "chmod 444 /sys/class/leds/button-backlight/brightness"
Exit task
run shell command as root, "chmod 644 /sys/class/leds/button-backlight/brightness"
run shell command as root, "echo 10 > /sys/class/leds/button-backlight/brightness"
run shell command as root, "chmod 444 /sys/class/leds/button-backlight/brightness"

Hi.
Is this working?
I really hate buttons light and would like to shut them off for good.
I guess that running this script after booting should work (if yours is working)
echo 0 > /sys/class/leds/button-backlight/brightness
What do you think?
Thanks in advance.

pantezuma said:
Hi.
Is this working?
I really hate buttons light and would like to shut them off for good.
I guess that running this script after booting should work (if yours is working)
echo 0 > /sys/class/leds/button-backlight/brightness
What do you think?
Thanks in advance.
Click to expand...
Click to collapse
I am still using this method without any issues. I even enhanced it with lowering the keys back light intensity during night, quite handy in total darkness
To disable back light permanently after boot use this:
1. run shell command as root, "chmod 644 /sys/class/leds/button-backlight/brightness"
2. run shell command as root, "echo 0 > /sys/class/leds/button-backlight/brightness"
3. run shell command as root, "chmod 444 /sys/class/leds/button-backlight/brightness"
Explanation:
1. make sure that we have RW configuration rights (I would say that this is optional in your case, but it won't hurt anything)
2. disable brightness
3. remove RW configuration rights (otherwise system apps can and will enable the back light again when you turn screen off and on)

Thanks for you fast reply.
I'm still trying to understand how magisk works with scripting (and the permissions you mention that I didn't know were required).
I come from an old S2 running custom Jelly Bean and all this systemless stuff is new to me as previously I used to put scripts in init.d and that was all I needed, but now I don't want to modify system partition.

I am using Magisk for root and few build.prop tweaks, not sure how init.d works with it. In the past I had luck with Script manager - it was enough to create a script file, open it with Script manager and set it as "run as root and at boot time". Or you can still use an automation app which can run shell commands (Tasker has this feature for sure).

_mysiak_ said:
I am using Magisk for root and few build.prop tweaks, not sure how init.d works with it. In the past I had luck with Script manager - it was enough to create a script file, open it with Script manager and set it as "run as root and at boot time". Or you can still use an automation app which can run shell commands (Tasker has this feature for sure).
Click to expand...
Click to collapse
As far as I know, anything you put under /magisk/.core/post-fs-data.d would be ran as a script after boot.
But as I said before, just starting with this and may be talking nonsense.
I really wouldn't like to install tasker or anything else as I just want them off for the rest of my life!
Thanks!
PD: Sorry for my english.

_mysiak_ said:
I am using Magisk for root and few build.prop tweaks, not sure how init.d works with it. In the past I had luck with Script manager - it was enough to create a script file, open it with Script manager and set it as "run as root and at boot time". Or you can still use an automation app which can run shell commands (Tasker has this feature for sure).
Click to expand...
Click to collapse
Hey!
I was able to run your commands via ADB and everything is working perfect (I don't know why but they didn't work via terminal emulator)
Only issue is that whenever I reboot my phone everything is lost.
My problem is that I'm unable to make a script that runs at boot time (I'm pretty ignorant in scripting and where to put that script).
Any help or suggestions will be highly appreciated!

pantezuma said:
Hey!
I was able to run your commands via ADB and everything is working perfect (I don't know why but they didn't work via terminal emulator)
Only issue is that whenever I reboot my phone everything is lost.
My problem is that I'm unable to make a script that runs at boot time (I'm pretty ignorant in scripting and where to put that script).
Any help or suggestions will be highly appreciated!
Click to expand...
Click to collapse
Don't forget to add "su" as a first command if you are running it from terminal emulator. Try Script manager mentioned before, it can do what you want quite easily - just put all commands in a file, save it somewhere on the internal SD, open it from SM, set as run at boot and run as root and that's it. You can run your scripts on demand as well, so you can check quickly if it's working fine.

I remembered that had bought Tasker a few years ago (but never really used it) so I created a task to perform the above mentioned commands at boot.
Anyway, I'm still unable to make a script and run it via terminal emulator, and that's really annoying!
I'll keep investigating.
Thanks a lot!

pantezuma said:
Anyway, I'm still unable to make a script and run it via terminal emulator, and that's really annoying!
Click to expand...
Click to collapse
What is the exact content of the script file, what are the file permissions and how do you try to run it?

_mysiak_ said:
What is the exact content of the script file, what are the file permissions and how do you try to run it?
Click to expand...
Click to collapse
Hi!
This script is something like this:
#!/bin/sh
su
chmod 644 /sys/class/leds/button-backlight/brightness
echo 0 > /sys/class/leds/button-backlight/brightness
chmod 444 /sys/class/leds/button-backlight/brightness
Named it "lights sh" and put in on my internal SD card,
Then, with terminal emulator browsed to its location and tried to run it via "./lights sh"
I got "Permission denied" and also some errors like "backlight not found".
Couldn't find the way to change permissions (Reading a little more found that internal SD card is mounted as non executable. Is that correct?
Later I moved the file to DATA and changed permissions to 755 obtaining the same results.
As you may notice I'm a complete noob regarding scripting and permissions and I apologize for that!
Thanks in advance!

pantezuma said:
Hi!
This script is something like this:
#!/bin/sh
su
chmod 644 /sys/class/leds/button-backlight/brightness
echo 0 > /sys/class/leds/button-backlight/brightness
chmod 444 /sys/class/leds/button-backlight/brightness
Named it "lights sh" and put in on my internal SD card,
Then, with terminal emulator browsed to its location and tried to run it via "./lights sh"
I got "Permission denied" and also some errors like "backlight not found".
Couldn't find the way to change permissions (Reading a little more found that internal SD card is mounted as non executable. Is that correct?
Later I moved the file to DATA and changed permissions to 755 obtaining the same results.
As you may notice I'm a complete noob regarding scripting and permissions and I apologize for that!
Thanks in advance!
Click to expand...
Click to collapse
I've just made a very simple script:
1.
#!/bin/sh
echo hello world!
2. saved it to the internal sd card as "script.sh"
3. chmod 755 script.sh
4. running it as "./script.sh" gives the permission denied error, but "sh script.sh" works fine
In your case, remove "su" command from the script file itself, but run it in terminal before calling the script instead. Or just use script manager

Thanks, working great Tasker profiles...

how to lower the brightness of thw buttons? on night the light is so bright and on the white variant looks horrible xD

deewfrank said:
how to lower the brightness of thw buttons? on night the light is so bright and on the white variant looks horrible xD
Click to expand...
Click to collapse
If you have tasker:
Code:
run shell command as root, "chmod 644 /sys/class/leds/button-backlight/brightness"
if %LIGHT > 3
run shell command as root, "echo 10 > /sys/class/leds/button-backlight/brightness"
else
run shell command as root, "echo 1 > /sys/class/leds/button-backlight/brightness"
end if
run shell command as root, "chmod 444 /sys/class/leds/button-backlight/brightness"
It will set brightness based on the surrounding light level.

Related

[Q] Help - Shell Commands

Hi all, I am trying to use the Scripting Layer for Android to make a simple shell script to disable the stagefright player (the thing that causes the bad sound quality in Froyo) I made some progress, but it doesn't seem to work right. Can someone with knowledge of scripts help me? Here's what I have so far:
echo "Disable Stagefright"
su
setprop media.stagefright.enable-player false
exit
echo "Disabled"
The problem is that it never displays Disabled. It just returns to the terminal and gives # for the root prompt. Anyone know how I can get this to run properly or a better scripting language that I could use and help porting this to that language?
I'm just guessing here, but shouldn't "exit" go after "Disabled"? Otherwise the script terminates before the echo line.
Well you'd think so, but even if I do that, the script actually doesn't exit. That's the main problem, and it still won't echo that last line. Its like I can't exit su and the setprop command never goes through. Its a little annoying, because as far as I can tell, I wrote it the way it should go in the terminal app. Thanks for the input, but unfortunately, it doesn't do anything.
So it seems after typing exit in manually will terminate the script. Also, if I don't specify su, the script runs, but from what I can tell it doesn't actually do the setprop. And there's no echo's in the terminal. It runs and says would you like to exit? If I say no, there is absolutely no messages in the terminal.
su opens a new shell. so your script doesnt finish because it spawned a child process (the new shell) and is waiting for that command to finish before the next ones are run.
what you need to do is SUID that script, remove the su and exit, and run it.
SUID allows any program to be run with SuperUser permissions (read:root).
look up how to set a programs SUID bit, you'll need busybox, more specifically, chmod.
its along the lines of "chmod +s script.sh" but id double check to make sure.
Thanks! I don't understand all of that (really I'm pretty new to scripts), but I'll look into it. Hopefully I can get this figured out. I want to make two scripts to make it easy for people with rooted 2.2 to turn on and off the audio fix with one click. I'll post back if I make any progress.
edit: I just realized how easy what you said is. At least, I think its easy. The only thing I'm not sure of is where the scripts are saved to.
nenn said:
su opens a new shell. so your script doesnt finish because it spawned a child process (the new shell) and is waiting for that command to finish before the next ones are run.
Click to expand...
Click to collapse
Oh yeah, duh.
you can put the script anywhere as long as that directory is in your $PATH or, to make things simpler you can just put it in a directory already in the $PATH variable.
to check where you can put your scripts run this little line of code.
echo $PATH
Click to expand...
Click to collapse
you can add to the $PATH, but im not sure how to do that on the phone, only from a linux standpoint.
What you need to do is easy assuming that middle line "setprop media.stagefright.enable-player false" is the correct command. the script would look like this
setprop media.stagefright.enable-player false
echo "Disabled Stagefright"
Click to expand...
Click to collapse
However this does no sort of checking to see if its already disabled, if it is does it cause a problem to disable it again. doesnt let you enable it, you probably would want this. also doesnt check if the software is installed.
take the quoted text, throw it in a file and set the SUID bit and youre off.
nenn said:
you can put the script anywhere as long as that directory is in your $PATH or, to make things simpler you can just put it in a directory already in the $PATH variable.
to check where you can put your scripts run this little line of code.
you can add to the $PATH, but im not sure how to do that on the phone, only from a linux standpoint.
What you need to do is easy assuming that middle line "setprop media.stagefright.enable-player false" is the correct command. the script would look like this
However this does no sort of checking to see if its already disabled, if it is does it cause a problem to disable it again. doesnt let you enable it, you probably would want this. also doesnt check if the software is installed.
take the quoted text, throw it in a file and set the SUID bit and youre off.
Click to expand...
Click to collapse
Yeah, no idea how to work with the PATH on android. I found out the scripts are in sl4a/scripts on the sdcard. I tried to chmod directly there, but it gave me a "Bad mode" error. Looks like once I get the SUID bit done, I'm good to go.
I know it doesn't have any error handling at this point. I'm not too worried about that at this point. If it disables stagefright, then I can edit my enabling script to work and I'll have a pair of scripts to toggle the sound fix on and off. (since when I turn off stagefright it can have undesired effects on the camcorder and other media apps) Thanks a lot for the help. I'll keep trying to figure out the SUID problem. I'm running windows. I have my linux laptop running, but haven't gotten around to installing the Android sdk on it yet.
I just had an idea. Do you think I can copy the scripts to my linux computer, chmod them, and then copy them back? If that would work, that could be the easier way at this point.
Well, I tried doing the chmod +s on linux and then pushing the files back. Not sure if they kept the SUID though. They run without a problem, but it doesn't show up as changing the property. This is really dumb...
Actually setprop does not need superuser permissions. So you could simply issue the echo commands and the setprop line. Done.
Sent from my PC36100 using XDA App
I tried that first. Didn't work. I'm not sure why setprop isn't working in the shell script. So far I tried without su, with su, and changing the SUID (though I'm not sure if it sticks when its pushed back to Android. It seems like such an easy script. This is really annoying. Also, I'm pretty sure you have to have root to use setprop, at least for the use I'm using. I got the command from here: http://forum.xda-developers.com/showthread.php?t=737111
the suid wont stick when you push the file over. to see if the command is being run proper run the setprop and check its return value, i dont think this will work unless youre in a proper shell. i cant seem to find out the command to check the return value.
if the return value is anything other than 0 (zero) there was a problem.
im off for the day, work is over
Yeah, I didn't think it would stick, but oh well. I can't get the return value, but I've been doing a getprop through adb to see if the property was changed, but it never is. The shell runs, but again, no output, just runs and exits.
superlinkx said:
Yeah, I didn't think it would stick, but oh well. I can't get the return value, but I've been doing a getprop through adb to see if the property was changed, but it never is. The shell runs, but again, no output, just runs and exits.
Click to expand...
Click to collapse
Getprop shows you the value of build.prop. The setprop command does not actually change build.prop but rather changes current session settings. The settings will revert upon reboot. That is why setprop has always been touted as a temporary fix. Try this script:
Code:
echo "Disable Stagefright"
adb shell setprop media.stagefright.enable-player false
echo "Disabled"
Edit: If that does not work, insert "cd .." before you exit command in you original script. That's "cd(space).." without the quotes.
Sent from my PC36100 using XDA App
sombdy said:
Getprop shows you the value of build.prop. The setprop command does not actually change build.prop but rather changes current session settings. The settings will revert upon reboot. That is why setprop has always been touted as a temporary fix. Try this script:
Code:
echo "Disable Stagefright"
adb shell setprop media.stagefright.enable-player false
echo "Disabled"
Edit: If that does not work, insert "cd .." before you exit command in you original script. That's "cd(space).." without the quotes.
Sent from my PC36100 using XDA App
Click to expand...
Click to collapse
Ok, I tried the adb shell method, but that still didn't even temporarily change the build.prop. I know that using setprop is temporary, which is one of the reasons I'm using a script. I know that I can pull build.prop, edit the property and push it back, but then I'd have to put up with undesired effects.
I also tried the cd .. method, like so:
Code:
echo "enable stagefright"
su
setprop media.stagefright.enable-player true
cd ..
exit
echo "ENABLED"
(this is my second script that reenables stagefright. I have it turned off right now)
After doing that, I use adb shell from my computer and getprop still shows its false. If I run the command "setprop media.stagefright.enable-player true" from adb shell, it changes properly and shows when I say getprop. I'll probably work on it more tomorrow. Thanks everyone for the suggestions! I appreciate the help, even if it hasn't quite panned out yet.
Anyone else have any ideas? This is so dumb! I know the solution is simple, I just can't think of what it could be.

Regaws Root Method???

Is there something additional I need to do to actually gain "root"? I can't install the clear lock screen from smurf, can't wireless tether.... Don't know what's going on, all of this used to work fine on my Hero - what am I missing?
I don't think you have given enough info for people to even know what the problem is that you are having. Maybe you could be a bit more specific. Do you have superuser installed?
Sorry about that.... basically im on stock 2.2 with supposed "root" using regaws method - problem is, I can't use anything though; adb, wireless tether, I can't flash a lock screen (just sits at boot screen).
Download superuser app from the market place or google it if it is not on your phone already. Install it then launch an app that requires root. You will know real fast if you are rooted.
DomSim said:
Download superuser app from the market place or google it if it is not on your phone already. Install it then launch an app that requires root. You will know real fast if you are rooted.
Click to expand...
Click to collapse
I do have SU... that's the thing but when I try ADB Remount it says device not permitted or something like that, can't remember exactly
You could try full wipe / reflash.
Maybe try a diff ROM too.
You need to flash the engineering bootloader (0.76.2000). Go to Toast's method part 2 and follow the steps to unlock nand. You need the engineering bootloader in order to access /system.
Sent from my PC36100 using XDA App
sombdy said:
You need to flash the engineering bootloader (0.76.2000). Go to Toast's method part 2 and follow the steps to unlock nand. You need the engineering bootloader in order to access /system.
Sent from my PC36100 using XDA App
Click to expand...
Click to collapse
Nand root... I was looking for more info on this, I thought it was the culprit, thanks - ill post results, hopefully good
Edit: Won't work "Permission denied" .... this is really starting to piss me off grrr
DirtyShroomz said:
Nand root... I was looking for more info on this, I thought it was the culprit, thanks - ill post results, hopefully good
Edit: Won't work "Permission denied" .... this is really starting to piss me off grrr
Click to expand...
Click to collapse
Have you run Unrevoked Forever? This will turn off security permissions and should then allow you to flash anything.
Sent from my PC36100 using XDA App
Ok, the reason
Code:
adb remount
doesn't work is because the boot.img isn't patched to allow that, because I forgot to at the time of posting. You still have root (as long as you actually completed the guide successfully), that's just an all time access root through adb
To acheive the same results, type
Code:
adb shell
type
Code:
su
you will then see #. thats root.
Then remount your /system partition using
Code:
mount -o rw,remount / /system
there you go.
regaw_leinad said:
Ok, the reason
Code:
adb remount
doesn't work is because the boot.img isn't patched to allow that, because I forgot to at the time of posting. You still have root (as long as you actually completed the guide successfully), that's just an all time access root through adb
To acheive the same results, type
Code:
adb shell
type
Code:
su
you will then see #. thats root.
Then remount your /system partition using
Code:
mount -o rw,remount / /system
there you go.
Click to expand...
Click to collapse
When I try to type "su" it says "Permission denied"
DirtyShroomz said:
When I try to type "su" it says "Permission denied"
Click to expand...
Click to collapse
Do you have usb debugging on?
Try the new 1 click root in the dev forum. Unrevoked 3.2. See if that doesn't do the trick.
Sent from my PC36100 using XDA App
My guess is you didn't flash the 2.2-root.zip at the end then.. That's the best I can do w/ the info you've given.
one was already asked once but i had two questions
1. Is USB Debugging turned on or off? Settings > Applications > Development
2. you are using a stock rooted rom. are you trying to use sprint's wireless tether app? Sprint's app wont work you need to download wireless tether from the market.
joebags said:
one was already asked once but i had two questions
1. Is USB Debugging turned on or off? Settings > Applications > Development
2. you are using a stock rooted rom. are you trying to use sprint's wireless tether app? Sprint's app wont work you need to download wireless tether from the market.
Click to expand...
Click to collapse
Running stock 2.2. Regaw I did flash 2.2-root at the end and I am trying to use wireless tether not Sprints hotspot
I do have superuser in my apps list and I was able to install SNeoid, Swype, Setcpu, juicedefender and a few others that may require root but it wont let me do anything via adb or install any themes/mods that come in .zips
DirtyShroomz said:
Running stock 2.2. Regaw I did flash 2.2-root at the end and I am trying to use wireless tether not Sprints hotspot
I do have superuser in my apps list and I was able to install SNeoid, Swype, Setcpu, juicedefender and a few others that may require root but it wont let me do anything via adb or install any themes/mods that come in .zips
Click to expand...
Click to collapse
ok do this in command prompt and paste the results in code tags (to save space)
Code:
adb shell ls /system/bin/
regaw_leinad said:
ok do this in command prompt and paste the results in code tags (to save space)
Code:
adb shell ls /system/bin/
Click to expand...
Click to collapse
Code:
setconsole
dumplayer
svc
e2fsck_recvy
chownto
apph
ps
id
chownThp
notify
dhcpcd
pand
renice
bugreport
snd8k
hciattach
iqfd
top
lsmod
setprop
ionice
ifconfig
iptables
kthp_proxy
logwrapper
getevent
htcipcd
su
start
iqd
wipe
ip
smd
sleep
getWiMAXPropDaemond
newfs_msdos
vdc
sync
udhcpd
pppd
rmmod
fsck_msdos
netstat
route
sound8k
rm
radiooptions
pm
logcat
setWiMAXPropDaemond
resize2fs_recvy
htc_inittest
vmstat
dvz
mmcamera_test
keystore
dmesg
system_server
linker
fbtool
reboot
sdptool
busybox
hd
iftop
insmod
bootcomplete
rild
schedtop
debuggerd
wpa_supplicant
schedtest
bluetoothd
ping
btld
ime
omx_tests
tc
sendevent
racoon
toolbox
date
bma150_usr
bootanimation
wimaxDhcpRenew
log
installd
wimax_uart
applypatch
wimaxAddRoute
dexopt
monkey
ln
getprop
album_hdmiexe
stop
surfaceflinger
uevent
akmd
monitorMTD
wimax_mtd
mv
debug_tool
servicemanager
wimaxDumpKmsg
dumpstate
ipd
DmWrapperTest
nandread
kill
gzip
chmod
rmdir
lsc_camera
dbus-daemon
run-as
netcfg
cat
htclogkernel
sh
mount
printenv
mkdir
bmgr
wimaxDhcpRelease
umount
mke2fs_recvy
dnsmasq
input
df
ioctl
am
wimaxDumpLogcat
app_process
chown
htc_timezonetest
service
netd
ls
netsharing
cam_ins_spmo
mm-venc-omx-test
dalvikvm
ser2net
dmagent
shutdown
ndc
dumpsys
mediaserver
vold
sequansd
awb_camera
dd
keypress
cmp
mscompress
wimaxDumpLastKmsg
mtpd
watchprops
ok, so "su" is in there... you should be able to
Code:
adb shell
su
and it give you a #
try opening SuperUser.apk on your phone, THEN doing the above commands. a pop up should come up on your phone saying to allow root to su
regaw_leinad said:
ok, so "su" is in there... you should be able to
Code:
adb shell
su
and it give you a #
try opening SuperUser.apk on your phone, THEN doing the above commands. a pop up should come up on your phone saying to allow root to su
Click to expand...
Click to collapse
that worked, now to get remount do i have to always use that previous command you wrote?

Root for Fire Phone with SuperSU

** DISCLAIMER: I AM NOT A DEVELOPER. I DO THIS AS A HOBBY AND SHARE MY FINDINGS IN CASE SOMEONE ELSE FINDS THEM USEFUL. **
** THIS WORKED ON MY DEVICE BUT IT MAY NOT WORK ON YOURS. APPLY AT YOUR OWN RISK **​** This method is designed for Amazon fire phone. Do not use it on other devices unless you are familiar with Android file system and are able to apply proper modifications. **​
This has been tested with the unlocked US version running 4.6.1.
This procedure installs superSU root binaries and busybox on your system.
Requirements
Make sure your PC can communicate with your fire phone via adb.
The success of this method depends on following the procedure very carefully. So read the instructions and make sure you understand every step before you try it.
Procedure
1- Install and run Kingroot 4.0. You can google and download it or you can use the one in the attached zip file. When Kingroot runs it is all in Chinese, but basically you need to be connected to the internet for it to work. It will do its thing and show progress up to 100% after which you can exit the program. Now your phone is rooted. The following steps replaces the Kinguser with SuperSU.
2- Unzip the attached file in your adb directory and then open an adb terminal and make sure the PC can see your phone (you can check that by typing adb devices). Then type the following:
Code:
adb push su /data/local/tmp
adb push busybox /data/local/tmp
adb shell
3- In the shell that you get type the following and make sure you give the permission when the phone prompts you:
Code:
su
4- Continue by typing the following commands:
Code:
mount -o remount,rw /system
cat /data/local/tmp/su >/system/xbin/daemonsu && chmod 0755 /system/xbin/daemonsu
cat /data/local/tmp/busybox >/system/xbin/busybox && chmod 0755 /system/xbin/busybox
daemonsu -d &
The key is to keep this session running while you continue with the rest, so be careful with typos and monitor this window for any errors.
5- At this point, leave the adb terminal window running and go to your phone, open the Kinguser app, open settings (the wheel at the top right corner of the screen), Root authorization setting, and Remove Root permission. The app will self-uninstall.
6- Uninstall the other two Kingroot programs that are still on your phone (KingRoot and the other one with the blue icon and Chinese text under it).
7- Back to the adb terminal, and type the following:
Code:
cat /data/local/tmp/su >/system/xbin/su && chmod 0755 /system/xbin/su
busybox chattr -ia /system/xbin/ku.sud
busybox chattr -ia /system/xbin/supolicy
rm /system/xbin/ku.sud
rm /system/xbin/supolicy
rm /system/bin/rt.sh
rm /system/bin/install-recovery.sh
rm /system/bin/shipclean
rm /system/bin/start-ssh
busybox chattr -ia /system/etc/install-recovery.sh
busybox chattr -ia /system/etc/install-recovery.sh-ku.bak
rm /system/etc/install-recovery.sh
rm /system/etc/install-recovery.sh-ku.bak
rm /system/etc/install_recovery.sh
rm /system/usr/icu/icusuflag.conf
busybox chattr -ia /system/usr/iku/isu
rm -rf /system/usr/iku
rm /system/kroot_*
rm /sdcard/kr-stock-conf
rm -rf /sdcard/Kingroot
rm -rf /data/data-lib/com.kingroot.RushRoot
rm -rf /data/data-lib/com.kingroot.kinguser
rm -rf /data/data-lib/king
Again, leave the adb terminal window running and go to your phone.
8- Install superSU (from the attached file) on your phone, run it, and let it update the SU binary.
9- Reboot the phone. After about 5 minutes your root is ready.
Hint: It is a good idea to disable Amazon device client platform, DCP platform contracts, and two apps called System Updates in Amazon settings. They are responsible for regular updates, constant chatter with Amazon servers, and possible patching of your root exploit. Also disable Kinesis service which is responsible for major battery drain and heating. You will find it under settings, display, configure motion and gesture settings. Disable all.
Troubleshooting
1- Most of the problems that I noticed people have encountered is due to not reading the instructions fully. So make sure you read the OP word by word.
2- If you miss a step or mess up something go back to installing Kingroot and start over from the beginning.
3- If instant video or some other Amazon app doesn't work it is because you should run them at least once prior to rooting the phone.
4- Finally, I noticed that with an AT&T sim card in the phone Kingroot fails (why am I not surprised?) Either a reboot occurs in the middle of rooting or it completes the cycle without accomplishing root. If that occurs, my best advice is to change your phone company. If that fails, you may need to factory reset your phone or even install the firmware from scratch and try again without the sim card.
Okay. Working. I tried it 2 Times because i get in troubles with the SuperSu App.
After First Time i Cant open it anymore after adb shell.
Second Time i installed SuperSu, but after adbshell the app was gone (!?) - but i installed it again with adb shell before reboot. Now SuperSu is Working.
And now tell me how to change the FireOS to a Android Status Bar with Notifications, and youre my Hero ;D
najoor said:
** DISCLAIMER: I AM NOT A DEVELOPER. I DO THIS AS A HOBBY AND SHARE MY FINDINGS IN CASE SOMEONE ELSE FINDS THEM USEFUL. **
** THIS WORKED ON MY DEVICE BUT IT MAY NOT WORK ON YOURS. APPLY AT YOUR OWN RISK **​
This has been tested with the unlocked US version running 4.6.1.
Requirements
Make sure your PC can communicate with your fire phone via adb.
The success of this method depends on following the procedure very carefully. So read the instructions and make sure you understand every step before you try it.
Procedure
1- Install and run Kingroot 4.0. You can google and download it or you can use the one in the attached zip file. When Kingroot runs it is all in Chinese, but basically you need to be connected to the internet for it to work. It will do its thing and show progress up to 100% after which you can exit the program. Now your phone is rooted. The following steps replaces the Kinguser with SuperSU.
2- Unzip the attached file in your adb directory and then open an adb terminal and make sure the PC can see your phone (you can check that by typing adb devices). Then type the following:
Code:
adb push su /data/local/tmp
adb push busybox /data/local/tmp
adb shell
3- In the shell that you get type the following and make sure you give the permission when the phone prompts you:
Code:
su
4- Continue by typing the following commands:
Code:
mount -o remount,rw /system
cat /data/local/tmp/su >/system/xbin/daemonsu && chmod 0755 /system/xbin/daemonsu
cat /data/local/tmp/busybox >/system/xbin/busybox && chmod 0755 /system/xbin/busybox
daemonsu -d &
The key is to keep this session running while you continue with the rest, so be careful with typos and monitor this window for any errors.
5- At this point, leave the adb terminal window running and go to your phone, open the Kinguser app, open settings, Root authorization setting, and Remove Root permission .
6- Uninstall the other two Kingroot programs that are still on your phone (KingRoot and the other one with the blue icon and Chinese text under it).
7- Back to the adb terminal, and type the following:
Code:
cat /data/local/tmp/su >/system/xbin/su && chmod 0755 /system/xbin/su
busybox chattr -ia /system/xbin/ku.sud
busybox chattr -ia /system/xbin/supolicy
rm /system/xbin/ku.sud
rm /system/xbin/supolicy
rm /system/bin/rt.sh
rm /system/bin/install-recovery.sh
busybox chattr -ia /system/etc/install-recovery.sh
rm /system/etc/install-recovery.sh
busybox chattr -ia /system/etc/install-recovery.sh-ku.bak
rm /system/etc/install-recovery.sh-ku.bak
rm /system/kroot_*
rm /sdcard/kr-stock-conf
rm -rf /sdcard/Kingroot
rm /system/usr/icu/icusuflag.conf
busybox chattr -ia /system/usr/iku/isu
rm -rf /system/usr/iku
Again, leave the adb terminal window running and go to your phone.
8- Install superSU (from the attached file) on your phone, run it, and let it update the SU binary.
9- Reboot the phone. After about 5 minutes your root is ready.
Hint: It is a good idea to disable Amazon device client platform, DCP platform contracts, and two apps called System Updates in Amazon settings.
Click to expand...
Click to collapse
Not sure what I'm doing wrong but everything works till I get to rm stage of step 7. Im getting 255 read only file system error. Any ideas what I did wrong. since it didnt work to I have reinstall Kingroot and start over or do I start over from the adb shell part?
Viperise152 said:
Not sure what I'm doing wrong but everything works till I get to rm stage of step 7. Im getting 255 read only file system error. Any ideas what I did wrong. since it didnt work to I have reinstall Kingroot and start over or do I start over from the adb shell part?
Click to expand...
Click to collapse
Do you close the adb window between steps 4 and 7? Step 7 should be continued in the window that you left open in step 4.
Do you get any error message after you type each command in part 4?
To redo the process you should install the Kingroot again and stay overt from the beginning.
I did not get any errors for part 4 just when I get to the first rm command in part 7, I'm getting (rm failed for /system/xbin/ku.sud, Read-only file system). Is that normal?
FIXED!!!
Ok i was not following this step properly "open the Kinguser app, open settings, Root authorization setting, and Remove Root permission ." I was not doing through that Root authorization setting which was a few slots down.
Viperise152 said:
Not sure what I'm doing wrong but everything works till I get to rm stage of step 7. Im getting 255 read only file system error. Any ideas what I did wrong. since it didnt work to I have reinstall Kingroot and start over or do I start over from the adb shell part?
Click to expand...
Click to collapse
Please copy and paste the entire content of the adb terminal up to the point that you get the error message and send it to me via pm so I can debug it.
najoor said:
Please copy and paste the entire content of the adb terminal up to the point that you get the error message and send it to me via pm so I can debug it.
Click to expand...
Click to collapse
I still had this page open while I was giving it another go. I figured out what i was doing wrong. The " open the Kinguser app,open settings, Root authorization setting, and remove root permission." part I was just opening Kinguser settings and hitting the big center button turning it off. Did'nt realize i had to go down a few slots to the Root Authorization Setting then hit the Remove Root Permission. After i did it right Kinguser disappeared unistalled the other 2 apps. Everything after that work fine then. Thanks for trying to help me out. Maybe my confusion will help others.
Viperise152 said:
I still had this page open while I was giving it another go. I figured out what i was doing wrong. The " open the Kinguser app,open settings, Root authorization setting, and remove root permission." part I was just opening Kinguser settings and hitting the big center button turning it off. Did'nt realize i had to go down a few slots to the Root Authorization Setting then hit the Remove Root Permission. After i did it right Kinguser disappeared unistalled the other 2 apps. Everything after that work fine then. Thanks for trying to help me out. Maybe my confusion will help others.
Click to expand...
Click to collapse
Thanks for updating with what you were doing wrong. I was having the same issue. Cheers!
funkadelik said:
Thanks for updating with what you were doing wrong. I was having the same issue. Cheers!
Click to expand...
Click to collapse
And me too I should have read your post instead of bugging najoor who has been a great help to resolve my SuperSU
installation
Great thread :good::good:
thx for the guide.
can you explain why it is better to have SuperSu. What is wrong with kingsu?
planning to do this soon, cheers for the guide
so what is safe to remove out of the stock apps
veti said:
thx for the guide.
can you explain why it is better to have SuperSu. What is wrong with kingsu?
Click to expand...
Click to collapse
King user might even be a better SU than superSU, who knows? The problem is that we don't know kinguser. We don't know who wrote it, we don't know what kind of information it gathers, we don't know if it puts a backdoor exploit in your OS, etc. Super SU is a tool that we have used for years. We know exactly what supersu does and who wrote it. We can even communicate with him on xda. Chainfire, the author of SuperSU even has a weblog that he often uses to talk about the intricacies of designing a tool like superSU. There is almost nothing unknown or suspicious about superSU.
On the contrary kingroot/kinguser seems to be intrusive and sneaky. The first thing it does after rooting your phone is to install some random app on it that has nothing to do with rooting and at best I can describe it as bloat. It saves files and folders all over your phone for no apparent reason. Then, it does everything it can to prevent you from removing it. In effect, the only straightforward way to remove it is to give up root, and even then it very suspiciously leaves some executable files behind that God knows if they are sleeper cells or what. To devise the procedure in the OP I had to go through an extensive search to find every little carp that king user has planted into the system and truth be told I will not be surprised if I discover more hidden gems left behind.
The corrected op guide worked great. I had to tap a blue rectangle at two different times to get kingroot to finish (get to a screen that had 100% on it), but other than that, everything worked.
najoor said:
King user might even be a better SU than superSU, who knows? The problem is that we don't know kinguser. We don't know who wrote it, we don't know what kind of information it gathers, we don't know if it puts a backdoor exploit in your OS, etc. Super SU is a tool that we have used for years. We know exactly what supersu does and who wrote it. We can even communicate with him on xda. Chainfire, the author of SuperSU even has a weblog that he often uses to talk about the intricacies of designing a tool like superSU. There is almost nothing unknown or suspicious about superSU.
On the contrary kingroot/kinguser seems to be intrusive and sneaky. The first thing it does after rooting your phone is to install some random app on it that has nothing to do with rooting and at best I can describe it as bloat. It saves files and folders all over your phone for no apparent reason. Then, it does everything it can to prevent you from removing it. In effect, the only straightforward way to remove it is to give up root, and even then it very suspiciously leaves some executable files behind that God knows if they are sleeper cells or what. To devise the procedure in the OP I had to go through an extensive search to find every little carp that king user has planted into the system and truth be told I will not be surprised if I discover more hidden gems left behind.
Click to expand...
Click to collapse
Thank you _so_ much for your effort. I was doing some research too in advance prior to installing kingroot, but didn't get near as much useful information. Sniffing the network connection for any suspicious behaviour via wireshark and my router wasn't successful at all, as they use https.
I came up with the idea that they could have patched some of the system-apps to load an payload even after you tried to "delete everything"(tm). I am currently checking the MD5 and SHA-1 checksum of a identical, second Firephone without root.
---------- Post added at 09:09 PM ---------- Previous post was at 09:05 PM ----------
Also the Mods should pin your post. I totally agree that KingRoot uses intrusive behaviour - as it seems mostly for statistics, but anyway - and should be replaced with the method described in the OP.
EDIT: The MD5 checksum of an unrooted firephone is identical. The System apps might not have been replaced or touched at all. I didn't got a easy chance to check all apps with the SHA-1 checksum though.
Followed the directions and got the root with 0 issues
Just saw this article saying root is now achievable w/ SuperSU via Towelroot: http://dottech.org/180812/how-to-root-amazon-fire-phone-on-android-4-4-kitkat-guide/
Can anyone verify?
amf100 said:
Just saw this article saying root is now achievable w/ SuperSU via Towelroot: http://dottech.org/180812/how-to-root-amazon-fire-phone-on-android-4-4-kitkat-guide/
Can anyone verify?
Click to expand...
Click to collapse
No, it doesn't work. When you run it, the towelroot app pops up a message saying the phone is currently not supported.
Hmph! That's too bad. I wasn't with my fire phone to check for myself. The internet is so weird lol. Why make a whole page with instructions for nothing? Ugh lol
rm /system/bin/rt.sh
Click to expand...
Click to collapse
This part is not working for me. Can't seem to remove it with root explorer either. Any tips?
Im on 4.6.1 with SuperSu. If im Sideload 4.6.1 again and do an Factory Reset. Is root gone? Because Amazon send me New One Because Hardware issues

[ROOT] Disable charging LED

If anyone wants to disable charging LED, here's an easy way via Tasker.
Note: notifications will not cause LED to blink while charging
State, power, power any
Enter task:
1. run shell as root, "chmod 644 /sys/class/leds/red/brightness"
2. run shell as root, "echo 0 > /sys/class/leds/red/brightness"
3. run shell as root, "chmod 444 /sys/class/leds/red/brightness"
Exit task:
1. run shell as root, "chmod 644 /sys/class/leds/red/brightness"
2. run shell as root, "echo 0 > /sys/class/leds/red/brightness"
Hi! Thanks for sharing. I am getting the following error:
23.21.58/E Run Shell: ->
23.21.58/E Run Shell: ->
23.21.58/E Run Shell: ->
23.21.58/Shell runBackground "chmod 644 /sys/class/leds/red/brigthness" root: true timeout: -1
23.21.58/Shell start process-thread ID 725
23.21.58/E add wait type Shell1 time 2147483647
23.21.58/E add wait type Shell1 done
23.21.58/E add wait task
23.21.58/E Error: 127
Am I doing something wrong?
Thanks!
Dj Telo said:
Hi! Thanks for sharing. I am getting the following error:
23.21.58/E Run Shell: ->
23.21.58/E Run Shell: ->
23.21.58/E Run Shell: ->
23.21.58/Shell runBackground "chmod 644 /sys/class/leds/red/brigthness" root: true timeout: -1
23.21.58/Shell start process-thread ID 725
23.21.58/E add wait type Shell1 time 2147483647
23.21.58/E add wait type Shell1 done
23.21.58/E add wait task
23.21.58/E Error: 127
Am I doing something wrong?
Thanks!
Click to expand...
Click to collapse
Does Tasker have root access? Check it in Magisk/superuser section.
_mysiak_ said:
Does Tasker have root access? Check it in Magisk/superuser section.
Click to expand...
Click to collapse
Yes it does. I can even execute other shell commands with root without problem. Is the command you are giving maybe only valid with Nougat and not Oreo?
Thanks!
Dj Telo said:
Yes it does. I can even execute other shell commands with root without problem. Is the command you are giving maybe only valid with Nougat and not Oreo?
Thanks!
Click to expand...
Click to collapse
Oups, my bad, sorry for the typo in the instructions. It has to be brigHTness, not brigTHness.
Will this work on the Mi A3 too?
And will the notification led still blink when not charging the phone?
Thank you
DBuffon said:
Will this work on the Mi A3 too?
And will the notification led still blink when not charging the phone?
Thank you
Click to expand...
Click to collapse
I don't have rooted A3 at hand, so can't try it. It might work, there is no harm in sending those commands over adb shell as root user. You will see the result immediately.
Sent from my Mi A1 using Tapatalk
_mysiak_ said:
I don't have rooted A3 at hand, so can't try it. It might work, there is no harm in sending those commands over adb shell as root user. You will see the result immediately.
Click to expand...
Click to collapse
Ok, I'll try but I don't understand the following:
_mysiak_ said:
State, power, power any
Enter task:
1. run shell as root, "chmod 644 /sys/class/leds/red/brightness"
2. run shell as root, "echo 0 > /sys/class/leds/red/brightness"
3. run shell as root, "chmod 444 /sys/class/leds/red/brightness"
Exit task:
1. run shell as root, "chmod 644 /sys/class/leds/red/brightness"
2. run shell as root, "echo 0 > /sys/class/leds/red/brightness"
Click to expand...
Click to collapse
Are the "Enter task" the code that should be run when the charging cable connects to the phone and the "Exit task" the one that runs when unplugging the cable?
I don't understand what this code does, and I don't want to mess up the led (that is: before I proceed, I want to know how to revert if things don't go as they should). Thank you.
DBuffon said:
Ok, I'll try but I don't understand the following:
Are the "Enter task" the code that should be run when the charging cable connects to the phone and the "Exit task" the one that runs when unplugging the cable?
I don't understand what this code does, and I don't want to mess up the led (that is: before I proceed, I want to know how to revert if things don't go as they should). Thank you.
Click to expand...
Click to collapse
Enter and exit tasks are for Tasker. If you want to try the commands from adb shell, enter those mentioned in "entry task" first and check if LED stopped glowing. To restore the original state enter commands from "exit task" (or just reboot the phone). Changes are not permanent.
Commands do the following - enable RW access to LED control, set intensity to 0%, disable RW access.
_mysiak_ said:
Enter and exit tasks are for Tasker. If you want to try the commands from adb shell, enter those mentioned in "entry task" first and check if LED stopped glowing. To restore the original state enter commands from "exit task" (or just reboot the phone). Changes are not permanent.
Commands do the following - enable RW access to LED control, set intensity to 0%, disable RW access.
Click to expand...
Click to collapse
Great, thanks for the information.
Unfortunately I can't issue the commands (sorry, I'm new to the adb shell):
Code:
[email protected]:~$ adb shell chmod 644 /sys/class/leds/red/brightness
chmod: /sys/class/leds/red/brightness: Permission denied
[email protected]:~$ adb root
adbd cannot run as root in production builds
DBuffon said:
Great, thanks for the information.
Unfortunately I can't issue the commands (sorry, I'm new to the adb shell):
Code:
[email protected]:~$ adb shell chmod 644 /sys/class/leds/red/brightness
chmod: /sys/class/leds/red/brightness: Permission denied
[email protected]:~$ adb root
adbd cannot run as root in production builds
Click to expand...
Click to collapse
adb shell
su
chmod ....
It works on the A3 too. Thanks!
In my mi A1, revengeos android 9, in enter task, 2th step go in error
d_borghi said:
In my mi A1, revengeos android 9, in enter task, 2th step go in error
Click to expand...
Click to collapse
What kind of error..?
_mysiak_ said:
What kind of error..?
Click to expand...
Click to collapse
Allego
d_borghi said:
Allego
Click to expand...
Click to collapse
Try to run that command from terminal on the phone (or via ADB) as root. Alternatively, store the error message in some variable in Tasker and display it, so we know why exactly does it fail. On my phone it still works fine (Mi A3 now).
how can i try by an emulator terminal app in my phone directly?
d_borghi said:
how can i try by an emulator terminal app in my phone directly?
Click to expand...
Click to collapse
Install and run for example this app https://play.google.com/store/apps/details?id=yarolegovich.materialterminal&hl=en
_mysiak_ said:
Install and run for example this app https://play.google.com/store/apps/details?id=yarolegovich.materialterminal&hl=en
Click to expand...
Click to collapse
Finally, I try the app.
By this terminal I receive no error, look at the screenshot.
Why tasker goes in error?
d_borghi said:
Finally, I try the app.
By this terminal I receive no error, look at the screenshot.
Why tasker goes in error?
Click to expand...
Click to collapse
Could you take a screenshot of the details in Tasker for that one task which gives you an error? Maybe you have a typo there.

ADB debugging not working on reboot

I am running lineageOS on a rooted firestick. I am using ADB on the Firestick to control it via Homeassistant. The problem is that the adb debugging does not automatically work on reboot. Everytime i reboot i have to manually go to the menu turn off the ADB debugging and then turn in back on. After doing this i am able to reconnect adb via network (i.e, on homeassistant).
I want to ask is there any way i can use a script to automatically do this on restart of firestick. I have tried creating a script in init.d with the following contents but it doesn't seem to work.
adb tcpip 5555
I have added the following line to build.prop but this doesn't seem to work too
service.adb.tcp.port=5555
On restart the adb debugging is on in the developer tools but somehow it doesn't connect (either to Homeassistant or to my laptop), what seems to make it work is toggling it off and then back on.
Have you tried persist, so that the setting sticks between reboots?
Code:
ADB shell setprop persist.adb.tcp.port 5555
Just tried it. Still not working after reboot.
I there any command i can use to toggle the adb debugging via a startup script or crontab?
symbiansucks said:
Just tried it. Still not working after reboot.
I there any command i can use to toggle the adb debugging via a startup script or crontab?
Click to expand...
Click to collapse
Be sure you are running the above command as root user. Type su at the shell prompt, then type whoami to confirm you are root.
I guess you could make a script to run the following on each boot if the above doesn't work:
Code:
settings put global adb_enabled 1
setprop service.adb.tcp.port 5555
stop adbd
start adbd
exit 0
But I don't think this should be necessary.
Finnzz said:
Be sure you are running the above command as root user. Type su at the shell prompt, then type whoami to confirm you are root.
I guess you could make a script to run the following on each boot if the above doesn't work:
Code:
settings put global adb_enabled 1
setprop service.adb.tcp.port 5555
stop adbd
start adbd
exit 0
But I don't think this should be necessary.
Click to expand...
Click to collapse
Thanks. yes the command was run as root. Can i ask you one more thing, whats the best place to put the startup scripts in? I have tried init.d/ directory but the scripts don't get loaded from there i believe?
I have set permissions to chmod 755 for the script.
You can follow this guide,
Android (LineageOS 16) Execute Script on Start Up | sqall's blog
but it seems like there should be a much easier way to make ADB tcpip persist between reboots. I don't want to steer you wrong. @Sus_i would know better, he uses your build of LineageOS, and may have a cleaner solution.

Categories

Resources