loop script command - Galaxy Note 3 Developer Discussion [Developers Onl

hi guys,im running a script on my n9005 aosp kitkat and after 30-60 minutes seems that turn itself down or hanging..can anyone help me with some loop-repeat command to made this script non stop?
the script:
#!/system/bin/sh
echo mmc2 > /sys/class/leds/led:rgb_green/trigger;
echo mmc1 > /sys/class/leds/led:rgb_red/trigger;
echo mmc0 > /sys/class/leds/led:rgb_blue/trigger;

Related

compcache swappiness

I am running sparks mod 1.6.4 compcache 32% hack.
I want to change the swappiness to 60.
How would I go about doing this?
Don't do it, it's much too high. I would suggest something around 10-20, i.e. type in terminal:
su
echo 10 > /proc/sys/vm/swappiness
Sent from my Gingerbread on Sapphire using XDA App
Why so low? Just seeking some wisdom.
Thanks.\
Also is this a permanent change or do i have to do this every boot?
This is not a permanent change, you have to apply this every time you reboot your phone. If you want it permanent, you should include it into the /system/bin/compcache script.
Swappiness defines, when data will be put into the swapfile. 100 means, all inactive data can be put into the swap, 0 means, that cached data will be removed first before using the swap. Disadvantage when too much data is within swap: the system speed goes down ... so you have to find a good compromize.
AndDiSa said:
This is not a permanent change, you have to apply this every time you reboot your phone. If you want it permanent, you should include it into the /system/bin/compcache script.
Swappiness defines, when data will be put into the swapfile. 100 means, all inactive data can be put into the swap, 0 means, that cached data will be removed first before using the swap. Disadvantage when too much data is within swap: the system speed goes down ... so you have to find a good compromize.
Click to expand...
Click to collapse
ok so i edited the file and pushed it.
now compcache is not starting and when i type it in the terminal it says permission denied.
Any help?
should i try inputting the command you first gave me into compcache?
After the modification, the compcache file should look something like
...
start)
echo 3 > /proc/sys/vm/drop_caches
modprobe $MODULE
rzscontrol $DEV --disksize_kb=32576 --init
swapon $DEV
echo 10 > /proc/sys/vm/swappiness
;;
...
this is what i have
#!/system/bin/sh
#
# Compcache manager
# [email protected] (cyanogen)
#
DEV=/dev/block/ramzswap0
MODULE=ramzswap
MODULES_DIR=/system/modules/lib/modules/`uname -r`
case "$1" in
start)
echo 3 > /proc/sys/vm/drop_caches
echo 30 > /proc/sys/vm/swappiness
modprobe $MODULE
rzscontrol $DEV --disksize_kb=$2 --init
swapon $DEV
;;
stop)
swapoff $DEV >/dev/null 2>&1
rmmod $MODULE >/dev/null 2>&1
;;
stats)
rzscontrol $DEV --stats
;;
*)
echo "Usage: $0 {start <size>|stop|stats}"
exit 1
esac
exit 0
I cant seem to get it to work.
this is the original too.
it just keeps saying permission denied
You are running the script as root, i.e
> su
# /system/bin/compcache start
to start the script manually?
Before modifing the script, you have to remount /system to set it read-write, otherwise it's read only!
try to fix the permission

What replaces stagefright?

