Although Aroma installer is great, development on it stopped a while ago and many devices aren't compatible with it. However the ability for selections in an installer hasn't been completely lost. You can use the volume keys to make selections through a couple different methods.
Note that this needs put into a shell script so either you need to have the updater-script call a shell script or use a dummy updater-script and have it in the update-binary
This combines both methods of volume key selection that I've stumbled across.
The one in the choose method is by @Chainfire and is from his VerifiedBootSigner zip.
The one in the chooseold method uses the keycheck binary by someone755. The original idea was by @Zappo here which I modified a bit to not use the timeout binary since it was a bit wonky when I tested it and to work with any volume key setup. I think the keycheck binary is arm compiled but not sure.
First thing that happens though is that it attempts to get the selection from the zip name. The user can add new or old to the zip (make sure there are no spaces) and skip the whole volume key thing (useful if neither vol key method works on their device - note that this won't work with tools like magisk manager which rename the zip to "install.zip" when flashing).
Second is that the keytest function is run. This is by me tests the chainfire method. One of his comments is that his method needs to be tested with older versions of android and sure enough, it doesn't work properly on many. So the keytest function tests the chainfire method and checks for an error. If there is no error, the installer will use the choose (chainfire) method. If there is an error, it'll use the chooseold (keycheck) method. I favor chainfire's because it's not reliant on a 3rd part binary that may not work with x86 and other devices with unusual cpu architectures
Third, the selection process is run. If using choose, the user makes their selection and the installer continues. If using chooseold, the installer will prompt the user to enter volume up, then volume down. This "programs" the vol keys for that device since it may vary between devices. Then the user makes their selection and the installer moves on.
Here's the code. At the bottom of it are 2 comments where you can put your stuff you want to have happen depending on the selection.
Code:
# Get option from zip name if applicable
case $(basename $ZIP) in
*new*|*New*|*NEW*) NEW=true;;
*old*|*Old*|*OLD*) NEW=false;;
esac
# Change this path to wherever the keycheck binary is located in your installer
KEYCHECK=$INSTALLER/keycheck
chmod 755 $KEYCHECK
keytest() {
ui_print "- Vol Key Test -"
ui_print " Press a Vol Key:"
(/system/bin/getevent -lc 1 2>&1 | /system/bin/grep VOLUME | /system/bin/grep " DOWN" > $INSTALLER/events) || return 1
return 0
}
choose() {
#note from chainfire @xda-developers: getevent behaves weird when piped, and busybox grep likes that even less than toolbox/toybox grep
while true; do
/system/bin/getevent -lc 1 2>&1 | /system/bin/grep VOLUME | /system/bin/grep " DOWN" > $INSTALLER/events
if (`cat $INSTALLER/events 2>/dev/null | /system/bin/grep VOLUME >/dev/null`); then
break
fi
done
if (`cat $INSTALLER/events 2>/dev/null | /system/bin/grep VOLUMEUP >/dev/null`); then
return 0
else
return 1
fi
}
chooseold() {
# Calling it first time detects previous input. Calling it second time will do what we want
$KEYCHECK
$KEYCHECK
SEL=$?
if [ "$1" == "UP" ]; then
UP=$SEL
elif [ "$1" == "DOWN" ]; then
DOWN=$SEL
elif [ $SEL -eq $UP ]; then
return 0
elif [ $SEL -eq $DOWN ]; then
return 1
else
ui_print " Vol key not detected!"
abort " Use name change method in TWRP"
fi
}
ui_print " "
if [ -z $NEW ]; then
if keytest; then
FUNCTION=choose
else
FUNCTION=chooseold
ui_print " ! Legacy device detected! Using old keycheck method"
ui_print " "
ui_print "- Vol Key Programming -"
ui_print " Press Vol Up Again:"
$FUNCTION "UP"
ui_print " Press Vol Down"
$FUNCTION "DOWN"
fi
ui_print " "
ui_print "- Select Option -"
ui_print " Choose which option you want installed:"
ui_print " Vol Up = New, Vol Down = Old"
if $FUNCTION; then
NEW=true
else
NEW=false
fi
else
ui_print " Option specified in zipname!"
fi
if $NEW; then
# insert stuff for new here
else
# insert stuff for old here
fi
Attached is the keycheck binary. The original source of it is here along with the timeout binary if you want to give that a go
If you want to have more than 2 selections, you can just add more selections by adding conditionals and calling $FUNCTION again. The V4A mod I help with here is a good example of this
If you have a device with a bixby button and want to use it or you have awk bundled in your installer and/or on target device (it's a part of busybox) and want to use an alternative getevent method, check out this post. Big thanks to @ianmacd
If you know of any other methods or of any improvements (since much of this is kind of hacky), let me know! I'll add it here :fingers-crossed:
Hey @Zackptg5, Ive been making a module that is kinda based entirely around this Volume key thing, not gonna give anything away just yet, but it requires a lot of choices to be made using the volume keys. Based on what the script above shows, the key inputs are tested for everytime you want to get an input, with the keytest function, then the choose port function is decided on that.
From the above code, for my device, the keytest would recognise the newer method and do that one the first time around, but whenever an input is required a second time, it would revert to the legacy ,ethod. Time consuming. So what I did was store tje exit status of the keytest function as a variable keytest_status, and always make a check against that variable whenever an input is needed.
For those with a modern keytest method, this would solve the function reverting to the legacy one. Check the attached file for a better description. I'm still working away so if i find anything else I'll let you know:good:
Also added a couple functions for size benefits etc
Sent from my OnePlus5T using XDA Labs
OldMid said:
Hey @Zackptg5, Ive been making a module that is kinda based entirely around this Volume key thing, not gonna give anything away just yet, but it requires a lot of choices to be made using the volume keys. Based on what the script above shows, the key inputs are tested for everytime you want to get an input, with the keytest function, then the choose port function is decided on that.
From the above code, for my device, the keytest would recognise the newer method and do that one the first time around, but whenever an input is required a second time, it would revert to the legacy ,ethod. Time consuming. So what I did was store tje exit status of the keytest function as a variable keytest_status, and always make a check against that variable whenever an input is needed.
For those with a modern keytest method, this would solve the function reverting to the legacy one. Check the attached file for a better description. I'm still working away so if i find anything else I'll let you know:good:
Also added a couple functions for size benefits etc
Sent from my OnePlus5T using XDA Labs
Click to expand...
Click to collapse
Not quite sure what you mean but the keytest function is only run once when the script is initially run to determine whether the new or old choose function should be used. It also looks like you based yours on v4a (the one in the OP here has been reworked a bit to make it easier/more efficient). Also changed it up a bit to make it easier for you, let me know if this does what you want
Zackptg5 said:
Not quite sure what you mean but the keytest function is only run once when the script is initially run to determine whether the new or old choose function should be used. It also looks like you based yours on v4a (the one in the OP here has been reworked a bit to make it easier/more efficient). Also changed it up a bit to make it easier for you, let me know if this does what you want
Click to expand...
Click to collapse
No attachement:laugh: What I meant was that it would to the legacy key programming function every second time an input was needed, and the normal one every first time.
It would:
Initial key programming
detect modern version and continue
if an input is required it would switch back to legacy method
switch back to modern when another input is needed
switch back to legacy again
repeat until no more inputs are needed and script is finished running. But this may also be because I'm using the old logic:silly:
Sent from my OnePlus5T using XDA Labs
OldMid said:
No attachement:laugh: What I meant was that it would to the legacy key programming function every second time an input was needed, and the normal one every first time.
It would:
Initial key programming
detect modern version and continue
if an input is required it would switch back to legacy method
switch back to modern when another input is needed
switch back to legacy again
repeat until no more inputs are needed and script is finished running. But this may also be because I'm using the old logic:silly:
Sent from my OnePlus5T using XDA Labs
Click to expand...
Click to collapse
Oh, that may be because of the old logic. Does that happen with the one I attached on the last post?
Zackptg5 said:
Oh, that may be because of the old logic. Does that happen with the one I attached on the last post?
Click to expand...
Click to collapse
I don't see anything attached
Sent from my OnePlus5T using XDA Labs
OldMid said:
I don't see anything attached
Sent from my OnePlus5T using XDA Labs
Click to expand...
Click to collapse
Sorry, forgot that xda doesn't like .sh files
Zackptg5 said:
Sorry, forgot that xda doesn't like .sh files
Click to expand...
Click to collapse
Yeah it fixes it:good:
Sent from my OnePlus5T using XDA Labs
HMMM... It doesn't work for me. I am trying to create a ZIP file to do some updates into the system requiring basic A/B selections. I am trying to implement this in a basic TWRP ZIP module. Have you managed to include it in a flashable ZIP file without Magisk? I could adapt V4A FX installer, but I don't want this to be a Unity module since it doesn't install anything. For some reason removing that unity thing is creating all the problem. Any clue?
Oki said:
HMMM... It doesn't work for me. I am trying to create a ZIP file to do some updates into the system requiring basic A/B selections. I am trying to implement this in a basic TWRP ZIP module. Have you managed to include it in a flashable ZIP file without Magisk? I could adapt V4A FX installer, but I don't want this to be a Unity module since it doesn't install anything. For some reason removing that unity thing is creating all the problem. Any clue?
Click to expand...
Click to collapse
I'll need to see it to find what the problem is. You can pm me if you don't want it public yet
Zackptg5 said:
I'll need to see it to find what the problem is. You can pm me if you don't want it public yet
Click to expand...
Click to collapse
I solved it using only the keycheck program. getevent was not working fine for me. You can download and inspect my code here.
This is my version:
Code:
#!/sbin/sh
ui_print() {
echo -n -e "ui_print $1\n" > /proc/self/fd/$OUTFD
echo -n -e "ui_print\n" > /proc/self/fd/$OUTFD
}
keytest() {
$KEYCHECK
KEYCODE=$?
if [ "$KEYCODE" = 42 ] ; then
return 0
else
return 1
fi
}
customkey() {
# Calling it first time detects previous input. Calling it second time will do what we want
$KEYCHECK
#$KEYCHECK
SEL=$?
if [ "$1" == "UP" ]; then
UP=$SEL
elif [ "$1" == "DOWN" ]; then
DOWN=$SEL
elif [ $SEL -eq $UP ]; then
return 0
elif [ $SEL -eq $DOWN ]; then
return 1
else
ui_print " Vol key not detected!"
abort " Use name change method in TWRP"
fi
}
##### THE PARTY STARTS HERE ########
# INITIAL CLEANUP
cd /tmp
rm -rf $INSTALLER 2>/dev/null
mkdir -p $INSTALLER
# extract files
ui_print "Extracting files."
cd $INSTALLER
unzip -o "$ZIP"
chmod 777 $KEYCHECK
ui_print " "
ui_print " #########################################"
ui_print " PROGRAM NAME"
ui_print " #########################################"
ui_print " "
ui_print " Welcome message"
ui_print " "
ui_print " Press Vol Up to continue..."
if keytest; then
FUNCTION=keytest
else
FUNCTION=customkey
ui_print " - Device detected! but using custom key method"
ui_print " "
ui_print " - Vol Key Programming -"
ui_print " Press Vol Up Again..."
$FUNCTION "UP"
ui_print " Press Vol Down..."
$FUNCTION "DOWN"
fi
# QUESTION 1 ##########
ui_print " - Continue?"
ui_print " Vol UP = YES, Vol DN = NO"
if ! $FUNCTION ; then
ui_print " "
ui_print " - Loser...."
exit 0
fi
# QUESTION 2 ##########
ui_print " "
ui_print " - Do you like this script?"
ui_print " Vol UP: YES / Vol DN: NO"
if $FUNCTION ; then
ui_print " - THANKS!!!!!"
else
ui_print " - I'm so sorry."
fi
# MORE QUESTIONS... ##########
Thanks!
Oki said:
I solved it using only the keycheck program. getevent was not working fine for me. You can download and inspect my code here.
This is my version:
Code:
#!/sbin/sh
ui_print() {
echo -n -e "ui_print $1\n" > /proc/self/fd/$OUTFD
echo -n -e "ui_print\n" > /proc/self/fd/$OUTFD
}
keytest() {
$KEYCHECK
KEYCODE=$?
if [ "$KEYCODE" = 42 ] ; then
return 0
else
return 1
fi
}
customkey() {
# Calling it first time detects previous input. Calling it second time will do what we want
$KEYCHECK
#$KEYCHECK
SEL=$?
if [ "$1" == "UP" ]; then
UP=$SEL
elif [ "$1" == "DOWN" ]; then
DOWN=$SEL
elif [ $SEL -eq $UP ]; then
return 0
elif [ $SEL -eq $DOWN ]; then
return 1
else
ui_print " Vol key not detected!"
abort " Use name change method in TWRP"
fi
}
##### THE PARTY STARTS HERE ########
# INITIAL CLEANUP
cd /tmp
rm -rf $INSTALLER 2>/dev/null
mkdir -p $INSTALLER
# extract files
ui_print "Extracting files."
cd $INSTALLER
unzip -o "$ZIP"
chmod 777 $KEYCHECK
ui_print " "
ui_print " #########################################"
ui_print " PROGRAM NAME"
ui_print " #########################################"
ui_print " "
ui_print " Welcome message"
ui_print " "
ui_print " Press Vol Up to continue..."
if keytest; then
FUNCTION=keytest
else
FUNCTION=customkey
ui_print " - Device detected! but using custom key method"
ui_print " "
ui_print " - Vol Key Programming -"
ui_print " Press Vol Up Again..."
$FUNCTION "UP"
ui_print " Press Vol Down..."
$FUNCTION "DOWN"
fi
# QUESTION 1 ##########
ui_print " - Continue?"
ui_print " Vol UP = YES, Vol DN = NO"
if ! $FUNCTION ; then
ui_print " "
ui_print " - Loser...."
exit 0
fi
# QUESTION 2 ##########
ui_print " "
ui_print " - Do you like this script?"
ui_print " Vol UP: YES / Vol DN: NO"
if $FUNCTION ; then
ui_print " - THANKS!!!!!"
else
ui_print " - I'm so sorry."
fi
# MORE QUESTIONS... ##########
Thanks!
Click to expand...
Click to collapse
I prefer the getevent one because it doesn't involve any binaries but it is more finicky than the keycheck method. Since your mod is for arm devices, keycheck should be fine. The keytest stuff all looks good except that in the keytest function, you probably would want it to be
Code:
if [ $KEYCODE -eq 42 ]; then
since it's integer comparison. You could keep as string the way you have it but you would need a '==' rather than a '='
Also, the keytest function doesn't program volume down key at all (it's typically 21). I just always use the custom key logic just in case there's that one weird device
Zackptg5 said:
I prefer the getevent one because it doesn't involve any binaries but it is more finicky than the keycheck method. Since your mod is for arm devices, keycheck should be fine. The keytest stuff all looks good except that in the keytest function, you probably would want it to be
Code:
if [ $KEYCODE -eq 42 ]; then
since it's integer comparison. You could keep as string the way you have it but you would need a '==' rather than a '='
Also, the keytest function doesn't program volume down key at all (it's typically 21). I just always use the custom key logic just in case there's that one weird device
Click to expand...
Click to collapse
I totally agree. I don't want to load the TWRP Zip with unnecessary tools. My problem was that for some reason the getevent method was colliding with some libraries in the implementation for my device, an Axon 7. So I decided to go this way. I would like to convert it to pure getevent method.
Regarding the comparison, you are right, I will have to change that. The link is the very first working version of the tool and there is a lot of code cleanup required. The tool I have developed is a TWRP Zip module that splits a vendor partition from system or userdata, so developers could create treblerized roms for legacy devices. I have an Axon 7, released with Android M, and we have now unofficial Android P, LOS 16.0 and a couple of treble roms supporting a lot of GSI. My objective is to make it as general and compatible as I could.
Thanks Again!
Zackptg5 said:
You could keep as string the way you have it but you would need a '==' rather than a '='
Click to expand...
Click to collapse
Actually, a single '=' is fine for string comparison, and is actually the only string comparison operator accepted by the [ and test commands of POSIX-compliant shells.
ianmacd said:
Actually, a single '=' is fine for string comparison, and is actually the only string comparison operator accepted by the [ and test commands of POSIX-compliant shells.
Click to expand...
Click to collapse
Thanks for the correction, guess a single '=' could work. However, Android shell isn't posix compliant. It's its own beast :/
Zackptg5 said:
Thanks for the correction, guess a single '=' could work. However, Android shell isn't posix compliant. It's its own beast :/
Click to expand...
Click to collapse
The Android shell nowadays is mksh, and yes, you're right, it isn't terribly POSIX-compliant, even when started with -o posix.
Just be aware that the '==' comparison operator doesn't work in some shells in combination with single brackets, whereas the single '=' always will. zsh, for example:
Code:
$ zsh -c '[ x = y ]'
$ zsh -c '[ x == y ]'
zsh:1: = not found
The single '=' predates '==' by quite a margin. The double '==' is best reserved for the double bracket command: [[
Anyway, I don't want to go too far off-topic. It's just that shells are an area of particular interest to me.
Thanks for starting this thread, by the way. I now user a modified version of this code in the installer of my S9/S9+ kernel, APGK, to allow the user to interactively select certain features at install-time. The only gotcha is that I have to manually mount /system to gain access to the getevent binary.
I prefer to pipe the output through awk and output only the penultimate field:
Code:
local key=$( getevent -lqc 1 | awk '{ print $(NF-1) }' )
And since the S9/S9+ also has a Bixby button, I add a line of code to return something more legible than the raw keycode when this is pressed:
Code:
[ $key = 02bf ] && key=KEY_BIXBY
Perhaps these details will be of some use to someone.
ianmacd said:
The Android shell nowadays is mksh, and yes, you're right, it isn't terribly POSIX-compliant, even when started with -o posix.
Just be aware that the '==' comparison operator doesn't work in some shells in combination with single brackets, whereas the single '=' always will. zsh, for example:
Code:
$ zsh -c '[ x = y ]'
$ zsh -c '[ x == y ]'
zsh:1: = not found
The single '=' predates '==' by quite a margin. The double '==' is best reserved for the double bracket command: [[
Anyway, I don't want to go too far off-topic. It's just that shells are an area of particular interest to me.
Thanks for starting this thread, by the way. I now user a modified version of this code in the installer of my S9/S9+ kernel, APGK, to allow the user to interactively select certain features at install-time. The only gotcha is that I have to manually mount /system to gain access to the getevent binary.
I prefer to pipe the output through awk and output only the penultimate field:
Code:
local key=$( getevent -lqc 1 | awk '{ print $(NF-1) }' )
And since the S9/S9+ also has a Bixby button, I add a line of code to return something more legible than the raw keycode when this is pressed:
Code:
[ $key = 02bf ] && key=KEY_BIXBY
Perhaps these details will be of some use to someone.
Click to expand...
Click to collapse
Good to know. I link this to the OP, thanks!
Sorry to revive an old thread but I need some help guys. I'm converting GSI's to flashable zips and for my custom stock rom installation, I want Xposed to be installed with Vol+ and not installed(updater-script continues) with Vol-. Also, i'll be using just the old method with keycheck. Any pointers on how I would accomplish that? Thanks much
Del
Optimization details:
Added double quotes around variables to handle potential issues with spaces in filenames.
Replaced the use of backticks with the $(command) syntax for command substitution.
Used the -q option with grep to suppress output and replaced /dev/null redirection.
Removed unnecessary calls to cat.
Simplified comparisons by directly using the variable values.
Removed redundant blank lines and unnecessary ui_print statements.
Bash:
# Get option from zip name if applicable
case $(basename "$ZIP") in
*[nN][eE][wW]*) NEW=true;;
*[oO][lL][dD]*) NEW=false;;
esac
# Change this path to wherever the keycheck binary is located in your installer
KEYCHECK="$INSTALLER/keycheck"
chmod 755 "$KEYCHECK"
keytest() {
ui_print "- Vol Key Test -"
ui_print " Press a Vol Key:"
/system/bin/getevent -lc 1 2>&1 | /system/bin/grep -q "VOLUME.* DOWN" > "$INSTALLER/events"
return $?
}
choose() {
ui_print "- Vol Key Programming -"
ui_print " Press Vol Up Again:"
$KEYCHECK
$KEYCHECK
SEL=$?
if [ "$1" == "UP" ]; then
UP=$SEL
elif [ "$1" == "DOWN" ]; then
DOWN=$SEL
elif [ "$SEL" -eq "$UP" ]; then
return 0
elif [ "$SEL" -eq "$DOWN" ]; then
return 1
else
ui_print " Vol key not detected!"
abort " Use name change method in TWRP"
fi
}
ui_print " "
if [ -z "$NEW" ]; then
if keytest; then
FUNCTION=choose
else
FUNCTION=chooseold
ui_print " ! Legacy device detected! Using old keycheck method"
ui_print " "
$FUNCTION "UP"
$FUNCTION "DOWN"
fi
ui_print " "
ui_print "- Select Option -"
ui_print " Choose which option you want installed:"
ui_print " Vol Up = New, Vol Down = Old"
if $FUNCTION; then
NEW=true
else
NEW=false
fi
else
ui_print " Option specified in zipname!"
fi
ui_print " "
if "$NEW"; then
# insert stuff for new here
else
# insert stuff for old here
fi
This is untested but since i am investigating into a new AROMA Replacement this might be interesting as alternative. I will play around with it later...
Related
Is there anyone working on it? Its really worth a shot. Even for the Aroma installer.
Özgürce said:
Is there anyone working on it? Its really worth a shot. Even for the Aroma installer.
Click to expand...
Click to collapse
Blefish is porting touch recovery, he tweeted that he will be releasing it with CM9 0.03 in mid July.
Yea, its working well, but its missing the atmel support again (...). I will tweet as soon as I get it properly working on both touch panels.
Sent from my U8800 using Tapatalk 2
Can you release it? At atmel will work with hardware buttons until you fix this..
Sent from my U8800
Why release it since the touch wont work for Atmel users, so no TOUCH recovery.
AceDroidX said:
Why release it since the touch wont work for Atmel users, so no TOUCH recovery.
Click to expand...
Click to collapse
Yes, but Blefish could release a version for those with synaptics... I think it wouldn't hurt
Sent from my U8800
It will be only for U8800 (not for pro) I think??
fjsferreira said:
Yes, but Blefish could release a version for those with synaptics... I think it wouldn't hurt
Sent from my U8800
Click to expand...
Click to collapse
Yes, and we could act as beta testers, so if there is some bug it could be fixed on next, atmel support version.
Blefish said:
Yea, its working well, but its missing the atmel support again (...). I will tweet as soon as I get it properly working on both touch panels.
Sent from my U8800 using Tapatalk 2
Click to expand...
Click to collapse
Thats great! Glad to hear someone working on it. I'm using 4EXT Touch recovery on my Incredible S. Its awesome.
Blefish said:
Yea, its working well, but its missing the atmel support again (...). I will tweet as soon as I get it properly working on both touch panels.
Sent from my U8800 using Tapatalk 2
Click to expand...
Click to collapse
Will it support Universal Flasher Tool for theming?
With your CyanogemMOD ROM that will be a must have!!!
For the moment it is only supported by 5.0.2.7 CWM...
sr21 said:
Will it support Universal Flasher Tool for theming?
With your CyanogemMOD ROM that will be a must have!!!
For the moment it is only supported by 5.0.2.7 CWM...
Click to expand...
Click to collapse
Can you get me the log? Try to flash it and after that go to advanced options, you should find it there.
About recovery - I'll cook it up, it will not have "offmode" charging as it's not handled by recovery nowadays. And of course, no Atmel support just yet.
Blefish said:
Can you get me the log? Try to flash it and after that go to advanced options, you should find it there.
About recovery - I'll cook it up, it will not have "offmode" charging as it's not handled by recovery nowadays. And of course, no Atmel support just yet.
Click to expand...
Click to collapse
LOG:
Code:
failed to open /sys/class/android_usb_/android0/state: No such file or directory
Universal Flasher Tool 3.6
sr21 said:
LOG:
Code:
failed to open /sys/class/android_usb_/android0/state: No such file or directory
Universal Flasher Tool 3.6
Click to expand...
Click to collapse
That error is common in 2.6.35 kernel with CWM 5.5.0.4. I'd need the whole log to help you. Or, you can send me the updater-script that should be located at zip-file/META-INF/com/google/android.
Blefish said:
That error is common in 2.6.35 kernel with CWM 5.5.0.4. I'd need the whole log to help you. Or, you can send me the updater-script that should be located at zip-file/META-INF/com/google/android.
Click to expand...
Click to collapse
You can see the script in the Universal Flasher Tool link that I provided before. The zip is a template.
It uses a script to do the modding in the recovery.
You can also check one of my flashable zips that I use in my TouchWiz MOD/ADDON PACK: Touchwiz_for_u8800_u8800pro_v4.1.0.1u1_signed.zip
You need to check the /META-INF/com/google/android/, the /tools/, /MORPH/ (themed apps goes here) and the MOD.config file.
I think the script fails here (/tools/run.sh):
Code:
################### MORPHING ##################
UI_PRINT " "; LOG="MORPHING >>"; LOGS "$LOG"; UI_PRINT "$LOG"
CHECK2=0
x=1
until [ $x = 0 ]; do
if [ -d $PATHDATA ];then
WORK=$PATHDATA
SYSTEM="/data/app"
elif [ ! -d $PATHDATA ] && [ -d $PATHFRAM ];then
WORK=$PATHFRAM
SYSTEM="/system/framework"
elif [ ! -d $PATHDATA ] && [ ! -d $PATHFRAM ] && [ -d $PATHAPP ]; then
WORK=$PATHAPP
SYSTEM="/system/app"
elif [ ! -d $PATHDATA ] && [ ! -d $PATHFRAM ] && [ ! -d $PATHAPP ]; then
x=0
fi
if [ $x = 1 ]; then
for f in $(ls $WORK); do
if [ -e $SYSTEM/$f ];then
if [ `/cache/tools/tar -tPf $RESTORE/backup.tar $SYSTEM/$f | wc -l` = 0 ]; then
/cache/tools/tar -prPf $RESTORE/backup.tar $SYSTEM/$f
fi
mkdir -p /$APPLY
f2="`echo $f | cut -d "." -f 1`.zip"
mv $SYSTEM/$f /$APPLY/$f2
#FIX -V4 SUFFIXES IN FOLDERS
if [ $V4MORPHING = "yes" ] && [ -d $WORK/$f/res ];then
FILES=`/system/xbin/7z l $APPLY/$f2 | awk '{print $6}'`
cd $WORK/$f/res
find * -type d | while read i;do
if [ `echo $FILES | grep $i-v4 | wc -l` != 0 ]; then
mv $WORK/$f/res/$i $WORK/$f/res/$i-v4
fi
done
fi
#CYANOGENMOD vs STOCK BASED ROM
if [ $MULTIPLATTFORM = "yes" ];then
cd $WORK/$f
find * -type f | while read i;do
if [ $CYANO = "yes" ] && [ `basename $i | cut -d "#" -f 1` = "CMOD" ];then
mv $WORK/$f/$i $WORK/$f/`dirname $i`/`basename $i | cut -d "#" -f 2`
elif [ $CYANO = "no" ] && [ `basename $i | cut -d "#" -f 1` = "CMOD" ];then
rm $i
fi
done
fi
#MORPH, ZIP & ZIPALIGN
if [ $CLEANMORPHING = "yes" ];then
MORPH=`/system/xbin/7z a -ur0x2y2z2w2 $APPLY/$f2 $WORK/$f/* | grep -o -E "Everything is Ok" | wc -l`
else
MORPH=`/system/xbin/7z a $APPLY/$f2 $WORK/$f/* | grep -o -E "Everything is Ok" | wc -l`
fi
/cache/tools/zipalign -f 4 $APPLY/$f2 $SYSTEM/$f
rm -Rf $APPLY $WORK/$f
chown 0.0 $SYSTEM/$f && chmod 644 $SYSTEM/$f
if [ ! -e $SYSTEM/$f ] || [ $MORPH = 0 ]; then
/cache/tools/tar -pxPf $RESTORE/backup.tar $SYSTEM/$f
LOG="[X] Error with $f!"; LOGS "$LOG"; UI_PRINT "$LOG"
LOG="[<] Restored original $f"; LOGS "$LOG"; UI_PRINT "$LOG"
let CHECK2=$CHECK2-1
else
LOGS "[v] $SYSTEM/$f morphed"; UI_PRINT "[v] $f morphed"
let CHECK2=$CHECK2+2
fi
else
LOG="[!] $f not found, ignoring"; LOGS "$LOG"; UI_PRINT "$LOG"
fi
done
rm -R $WORK
fi
done
if [ $CHECK2 -le 0 ];then
LOG="[!] Nothing to morph"; LOGS "$LOG"; UI_PRINT "$LOG"
fi
Thanks to Chainfire for the original idea here, here comes the version for AROMA installers.
Purpose: Do "live" output from a shell script to the AROMA user interface in installation step.
How it works: The update-binary uses a pipe for accessing the UI of the recovery like writing a line of text or updating the progress-bar. AROMA does basically the same thing -- the main AROMA installer opens another pipe and forks itself for the actual installation, the child running the installation writes to the pipe of the parent AROMA. If you try Chainfire's script from above, it will obtain the pipe of the recovery UI and write to that instead of the AROMA UI, only causing some nasty screen flicker. Because AROMA forks only directly before starting the installation, it is a little trickier to get it right -- we have to wait for the child to show up in 'ps'.
Code:
OUTFD=$(ps | grep -v grep | grep -oE "aroma/update-binary(.*)" | cut -d " " -f 3)
if [ $OUTFD == "" ]; then
count=4
while [ $count -ge 0 ]; do
sleep 1
OUTFD=$(ps | grep -v grep | grep -oE "aroma/update-binary(.*)" | cut -d " " -f 3)
if [$OUTFD != ""]; then break; fi
count=$((count-1))
done
fi
progress() {
if [ $OUTFD != "" ]; then
echo "progress ${1} ${2} " 1>&$OUTFD
fi
}
set_progress() {
if [ $OUTFD != "" ]; then
echo "set_progress ${1} " 1>&$OUTFD
fi
}
ui_print() {
if [ $OUTFD != "" ]; then
echo "ui_print ${1} " 1>&$OUTFD
echo "ui_print " 1>&$OUTFD
else
echo "${1}"
fi
}
The script above provides the functions progress, set_progress and ui_print. Instead of putting it in every script, I suggest you place it alongside your installer shellscripts, name it ui_functions.sh and source it like this:
Code:
. ./ui_functions.sh
The Clarity Ensemble phone is an Android-based captioning land-line phone. The newest model has an 8" touchscreen. Older model has 7" touchscreen. It comes with an app that runs at startup and keeps you from gaining access to the Android home screen or any other Android apps or settings. While booting up you momentarily see the time and can pull down to touch on Settings and bring up the regular Android settings but very soon as the boot process continues the splash screen and later the ThorB app will take over the screen.
In order to telnet to the device, you first need to start telnetd running on the Ensemble. This can be done by configuring your computer to appear to the Ensemble to be the update server. I directly connected the phone to a laptop Ethernet port. On the laptop, I installed a DHCP server, a DNS server, and a web server. I am running Windows and I used "DHCP Server for Windows" version 2.5.1, ApateDNS, and WWebserver with PHP 5.4.45. I set the laptop to a static IP of 8.8.4.4 since Wireshark revealed that the Ensemble was using that as the DNS server. I set ApateDNS server to return 8.8.4.4 as the IP address for all queries.
In my htdocs folder, I created a directory called thorbfota and inside that a directory called purple_prod. Inside purple_prod I created three files, download_file.php, query_site.php, and query_versions.php.
Code:
<?php
//download_file.php
ignore_user_abort(true);
set_time_limit(0);
//Replace with actual path to your files
$path = "C:/Users/User/Documents/ClarityEnsembleFiles/";
$dl_file = preg_replace("([^\w\s\d\-_~,;:\[\]\(\).]|[\.]{2,})", '', $_GET['filename']);
$dl_file = filter_var($dl_file, FILTER_SANITIZE_URL);
$fullPath = $path.$dl_file;
if ($fd = fopen ($fullPath, "r")) {
$fsize = filesize($fullPath);
$path_parts = pathinfo($fullPath);
$ext = strtolower($path_parts["extension"]);
switch ($ext) {
case "pdf":
header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\"");
break;
case "bin":
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\"");
break;
case "zip":
header("Content-type: application/zip");
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\"");
break;
case "apk":
header("Content-type: application/vnd.android.package-archive");
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\"");
break;
//Add more headers for other content types here
default;
header("Content-type: application/octet-stream");
header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
break;
}
header("Content-length: $fsize");
header("Cache-control: private");
while(!feof($fd)) {
$buffer = fread($fd, 2048);
echo $buffer;
}
}
fclose ($fd);
exit;
Code:
<?php
//query_site.php
//This forum would not allow me to post links since this is my first post.
//Feel free to move the "h" below right up against the "ttp..."
echo "h" . "ttp://clarityengineering.us/thorbfota/purple_prod/";
?>
Code:
<?php
//query_versions.php
//Replace with actual path to your files
$path = "C:/Users/User/Documents/ClarityEnsembleFiles/";
//Replace file versions with your current version numbers
//To cause phone to update a file, use a number larger that the current version
$file = "ThorB.apk";
$file_ver = "2.63";
$fullPath = $path.$file;
echo $file . "=" . $file_ver . "," . strtoupper(md5_file($fullPath)) . "|\r";
$file = "thorb-ota.zip";
$file_ver = "20150305.182516";
$fullPath = $path.$file;
echo $file . "=" . $file_ver . "," . strtoupper(md5_file($fullPath)) . "|\r";
$file = "dcx.bin";
$file_ver = "b033";
$fullPath = $path.$file;
echo $file . "=" . $file_ver . "," . strtoupper(md5_file($fullPath)) . "|\r";
$file = "eep.bin";
$file_ver = "be25";
$fullPath = $path.$file;
echo $file . "=" . $file_ver . "," . strtoupper(md5_file($fullPath)) . "|\n";
echo "survey=0,0|";
?>
I found that eep.bin was actually just a shell script that is downloaded to the device and run as root. I put my update files in "C:\Users\User\Documents\ClarityEnsembleFiles" but you can put them anywhere you like, just make sure to update the php files above to reflect their location. So far I have only used eep.bin but to keep my php script happy I also created placeholder files, dcx.bin, thorb-ota.zip, and ThorB.apk and placed them with eep.bin in my ClarityEnsembleFiles folder. Below is my eep.bin that starts telnet and simulates pressing the Home button. Just touch "Home Sample" when the "Complete action using" window pops up on the Ensemble. The semicolon at the end of the line avoids having the carriage return kill the command. Alternatively, you could run dos2unix on the eep.bin file and not need the semicolon at the line end.
Code:
#eep.bin
telnetd -l /system/bin/sh;am start -a android.intent.action.MAIN -c android.intent.category.HOME;
Every time you change the eep.bin file and want to run it on the phone make sure to close the Software upgrade screen and touch "Check now" button and then "Upgrade" button.
To install apps on the phone, first download the apk file to the phone with wget and then run "pm install -r YourApp.apk".
I have not found a physical Home, Back or Menu button on the phone so one of the first things you may want to install is a software solution for those. I installed "To Home" and it didn't work when configured with the root option for "Floating Buttons". It works fine when configured with the non-root option for "Floating Buttons". I have not tried any of the several other soft button apps available.
There is a 14 pin connector on the underside of the phone that presumably is used in the factory to connect to a dock for programming. I have not investigated the function of any of the pins but I suspect USB is there as well as possibly serial port(s) and maybe JTAG.
Before connecting the phone to the internet, you probably will want to either disable/uninstall the ThorB.apk app or create a firewall on the phone or on your router to keep it from being able to automatically update and from being able to report back to it's maker.
Besides being available for purchase, the phone is also available from ClearCaptions at no charge if you provide them with a 3rd party certification of being hard of hearing.
As far as using the phone, "Federal law prohibits anyone but registered users with hearing loss from using this device with the captions on." So if your hearing it fine, make sure to turn captions off or don't turn them on.
Telnet is great but I wanted a more secure connection to the phone so I set up an Android cross-compiler and compiled the latest version of dropbear (dropbear-2016.73). I don't have a 64-bit computer so in order to use the latest version of the Android toolchain, I had to boot into Windows and install Cygwin.
Thanks to serasihay for patches to an earlier version of dropbear. I adapted them to work with the latest version of dropbear. The patch can be found by searching dropbear-2016.73-android-20160427.patch on pastebin. Most of the warnings generated during compile were from pre-patched dropbear code and can be viewed on pastebin by searching for "Compile warnings for compiling dropbear-2016.73.android"
After setting up the toolchain, dropbear can be compiled with the following commands:
Code:
tar jxf dropbear-2016.73.tar.bz2
cd dropbear-2016.73
patch -p1 < /path/to/patch/dropbear-2016.73-android-20160426.patch
./configure --build=x86-windows --host=arm-linux-androideabi --disable-zlib --disable-largefile --disable-loginfunc --disable-shadow --disable-utmp --disable-utmpx --disable-wtmp --disable-wtmpx --disable-pututline --disable-pututxline --disable-lastlog
make MULTI=1 SCPPROGRESS=1 PROGRAMS="dropbear dropbearkey scp dbclient"
arm-linux-androideabi-strip.exe dropbearmulti
This generates a single binary file, dropbearmulti which you will want to copy to the phone to /system/xbin/dropbearmulti. Next, you will want to create symbolic links like this:
Code:
cd /system/xbin
ln -s dropbearmulti dbclient
ln -s dropbearmulti dropbear
ln -s dropbearmulti dropbearkey
ln -s dropbearmulti scp
I should probably redo the patch to enable the -R option to create the host keys but for now you can do it with:
Code:
mkdir /etc/dropbear
dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
dropbearkey -t ecdsa -f /etc/dropbear/dropbear_ecdsa_host_key
dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
To start dropbear every time the phone boots, I put my startup command in /system/etc/install-recovery.sh since it is called by init.rc. I would have put it straight in init.rc but init.rc is recreated from boot.img every boot and I didn't feel like getting into changing boot.img yet. Just make sure to make install-recovery.sh executable. The following line is what I use to start dropbear:
Code:
dropbear -A -N root -R /data/.ssh/authorized_keys -U 0 -G 0
Next you will need to copy your public key(s) into /data/.ssh/authorized_keys. You should now be able to ssh to your Clarity Ensemble phone. You can also use scp to copy files to and from the phone. If you use Putty pscp to transfer files, make sure to use the -scp option to force SCP protocol. If not, you will get the error "/usr/libexec/sftp-server: not found" since pscp tries to use sftp which is not installed on the phone.
So can you post a video or pics of what the device screen looks like now? can you actually use the device as a tablet?
Hey guys, I've just decided to get inside of the Android development world. Anyways, I'm mostly a fan of Linux, so I've made my first Linux script, I know it's simple, but I've never interacted with the user before, or picked an output. When I knew that Android made use of Linux in its core, my interest on working inside it grew up faster than ever.
In my script, firstly, you type the filename. For compatibility reasons, it'll everytime save to /sdcard/filename. Then, it will ask you how many times you want the script to log everything, and lately, every how many seconds should it save everything to the file.
The script will save, before every entry at the log, the screen status (if it's on or off), that can help to, for example, if your device has been lagging as a result of a bad screen driver or UI error.
Last thnig: it also works on recovery (maybe it give some error, and if no dumpsys is present on your recovery's ramdisk, it'll save everything as OFF).
Remember to send it anywhere excepting from /storage and any sbudir, it won't work as the Android permissions system blocks script execution on those dirs.
Code:
clear
# Wipe $logfile content in /sdcard (if any existing)
echo "Please type the filename where you want to save the log: "
read -r logfile
echo "" > /sdcard/$logfile
echo "Deleted previous log."
echo "SCREEN | CPU" >> /sdcard/$logfile
#cont=60
cont=1
#SHOWLOG=X
echo "Please type how many times the cycle must repeat: "
read -r maxcont
echo "Please type how many seconds will the interval take: "
read -r maxmin
clear
# Here it counts how many times the logging script has been ran
while [ $cont -lt $((maxcont + 1)) ];
do
# That nested while takes control of how many seconds have passed in the current cycle
while [ "$contmin" -lt "$maxmin" ];
do
contmin=$((contmin + 1))
sleep 1
clear
echo "C: $cont/$maxcont - T: $contmin/$maxmin"
done
# echo "$maxmin seconds passed."
# Logs the fist line of "busybox top" to a var
LOGVAR=$(busybox top -d 1 -n 1 | grep "idle")
# Logs the screen state (on or off) to another var
SCREENSTATE=$(dumpsys input_method | grep mScreenOn | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]')
# Saves a string that tells what it should expect if the screen is on
SCREENSTATEON="msystemreadytruemscreenontrue"
if [ "$SCREENSTATE" == "$SCREENSTATEON" ]
then
echo "ON: $LOGVAR" >> /sdcard/$logfile
else
echo "OFF: $LOGVAR" >> /sdcard/$logfile
fi
cont=$((cont + 1))
contmin=0
done
echo "Show logged values? [Y/N]"
read -r SHOWLOG
case $SHOWLOG in
[yY] | [yY][Ee][Ss] )
cat /sdcard/$logfile
;;
[nN] | [n|N][O|o] )
echo "Ok, goodbye. You'll see a what you've asked me to log in /sdcard/$logfile";
exit 1
;;
*) echo "You must write Y or N to continue."
;;
esac
exit 0
For example, save it as script.sh (remember to save it using Unix codifcation, if you're running Windows, else, it'll tell you that it's unable to find many binaries, as long as Linux isn't ok with CR+LF and requires LF as newline). Then, send it to the sdcard (over USB or adb push script.sh /sdcard/) , now, run ADB shell. Type the following commands:
Code:
su -c "cp -f /sdcard/script.sh /data/local/;chmod 777 /data/local/script.sh"
Then, if you want to run it:
Code:
su
sh /data/local/script.sh
That's all, I hope you enjoy it and not so many people kills me for explaining and feeling so grateful for that simple script.
Hello everyone!
I have had to set up quite a few of these sticks, so I wanted to start a little development tool to automate the process.
This is just a stupid bash script but it will make your TV usable without ads by installing Launcher Hijack 3 and configuring it for you and X43Stream. If anyone has requests I will work on this further. Leanback will not work, someone needs to mod it.
Source
PHP:
echo "Please ensure you are already connected and adb is installed correctly."
sleep 1
echo "Installing Launcher Hijack 3 (LH3).."
adb install "LauncherHijack3.apk"
echo "Installing TV Launcher.."
adb install "TVLauncher.apk"
echo "Installing XFinity Stream latest July 2017.."
adb install "X43Stream.apk"
echo "Opening LH3.."
adb shell am start -n com.baronkiko.launcherhijack/.MainActivity
sleep 3
echo "Selecting new launcher.."
adb shell input keyevent 23
sleep 1
adb shell input keyevent 23
sleep 1
adb shell am start -n com.awe.dev.pro.tv/.Launcher
echo "Enjoy, try out the home button!"
echo "It may not work every time, press again, work in progress :)"
or download it:
https://www.sendspace.com/file/epob8z
Thank you so much, I can't root my fire TV and I'm sick and tired of the Amazon launcher. I will be setting it up tomorrow. Will post back with results
Nvmd, finally got it.
This can be ran as a straight native Windows batch without having to install Bash support. Replace "sleep 1" with "timeout -t 1"
(or you can just paste ^^ into a properly connected ADB console with apks in the right places, will fail on "sleep 1" but it worked for me)
EDIT: Also works fine with Tvlauncher 2 rename the apk to tvlauncher like in the package and thanks OP! Home button seems to work fine for me!
installation help
Please help me install this fire tv setup tool i have a newer fire tv and dont know what to do with the download. i am not a pro but can follow directions and i hate the fire tv launcher.
Please help
Thank You
1. open a command prompt to the directory that contains ADB and put everything from the download in the same folder.
2. in the console window "adb connect xxx.xxx.xxx.xxx" where the x's are your IP of your FireTV\Stick (no quotes)
3. cut\paste the script from above into the console (cmd) window and run it...
4. it will error on "sleep 1" but continue and finish fine. If you want to correct the script for Windows batch scripting, replace "sleep 1" with "timeout -t 1" and save it as a .bat file.
I don't understand why this was only posted as a bash script (it is the best non-root hack there is). Windows doesn't support bash out of the box, and 99 percent of the people who download the script wont know what to do with it. BTW this works, and even works with other launchers. I use Tv launcher 2 which supports (its own special) widgets. No root. Never see the amazon launcher. Block updates, and do it asap.
EDIT: Fire Stick 2 fyi
So do we need to use the tvlauncher apk for the xfinity app to work?
What is the tv launcher? Same UI as the newer aftv ui (-ads?)
Only reason I don't just jump in and test it is Im not 100%sure how to undo it. Just uninstall the apks?
Thanks
UPDATE-I just went for it and it works....sort of.
It immediately launches the new UI but after setting it up, when I hit the home button it just returns to the normal AFTV launcher.
***This is actually preferable to me since all I really wanted was the Xfinity stream app to work. I tried just extracting the apk and installing it on my other Fire TV but it said incompatible.
First I would like to say thank you for a great tool to use on non rooted devices, I love it.
One thing i noticed is, that most people still won't know what to do with this tool so i will try and help explain better
-download adb and install it, if you haven't already
-download the file OP has at top of post
-extract the zip file
-copy and paste the code at top of OP into NOTEPAD
-change every spot that says "Sleep 1", erase that and copy and paste this there instead "timeout -t 1
-click file at the top left in notepad and click save as name it FireTV.bat
-goto your adb folder of install, usually C:\Program Files (x86)
-erase the "sh file" in the file you downloaded and extracted from the OP earlier
-put the new FireTV.bat you just made in that folder you just erased the "sh file" from
-now put all of those files into the adb folder you just opened and found,"launcher hijack apk, TVLauncher apk, x43Stream apk and your FireTV.bat files."
-hold on shift and right click with your mouse to open and command promnt here, if that doesn't show powershell works as well, it depends on your windows version.
-type "adb connect 192.168.1.8 or whatever you ip is for your FIreTV, this is found by going to settings, device, about and scroll down to network and it will list your IP
-if right it will say connected to device
-now simply left click hold and drag the FireTV.bat file you just created into the command promt and press enter
-that is it should work just fine.
I usually don't do this so I hope I helped a little bit.
Ok, just tried this, works pretty flawless. Sometimes you have to press home a couple times to get it to work(but that's no big deal). One thing i did notice though, if you have appstarter/firestarter (forget its name) it launches it instead, simple fix is to uninstall it then run the .bat again.
Does this work on firestick as well? Would hate to mess something up lol.
Edit.
For anyone wondering, no this does not work on firestick, it will install the apps but thats it.
TimmyP said:
This can be ran as a straight native Windows batch without having to install Bash support. Replace "sleep 1" with "timeout -t 1"
(or you can just paste ^^ into a properly connected ADB console with apks in the right places, will fail on "sleep 1" but it worked for me)
EDIT: Also works fine with Tvlauncher 2 rename the apk to tvlauncher like in the package and thanks OP! Home button seems to work fine for me!
Click to expand...
Click to collapse
Do you have a safe download link for the Tvlauncher 2 apk? Also so all I do is change Tvlauncher in the script to Tvlauncher2 and replace the apk in the download file?
Would it be possible to add a app killer similar to firestarter when you press the menu key, even if just to launch system default app manager? If it had that i think it'd be perfect.
Can anyone add screenshots or video of what this looks like when completed?
enigma7820 said:
First I would like to say thank you for a great tool to use on non rooted devices, I love it.
One thing i noticed is, that most people still won't know what to do with this tool so i will try and help explain better
-download adb and install it, if you haven't already
-download the file OP has at top of post
-extract the zip file
-copy and paste the code at top of OP into NOTEPAD
-change every spot that says "Sleep 1", erase that and copy and paste this there instead "timeout -t 1
-click file at the top left in notepad and click save as name it FireTV.bat
-goto your adb folder of install, usually C:\Program Files (x86)
-erase the "sh file" in the file you downloaded and extracted from the OP earlier
-put the new FireTV.bat you just made in that folder you just erased the "sh file" from
-now put all of those files into the adb folder you just opened and found,"launcher hijack apk, TVLauncher apk, x43Stream apk and your FireTV.bat files."
-hold on shift and right click with your mouse to open and command promnt here, if that doesn't show powershell works as well, it depends on your windows version.
-type "adb connect 192.168.1.8 or whatever you ip is for your FIreTV, this is found by going to settings, device, about and scroll down to network and it will list your IP
-if right it will say connected to device
-now simply left click hold and drag the FireTV.bat file you just created into the command promt and press enter
-that is it should work just fine.
I usually don't do this so I hope I helped a little bit.
Click to expand...
Click to collapse
Very helpful but I had to correct a few lines:
-There was a "Sleep 3" I had to change to "timeout -t 3"
-In powershell I had to type ".\adb connect 192.168.xx.xxx" to get it to work.
-The left click hold and drag the FireTV.bat file didn't do anything so I just typed "FireTV.bat" on the command prompt and it ran.
Thanks for your help.
nyln said:
Hello everyone!
I have had to set up quite a few of these sticks, so I wanted to start a little development tool to automate the process.
This is just a stupid bash script but it will make your TV usable without ads by installing Launcher Hijack 3 and configuring it for you and X43Stream. If anyone has requests I will work on this further. Leanback will not work, someone needs to mod it.
Source
PHP:
echo "Please ensure you are already connected and adb is installed correctly."
sleep 1
echo "Installing Launcher Hijack 3 (LH3).."
adb install "LauncherHijack3.apk"
echo "Installing TV Launcher.."
adb install "TVLauncher.apk"
echo "Installing XFinity Stream latest July 2017.."
adb install "X43Stream.apk"
echo "Opening LH3.."
adb shell am start -n com.baronkiko.launcherhijack/.MainActivity
sleep 3
echo "Selecting new launcher.."
adb shell input keyevent 23
sleep 1
adb shell input keyevent 23
sleep 1
adb shell am start -n com.awe.dev.pro.tv/.Launcher
echo "Enjoy, try out the home button!"
echo "It may not work every time, press again, work in progress :)"
or download it:
https://www.sendspace.com/file/epob8z
Click to expand...
Click to collapse
The sendspace link is very slow,
Here is a direct download link: https://ipfs.works/ipfs/QmXnYYH5iSnsa4DQdQED8RapgM4pA7v6EV3bzfGdoR9sMp/Amazon_Fire_TV_Setup_Tool.zip
md5sum: 8847a2b99afee549e2f5f973d86bfa51
Thread cleaned. XDA-Developers is a site for all, including those whose main languages and experience levels may vary.
If you're unwilling or unable to treat people with the civility we all deserve, kindly consider a break away from the keyboard.
Thank you all for your cooperation.
Sorry Somehow my post posted twice! not sure how to delete it so i'm editing this one
nyln said:
Hello everyone!
I have had to set up quite a few of these sticks, so I wanted to start a little development tool to automate the process.
This is just a stupid bash script but it will make your TV usable without ads by installing Launcher Hijack 3 and configuring it for you and X43Stream. If anyone has requests I will work on this further. Leanback will not work, someone needs to mod it.
Source
PHP:
echo "Please ensure you are already connected and adb is installed correctly."
sleep 1
echo "Installing Launcher Hijack 3 (LH3).."
adb install "LauncherHijack3.apk"
echo "Installing TV Launcher.."
adb install "TVLauncher.apk"
echo "Installing XFinity Stream latest July 2017.."
adb install "X43Stream.apk"
echo "Opening LH3.."
adb shell am start -n com.baronkiko.launcherhijack/.MainActivity
sleep 3
echo "Selecting new launcher.."
adb shell input keyevent 23
sleep 1
adb shell input keyevent 23
sleep 1
adb shell am start -n com.awe.dev.pro.tv/.Launcher
echo "Enjoy, try out the home button!"
echo "It may not work every time, press again, work in progress :)"
or download it:
https://www.sendspace.com/file/epob8z
Click to expand...
Click to collapse
I'm assuming this is using adb tcpip? I have a very Epic setup of bash scripts for setting up Fire Devices. I made it for my brother.
Anyways here is the chunk of code will grab your current connected networks and provide a list to choose from. Example if you have to it would show: 192.168.0.1 & 10.0.0.1 . When you choose one it will scan your network for Fire Devices with port 5555 open and present you with a list of found devices. You can choose to connect to a specific one or connect to them all.
There is a lot of extra code in this that needs to be removed. Right now i dont have the time to clean it up so hopefully you can! Also this chunk of code requires nmap to be installed. FYI This runs on Kali Linux but should work on other distro's but you may have to account for sudo usage.
Code:
function NetworkScan() {
function GetNetworks() {
echo -e "\n\n"
cd $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g") &>/dev/null
TotalConnectedDevices="$(adb devices 2>/dev/null | grep -v "List" | grep -v "^$" | grep -iv "daemon" | sort | uniq | wc -l)"
ConnectedDevices="$(adb devices 2>/dev/null | grep -v "List" | grep -v "^$" | grep -iv "daemon" | grep -iv "offline" | sort | uniq | wc -l)"
ConnectedOffline="$(adb devices 2>/dev/null | grep -v "List" | grep -v "^$" | grep -iv "daemon" | grep -i "offline" | sort | uniq | wc -l)"
prompt="$(echo -e "\e[96m][NT3L][G3NC][ NetworkPicker Menu:\e[0m")"
IP=$(for file in $(ifconfig | egrep -o "wlan.:|eth.:" | cut -d" " -f1 | sed -e "s/://g"); do ip addr show $file | grep -w inet | cut -d"/" -f1 |sed -e 's/\<inet\>//g' -e 's/^[ \t]*//' | grep "[1-9][0-9]" | cut -d'.' -f1,2,3; done | sort | uniq)
options=( $(for file in $(echo "$IP"); do echo "$file.1/24"; done | sort | uniq | xargs -0) )
echo -e " $prompt $TotalConnectedDevices "
echo -e " [\e[96m$ConnectedOffline\e[0m]----------------------------------[\e[96m$ConnectedDevices\e[0m]"
echo -e " $RemoteKodi "
echo -e ""
select opt in "${options[@]}" "All" ; do
if [[ $REPLY = 'QUIT' || $REPLY = 'quit' ]] ; then
exit 1
elif (( REPLY == 1 + ${#options[@]} )) ; then
clear
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
clear
NetworkScan "$opt"
else
echo -e "Invalid option. Try another one."
sleep 2 &>/dev/null
clear
StartMenu
fi
done
}
Args=( $(for file in $(echo "[email protected]"); do echo "$file" ; done | xargs -0) )
ArgsCount=${#Args[@]}
if [ "$ArgsCount" = '0' ]
then
GetNetworks
else
echo "${Args[@]}" | grep "\.1/24" &>/dev/null
if [ "$?" = '0' ]
then
options=( $(for file in $(echo ${Args[@]}); do nmap -p 5555 $file -oG - | grep "open" | cut -d" " -f2 ; done | xargs -0) )
else
options=( $(for file in $(echo ${Args[@]}); do echo $file ; done | xargs -0) )
fi
echo -e "\n\n"
cd $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g") &>/dev/null
TotalConnectedDevices="$(adb devices 2>/dev/null | grep -v "List" | grep -v "^$" | grep -iv "daemon" | sort | uniq | wc -l)"
ConnectedDevices="$(adb devices 2>/dev/null | grep -v "List" | grep -v "^$" | grep -iv "daemon" | grep -iv "offline" | sort | uniq | wc -l)"
ConnectedOffline="$(adb devices 2>/dev/null | grep -v "List" | grep -v "^$" | grep -iv "daemon" | grep -i "offline" | sort | uniq | wc -l)"
prompt="$(echo -e "\e[96m][NT3L][G3NC][ NetworkScan Menu:\e[0m")"
echo -e " $prompt $TotalConnectedDevices "
echo -e " [\e[96m$ConnectedOffline\e[0m]----------------------------------[\e[96m$ConnectedDevices\e[0m]"
echo -e " $RemoteKodi "
echo -e ""
select opt in "${options[@]}" "All" "Pick Network" ; do
if [[ $REPLY = 'QUIT' || $REPLY = 'quit' ]] ; then
exit 1
elif [[ $REPLY = 'KILL' || $REPLY = 'kill' ]] ; then
clear
killall adb gnome-terminal xterm terminator &>/dev/null
exit 1
elif [[ $REPLY = 'LIST' || $REPLY = 'list' ]] ; then
clear
$(declare -f ListDevicesConnected)
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'REFRESH' || $REPLY = 'refresh' || $REPLY = 'RELOAD' || $REPLY = 'reload' ]] ; then
clear
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'FireStarter' || $REPLY = 'fIREsTARTER' ]] ; then
clear
xterm -e $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g")/Scriptz/FireStarterUP.sh &
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'APK' || $REPLY = 'apk' ]] ; then
clear
for apk in $(find $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g")/AApushApk/SendAPK -type f -iname "*.apk"); do adb install "$apk" ; done
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'REBOOT' || $REPLY = 'reboot' ]] ; then
clear
$(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g")/Scriptz/RebootDevices.sh
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'stop' || $REPLY = 'STOP' ]] ; then
clear
adb kill-server
adb start-server
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'HELP' || $REPLY = 'help' ]] ; then
clear
echo -e "$(HelpMe)"
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'USBCHECK' || $REPLY = 'usbcheck' || $REPLY = 'usb' || $REPLY = 'USB' ]] ; then
terminator -e dmesg -wH &
clear
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'html' || $REPLY = 'HTML' ]] ; then
clear
xterm -e $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g")/Scriptz/GenerateHTML.sh
iceweasel $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g")/ScreenShots/index.html &
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'BACK' || $REPLY = 'back' || $REPLY = 'Menu' || $REPLY = 'menu' || $REPLY = 'MENU' ]] ; then
clear
StartMenu
elif [[ $REPLY = 'UpdateKodi' || $REPLY = 'uPDATEkODI' ]] ; then
clear
KodiAPKMenu
elif (( REPLY == 1 + ${#options[@]} )) ; then
clear
for file in $(echo ${options[@]}); do adb connect "$file" ; done
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif (( REPLY == 2 + ${#options[@]} )) ; then
clear
GetNetworks
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
clear
adb connect "$opt"
clear
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
else
echo -e "Invalid option. Try another one."
sleep 2 &>/dev/null
clear
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
fi
done
fi
}
The chunk of code above is setup to be a Menu in the terminal. NetworkScan is just one of the Menu options. If you make a base Menu setup with options: "Network Scan" , "Install APKs", "Change Launcher" etc. you could have "Change Launcher" launch a script that would have something like this in it.
Code:
for DroidID in $(adb devices 2>/dev/null | grep -v "List" | grep -v "daemon" | grep -v "^$" | cut -f1)
do
xterm -e $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2)/Scriptz/Clean.sh "$DroidID" &
done
The above script gets all connected devices and then loops through their serial starting another script while passing the serial as a parameter. You would need to make sure the script that gets ran applies the parameter as the serial. Example below is used to remove all 3rd party apps installed, data and then uninstall it
Code:
#!/bin/bash
SerialNum="$1"
IsDeviceOffline="$(adb -s "$1" devices | grep "$1" | cut -f2)"
function AutoClean() {
echo -e ""
echo -e "Clearing App Data And Removing APKs"
for file in $(adb -s "$1" shell pm list packages -3 | cut -d':' -f2)
do
adb -s "$1" shell pm clear "$(echo "$file" | tr -d '\r')"
adb -s "$1" uninstall "$(echo "$file" | tr -d '\r' )"
done
echo -e ""
read -p "Finished Auto Cleaning"
}
echo -e "$IsDeviceOffline" | grep -i "offline" &>/dev/null
if [ "$?" != '0' ]
then
AutoClean "$SerialNum"
else
echo -e "Device:"$SerialNum" Is Offline!"
read -p "Exiting Script"
fi
nyln said:
Hello everyone!
I have had to set up quite a few of these sticks, so I wanted to start a little development tool to automate the process.
This is just a stupid bash script but it will make your TV usable without ads by installing Launcher Hijack 3 and configuring it for you and X43Stream. If anyone has requests I will work on this further. Leanback will not work, someone needs to mod it.
Source
PHP:
echo "Please ensure you are already connected and adb is installed correctly."
sleep 1
echo "Installing Launcher Hijack 3 (LH3).."
adb install "LauncherHijack3.apk"
echo "Installing TV Launcher.."
adb install "TVLauncher.apk"
echo "Installing XFinity Stream latest July 2017.."
adb install "X43Stream.apk"
echo "Opening LH3.."
adb shell am start -n com.baronkiko.launcherhijack/.MainActivity
sleep 3
echo "Selecting new launcher.."
adb shell input keyevent 23
sleep 1
adb shell input keyevent 23
sleep 1
adb shell am start -n com.awe.dev.pro.tv/.Launcher
echo "Enjoy, try out the home button!"
echo "It may not work every time, press again, work in progress :)"
Thanks for this. I use a slightly edited version of this on all of my firesticks now.
Click to expand...
Click to collapse
Anyone knows if is there a new update for the xfinity app for the firetv?
zeroth said:
Anyone knows if is there a new update for the xfinity app for the firetv?
Click to expand...
Click to collapse
Bump