I found a script that adds boot audio. In it there is a line calling stagefright, stagefright either doesn't exist on my ROM and I have no clue as to add it. Here is the script in question which I don't know the original author however lithid from http://forum.cyanogenmod.org did some work on it and was close to creating a updater-script. Please Help Me as I know some scripting but not a lot
PS I was advised to ask this question to the devs by a cyanogenmod.org mod named bassmadrigal
Code:
#!/system/bin/sh
#I just made this into a script this was from a post on XDA by spiicytuna
#http://forum.xda-developers.com/showpost.php?p=8274824&postcount=2
#Please give the credit to him not me.
echo "preparing system..."
#Setting up the system for read/write access
mount -o remount,rw /system
#linking busybox mkdir (broken in rc2)
rm /system/bin/mkdir
ln -s /system/xbin/mkdir /system/bin/mkdir
mkdir -p /data/local/boot
echo "checking for previous bootsound installation..."
if [ -e /system/bin/bootsound ];
then
echo "bootsound already enabled, exiting.."
mount -o remount,ro /system
exit
fi
if [ "`ls /sbin|grep -q recovery;echo $?`" = "0" ];
then
mount -a > /dev/null
recoverymode=y
else
mount -o rw,remount /system
recoverymode=n
fi
echo "preparing startup scripts..."
#This is to create the needed scripts in init.local.rc
echo '' >> /system/etc/init.local.rc
echo '' >> /system/etc/init.local.rc
echo '###Bootsound - Safe to Delete: Start ###' >> /system/etc/init.local.rc
echo "" >> /system/etc/init.local.rc
echo 'service bootsound /system/bin/bootsound' >> /system/etc/init.local.rc
echo ' user media' >> /system/etc/init.local.rc
echo ' group audio' >> /system/etc/init.local.rc
echo ' disabled' >> /system/etc/init.local.rc
echo ' oneshot' >> /system/etc/init.local.rc
echo '' >> /system/etc/init.local.rc
echo 'on property:init.svc.bootanim=running # to correct timin' >> /system/etc/init.local.rc
echo ' start bootsound' >> /system/etc/init.local.rc
echo '' >> /system/etc/init.local.rc
echo 'on property:dev.bootcomplete=1' >> /system/etc/init.local.rc
echo ' stop bootsound' >> /system/etc/init.local.rc
echo '### Bootsound - Safe to Delete: End ###' >> /system/etc/init.local.rc
echo "creating script for bootsound in /system/bin..."
echo '#Now creating the bootsound script'
touch /system/bin/bootsound
echo '#!/system/bin/sh' >> /system/bin/bootsound
echo '' >> /system/bin/bootsound
echo 'bprop=/system/build.prop' >> /system/bin/bootsound
echo '' >> /system/bin/bootsound
echo 'play=$(cat $bprop | egrep -c -i -o ro.config.play.bootsound=1)' >> /system/bin/bootsound
echo 'if [ "$play" = "1" ]; then' >> /system/bin/bootsound
echo ' stagefright -a -o /system/media/android_audio.mp3' >> /system/bin/bootsound #this is the line that breaks the code
echo 'fi' >> /system/bin/bootsound
echo 'exit 0' >> /system/bin/bootsound
#Changing some permissions
chmod 777 /system/bin/bootsound
chown root:shell /system/bin/bootsound
echo '' >> /system/build.pro
echo 'ro.config.play.bootsound=1' >> /system/build.prop
echo 'media.stagefright.enable-player=true' >> /system/build.prop
echo 'media.stagefright.enable-meta=true' >> /system/build.prop
echo 'media.stagefright.enable-scan=true' >> /system/build.prop
echo 'media.stagefright.enable-http=true' >> /system/build.prop
#removed self-destruct, script checks for previous install
sleep 1
mount -o ro,remount /system
echo "done."
exit
ethan_hines said:
I found a script that adds boot audio. In it there is a line calling stagefright, stagefright either doesn't exist on my ROM and I have no clue as to add it. Here is the script in question which I don't know the original author however lithid from http://forum.cyanogenmod.org did some work on it and was close to creating a updater-script. Please Help Me as I know some scripting but not a lot
PS I was advised to ask this question to the devs by a cyanogenmod.org mod named bassmadrigal
Click to expand...
Click to collapse
Not sure if this works , but I will eventually try it , but not now , on my free time.
stagefright indeed is not included , my phone too doesn't have stagefright , if you go to youtube and search for android developement tutorials by "thenewboston" . you'll find 200 videos series , just watch the first 20 ones and you'll learn to use Media which replaces stagefright...I didn't try it yet.
It includes
Our_Player and Media Player and the directory of the song....check it out and give us heads ups!
thethiny said:
Not sure if this works , but I will eventually try it , but not now , on my free time.
stagefright indeed is not included , my phone too doesn't have stagefright , if you go to youtube and search for android developement tutorials by "thenewboston" . you'll find 200 videos series , just watch the first 20 ones and you'll learn to use Media which replaces stagefright...I didn't try it yet.
It includes
Our_Player and Media Player and the directory of the song....check it out and give us heads ups!
Click to expand...
Click to collapse
I appreciate the info, I took a look at his tutorials esp the ones involving animation, he really knows his stuff. I am not a Java programmer by any means and to be honest I find it quite tedious, it's like trying to teach a baby (this case the Dalvik VM) to do basic stuff like draw a green ball took like 20 lines of code!
What I need to know essentially is, do I have to use JAVA to get this to work now? In the past ie ICS and lower, there wasn't a problem with Custom Boot Audio, now with JB it seems it has disappeared from the radar.
I know the binary /system/bin/bootanimation (is this written in JAVA?, is there a source code for this bin?) is called at boot time by init.rc in the following manner:
Code:
service bootanim /system/bin/bootanimation
class main
user graphics
group graphics
disabled
oneshot
/system/bin/bootanimation (at least from what I gather) looks in /system/media for bootanimation.zip (zipped in store mode) decompresses it , looks at desc.txt for the code and displays the animation png by png.
In some desc.txt there is an s line, example:
Code:
# mobility
p 1 0 SOUND
s transdroid.mp3
which is SUPPOSED TO call a custom boot audio from /system/media (.mp3?) at the same time. This appears not to work. So logicaly I think the binary needs some tweaking. Can you offer any suggestions?
As you can see I have spent ALLOT of time mulling over why this,one would think, simple task: display a series of images and play audio at boot time I mean how hard can that be?
I am not trying to be a pest I just need to know WHY this doesn't work in JB (CM10.1)

[script] clean up SWAP partition bash script

Hello there,
this is a simple script how to clean up the swap partition without restart or typing commands in the terminal.
Tested on:
- CM9 (Milestone A853)
Requirements:
- rooted device
- swap partition (/dev/block/mmcblk0p3)
- GScript Application (thanks to rogro82) http://forum.xda-developers.com/showthread.php?t=486486
Make sure GScript has root access and the script in the application has su rights.
Here comes the script:
Code:
if [ -e "/sdcard/swapre/" ];then
echo "folder exists, we are good to go"
else
mkdir /sdcard/swapre/
touch /sdcard/swapre/log.txt
fi
swapoff /dev/block/mmcblk0p3
echo "swap is off, please wait"
echo "swap is off" > /sdcard/swapre/log.txt
swapon /dev/block/mmcblk0p3
echo "swap is on, hold a second to finish"
echo "swap is on" >> /sdcard/swapre/log.txt
echo "swap was restarted at:" >> /sdcard/swapre/log.txt
date -u >> /sdcard/swapre/log.txt
7z version -> https://dl.dropbox.com/u/2969199/swp.7z
the script will crate a folder on the sd card, with a log file within. Just in case you want to see what happened
I recommend to create a shortcut on the desktop, after you installed GScript and the script, for easier access.
You should be fine with your device and it should work
well, have fun.

How to run a script?

How can I run a script with the code that I will give on kitkat , because my touchscreen get unresponsive and this script should fix it?
#!/system/bin/sh
echo 20 > /sys/devices/i2c-3/3-0024/main_ttsp_core.cyttsp4_i2c_adapter/finger_threshold
chmod 666 /sys/devices/i2c-3/3-0024/main_ttsp_core.cyttsp4_i2c_adapter/signal_disparity
echo 0 > /sys/devices/i2c-3/3-0024/main_ttsp_core.cyttsp4_i2c_adapter/signal_disparity

Need help with enabling Diag port on Z3+ (E6553) with zROM v1.1

Hi all,
I have unlocked bootloader and flashed zROM v1.1 so I got root. I want to enable Diag port to connect phone to the QXDM. Here is what i know.
Most important files are /init.usbmode.sh and /init.usbmode.platform.sh:
/init.usbmode.sh:
-disables USB and writes VendorID
Code:
echo 0 > /sys/class/android_usb/android0/enable
echo ${VENDOR_ID} > /sys/class/android_usb/android0/idVendor
-it setups engineering port with /init.usbmode.platform.sh if "getprop perist.usb.eng" is set to 1
-writes PID and USB FUNCTION
Code:
echo ${PID} > /sys/class/android_usb/android0/idProduct
echo ${USB_FUNCTION} > /sys/class/android_usb/android0/functions
-enables USB
Code:
echo 1 > /sys/class/android_usb/android0/enable
/init.usbmode.platform.sh:
Code:
setup_engmode()
{
PID_PREFIX=0
SUPPORT_RMNET=1
case ${1} in
"mass_storage,adb") PID_PREFIX=6 ;;
"mtp,adb") PID_PREFIX=5 ;;
"rndis,adb")
PID_PREFIX=D
SUPPORT_RMNET=0
;;
*)
/system/bin/log -t ${TAG} -p i "No eng PID for: ${1}"
exit 1
;;
esac
PID=${PID_PREFIX}146
USB_FUNCTION=${1},serial,diag
echo diag > /sys/class/android_usb/android0/f_diag/clients
echo smd,tty > /sys/class/android_usb/android0/f_serial/transports
if [ ${SUPPORT_RMNET} -eq 1 ] ; then
USB_FUNCTION=${USB_FUNCTION},rmnet
echo qti,bam2bam_ipa > /sys/class/android_usb/android0/f_rmnet/transports
fi
echo "${PID} ${USB_FUNCTION}"
exit 0
}
set_rndis_qc()
{
(...)
}
case ${1} in
"eng_setup")
if [ $# -ne 2 ] ; then
exit 1
fi
setup_engmode ${2}
;;
"set_rndis_qc")
set_rndis_qc
exit 0
;;
esac
-returns PID and USB_FUNCTION to /init.usbmode.sh, By default phone has USB_FUNCTION set to "mtp,adb" so there should be PID=5146 and USB_FUNCTION=mtp,adb,serial,diag,rmnet
-echoes
Code:
echo diag > /sys/class/android_usb/android0/f_diag/clients
echo qti,bam2bam_ipa > /sys/class/android_usb/android0/f_rmnet/transports
The main issue is that "getprop perist.usb.eng" doesn't exist.
As you know this Android runs on SE Linux. In /property_contexts file we can find following lines:
Code:
#line 1 "vendor/semc/system/sepolicy/Bootstrap_Applications/1.0.0/usbeng/property_contexts"
persist.usb.eng u:object_r:usb_eng_prop:s0
sys.usb.diag_mode u:object_r:usb_diag_mode_prop:s0
persist.sys.usb.config u:object_r:usb_config_prop:s0
persist.service.adb.enable u:object_r:usb_adb_enable_prop:s0
Only "persist.sys.usb.config " is visible in getprop command. This custom ROM has script located in /system/su.d/permissive.sh which enables permissive mode on SE Linux:
Code:
#!/system/bin/sh
/system/bin/setenforce 0
So in theory restrictions to the file types and process domains should not operate. Correct me if I am wrong.
Also there is a file /system/bin/usbeng which should be stared as a service by /init.sony.usb.rc
Code:
#Start usbeng
service usbeng /system/bin/usbeng
user system
group system
class late_start
oneshot
But it can't be seen in services list or process list. Also "getprop init.svc.usbeng" says it is "stopped". We can find SE Linux properties of this file in /file_contexts:
Code:
#line 1 "vendor/semc/system/sepolicy/Bootstrap_Applications/1.0.0/usbeng/file_contexts"
/system/bin/usbeng u:object_r:usbeng_exec:s0
I have tried echoing mentioned lines with a script:
Code:
echo 0 > /sys/class/android_usb/android0/enable
echo diag > /sys/class/android_usb/android0/f_diag/clients
echo qti,bam2bam_ipa > /sys/class/android_usb/android0/f_rmnet/transports
echo 5146 > /sys/class/android_usb/android0/idProduct
echo mtp,adb,serial,diag,rmnet > /sys/class/android_usb/android0/functions
echo 1 > /sys/class/android_usb/android0/enable
But last line seems to fail and USB doesn't get enabled and reboot is needed.
Seems that SE Linux is one of main reasons that Diag port can't be enabled. In effect there is lack of "persist.usb.eng" "sys.usb.diag_mode" in "getprop" command and "usbeng" service. Here comes question to you guys. Do you have idea how to enable mentioned properties and service? I will very appreciate any help or information that will help me enabling Diag port.
Best regards,
Piotr
solution?
did you find the solution, i need the same?
same here, i'm xperia z3 user

Categories

Resources