Init.d Scripts - Hero CDMA Q&A, Help & Troubleshooting

I've been talking with a few people and I've received different info for each. What is wrong with this script? I want to set the new build.prop values via init.d scripts but some think that the way I did it is wrong/i need to correct things. Thanks in advance
Edit: looked up setprop and these are my questions
kifno said:
Looked on google and xda and found nothing about mounting before applying setprop ro.* values using the script I looked at about 8 scripts and they just place setprop ro.* or whatever line they wanted a value applied to. So I still can't figure out why you and say it won't work because the line is read only or already found in the build.prop because again I saw and read plenty of scripts with setprop ro.* and other lines with different values set with setprop that were already in their rom's init.rc or build.prop....so why wouldn't it work?
Click to expand...
Click to collapse
Code:
#!/system/bin/sh
#!/xbin/sh
#
#kifno tweaks
# Network Speed
setprop net.tcp.buffersize.default 4096,87380,256960,4096,16384,256960;
setprop net.tcp.buffersize.wifi 4095,87380,256960,4096,16384,256960;
setprop net.tcp.buffersize.umts 4094,87380,256960,4096,16384,256960;
setprop net.tcp.buffersize.edge 4093,262140,770880,4096,30643,770880;
setprop net.tcp.buffersize.gprs 4094,87380,256960,4096,16384,256960;
setprop net.tcp.buffersize.wimax 4094,87380,256960,4096,16384,256960;
setprop ro.ril.hsxpa 2;
setprop ro.ril.gprsclass 8;
setprop ro.ril.hep 1;
setprop ro.ril.enable.dtm 1;
setprop ro.ril.hsdpa.category 24;
setprop ro.ril.enable.a53 1;
setprop ro.ril.enable.3g.prefix 1;
setprop ro.ril.htcmaskw1.bitmask 4294967295;
setprop ro.ril.htcmaskw1 14449;
setprop ro.ril.hsupa.category 3;
setprop wifi.supplicant_scan_interval 200;
echo 256960 > proc/sys/net/core/wmem_max;
echo 256960 > proc/sys/net/core/rmem_max;
echo 256960 > proc/sys/net/core/wmem_default;
echo 256960 > proc/sys/net/core/rmem_default;
echo 4096 16384 256960 > /proc/sys/net/ipv4/tcp_wmem;
echo 4096 87380 256960 > /proc/sys/net/ipv4/tcp_rmem;
echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout;
echo 30 > /proc/sys/net/ipv4/tcp_keepalive_intvl;
echo 5 > /proc/sys/net/ipv4/tcp_keepalive_probes;
echo 0 > /proc/sys/net/ipv4/tcp_timestamps;
echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse;
# Memory Threshold (Process Killing)
setprop ro.FOREGROUND_APP_MEM 1536;
setprop ro.VISIBLE_APP_MEM 3072;
setprop ro.SECONDARY_SERVER_MEM 4096;
setprop ro.BACKUP_APP_MEM 4096;
setprop ro.HOME_APP_MEM 4096;
setprop ro.HIDDEN_APP_MEM 21000;
setprop ro.CONTENT_PROVIDER_MEM 23000;
setprop ro.EMPTY_APP_MEM 25000;
# VM parameters
echo 0 > /proc/sys/vm/swappiness;
echo 0 > /proc/sys/vm/dirty_expire_centisecs;
echo 0 > /proc/sys/vm/dirty_writeback_centisecs;
echo 60 > /proc/sys/vm/dirty_background_ratio;
echo 95 > /proc/sys/vm/dirty_ratio;
echo 10 > /proc/sys/vm/vfs_cache_pressure;
echo 1652 > /proc/sys/vm/min_free_kbytes;
#Boot
MMC=`ls -d /sys/block/mmc*`;
# Optimize NRS
for i in $MMC;
do
echo 0 > $i/queue/rotational;
done;
# Optimize I/O Scheduler
for i in $MMC;
do
echo $IO_SCHEDULER > $i/queue/scheduler;
case $IO_SCHEDULER in
"noop")
echo 1 > $i/queue/iosched/fifo_batch;;
"cfq")
echo 1 > $i/queue/iosched/back_seek_penalty;
echo 0 > $i/queue/iosched/slice_idle;;
"bfq")
echo 1 > $i/queue/iosched/back_seek_penalty;
echo 0 > $i/queue/iosched/slice_idle;;
esac;
done;
# Set "No-op" scheduler for mtdblocks and mmc
for i in `ls -1 /sys/block/mtdblock*` /sys/block/mmcblk0
do
echo "noop" > $i/queue/scheduler
done
# Less Lag When Making Phone Calls
setprop ro.telephony.call_ring.delay 1000;
setprop ro.mot.eri.losalert.delay 1000;
MAX_PHONE()
{
pidphone=`pidof com.android.phone`;
if [ $pidphone ]; # Wait for com.android.phone to start;
then
echo -17 > /proc/$pidphone/oom_adj;
renice -20 $pidphone;
(while [ 1 ];
do
sleep 10;
MAX_PHONE;
done &);
# DF MODs
setprop ro.media.dec.vid.wmv.enabled 1;
setprop ro.media.dec.aud.wma.enabled 1;
setprop ro.media.dec.aud.flac.enabled 1;
setprop ro.media.dec.aud.ape.enabled 0;
setprop ro.media.dec.vid.avi.enabled 1;
setprop ro.media.dec.vid.flv.enabled 0;
setprop ro.media.dec.vid.qt.enabled 0;
setprop ro.media.dec.vid.rm.enabled 0;
setprop video.accelerate.hw 1;
setprop debug.performance.tuning 1;
# miscellaneous
setprop dalvik.vm.startheapsize 8m;
setprop windowsmgr.max_events_per_sec 60;
setprop ro.product.multi_touch_enabled true;
setprop ro.product.max_num_touch 2;
setprop keyguard.no_require_sim true;
setprop debug.sf.hw=1;
setprop ro.opengles.version=131072;
setprop ro.default_usb_mode 2;
setprop ro.qualcomm.proprietary_obex false;
setprop ro.display.width 320;
setprop ro.display.height 960;

As I already mentioned to you several times, you can't overwrite a value that starts with "ro." once it has already been set, no matter the method. And as I've already mentioned to you, half of the properties you're trying to set don't actually do anything. You should really try finding documentation of these properties (or their location in the source code if you can't find that) if you're going to be changing them.
Please don't PM me anymore if you're not even going to listen to my responses. I appreciate that you're trying to do something productive, but you need to spend more time researching and less time "jumping the gun" to make changes.

jasonmaloney said:
As I already mentioned to you several times, you can't overwrite a value that starts with "ro." once it has already been set, no matter the method. And as I've already mentioned to you, half of the properties you're trying to set don't actually do anything. You should really try finding documentation of these properties (or their location in the source code if you can't find that) if you're going to be changing them.
Please don't PM me anymore if you're not even going to listen to my responses. I appreciate that you're trying to do something productive, but you need to spend more time researching and less time "jumping the gun" to make changes.
Click to expand...
Click to collapse
I've been researching A LOT and I've read lots of scripts and I.m learning along the way but I'm working with uncorrupted now on this and I did jump the gun just a tad lol but I'm taking it slow now again thanks for the information you did supply me with

Related

what is this or what does it do

CAN ANY ONE TELL ME WHAT THIS MEANS OR WHAT IT IS>>>>>!!!!!!!!!.....
on boot
setprop ARGH ARGH
setprop net.eth0.dns1
setprop net.gprs.local-ip
setprop ro.radio.use-ppp no
setprop ro.build.product generic
setprop ro.product.device generic
# fake some battery state
setprop status.battery.state Slow
setprop status.battery.level 5
setprop status.battery.level_raw 50
setprop status.battery.level_scale 9
# disable some daemons the emulator doesn't want
stop dund
stop akmd
setprop ro.setupwizard.mode EMULATOR
# enable Google-specific location features,
# like NetworkLocationProvider and LocationCollector
setprop ro.com.google.locationfeatures 1
# For the emulator, which bypasses Setup Wizard, you can specify
# account info for the device via these two properties. Google
# Login Service will insert these accounts into the database when
# it is created (ie, after a data wipe).
#
# setprop ro.config.hosted_account [email protected]word
# setprop ro.config.google_account [email protected]word
#
# You MUST have a Google account on the device, and you MAY
# additionally have a hosted account. No other configuration is
# supported, and arbitrary breakage may result if you specify
# something else.
service goldfish-setup /system/etc/init.goldfish.sh
oneshot
service qemud /system/bin/qemud
socket qemud stream 666
oneshot
# -Q is a special logcat option that forces the
# program to check wether it runs on the emulator
# if it does, it redirects its output to the device
# named by the androidboot.console kernel option
# if not, is simply exit immediately
service goldfish-logcat /system/bin/logcat -Q
oneshot
This is a logcat... it lets you know what your phone is doing...

Android Empty_App ?

Could someone inform me what empty_app is? What is the maximum highest killing value I could set it at?
Thanks in advance.
By the way, are these numbers related? It probably is but I just want someone to confirm.
Code:
# Define the oom_adj values for the classes of processes that can be
# killed by the kernel. These are used in ActivityManagerService.
setprop ro.FOREGROUND_APP_ADJ [COLOR="red"]0[/COLOR]
setprop ro.VISIBLE_APP_ADJ [COLOR="red"]1[/COLOR]
setprop ro.PERCEPTIBLE_APP_ADJ [COLOR="red"]2[/COLOR]
setprop ro.HEAVY_WEIGHT_APP_ADJ [COLOR="red"]3[/COLOR]
setprop ro.SECONDARY_SERVER_ADJ [COLOR="red"]5[/COLOR]
setprop ro.BACKUP_APP_ADJ [COLOR="red"]5[/COLOR]
setprop ro.HOME_APP_ADJ [COLOR="red"]3[/COLOR]
setprop ro.HIDDEN_APP_MIN_ADJ [COLOR="red"]2[/COLOR]
setprop ro.EMPTY_APP_ADJ [COLOR="red"]28[/COLOR]
# Define the memory thresholds at which the above process classes will
# be killed. These numbers are in pages (4k).
setprop ro.FOREGROUND_APP_MEM 256
setprop ro.VISIBLE_APP_MEM 512
setprop ro.PERCEPTIBLE_APP_MEM 4096
setprop ro.HEAVY_WEIGHT_APP_MEM 768
setprop ro.SECONDARY_SERVER_MEM 2048
setprop ro.BACKUP_APP_MEM 2048
setprop ro.HOME_APP_MEM 768
setprop ro.HIDDEN_APP_MEM 1024
setprop ro.EMPTY_APP_MEM 6144
# Enable Anr history , it would output the debuginfo to data partition
# 1: on 0: off
setprop debugtool.anrhistory 1
# Set error receiver
setprop ro.error.receiver.htc.apps com.htc.feedback
# Write value must be consistent with the above properties.
# Note that the driver only supports 6 slots, so we have combined some of
# the classes into the same memory level; the associated processes of higher
# classes will still be killed first.
write /sys/module/lowmemorykiller/parameters/adj [COLOR="Red"]0,1,2,4,7,15[/COLOR]
If so, do I set "0,1,2,4,7,15" to "0,1,2,3,5,28" to match the classes?

Tweak init.d script prevents boot

Hello everyone!
I made this script for myself from stuff I found online. But when I put it into init.d the phone stops booting before the cyanogen logo comes up (on the second LG logo). I can't figure out why... However it works (the settings are applied) if I run it with adb once the phone is booted.
This is the script:
Code:
#!/system/bin/sh
echo "0,1,2,4,6,15" > /sys/module/lowmemorykiller/parameters/adj;
echo "1536,2048,4096,10240,12800,15360" > /sys/module/lowmemorykiller/parameters/minfree;
# vm management tweaks:
echo "4096" > /proc/sys/vm/min_free_kbytes;
echo "1" > /proc/sys/vm/oom_kill_allocating_task;
echo "0" > /proc/sys/vm/panic_on_oom;
echo "0" > /proc/sys/vm/laptop_mode;
echo "0" > /proc/sys/vm/swappiness;
echo "70" > /proc/sys/vm/vfs_cache_pressure;
echo "15" > /proc/sys/vm/dirty_ratio;
echo "3" > /proc/sys/vm/dirty_background_ratio;
# misc kernel tweaks:
echo "8" > /proc/sys/vm/page-cluster;
#echo "64000" > /proc/sys/kernel/msgmni;
#echo "64000" > /proc/sys/kernel/msgmax;
echo "10" > /proc/sys/fs/lease-break-time;
#echo "500,512000,64,2048" > /proc/sys/kernel/sem;
# CPU scheduler tweaks:
#echo "1000000" > /proc/sys/kernel/sched_latency_ns;
#echo "25000" > /proc/sys/kernel/sched_wakeup_granularity_ns;
#echo "100000" > /proc/sys/kernel/sched_min_granularity_ns;
echo "-1" > /proc/sys/kernel/sched_rt_runtime_us ;
echo "100000" > /proc/sys/kernel/sched_rt_period_us;
echo "95000" > /proc/sys/kernel/sched_rt_runtime_us;
# battery tweaks:
echo "3000" > /proc/sys/vm/dirty_expire_centisecs;
echo "500" > /proc/sys/vm/dirty_writeback_centisecs;
echo "500" > /proc/sys/vm/dirty_expire_centisecs;
echo "1000" > /proc/sys/vm/dirty_writeback_centisecs;
echo "0" > /proc/sys/vm/oom_kill_allocating_task;
tune2fs -o journal_data_writeback /dev/block/mmcblk0p1;
tune2fs -O ^has_journal /dev/block/mmcblk0p1;
tune2fs -o journal_data_writeback /dev/block/mmcblk0p2;
tune2fs -O ^has_journal /dev/block/mmcblk0p2;
tune2fs -f -o journal_data_writeback /dev/block/mmcblk0p8;
tune2fs -f -O ^has_journal /dev/block/mmcblk0p8;
mount -o remount,noatime,noauto_da_alloc,nodev,nodiratime,barrier=0,nobh /system;
mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh /data;
mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh /cache;
rm -f /data/system/userbehavior.db;
chmod 400 /data/system/usagestats/;
chmod 400 /data/system/appusagestats/;
rm -f /dev/log/main;
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
echo "2048" > /sys/devices/virtual/bdi/default/read_ahead_kb;
setprop net.dns1 8.8.8.8;
setprop net.dns2 8.8.4.4;
setprop windowsmgr.support_rotation_270 true;
setprop persist.service.pcsync.enable 0;
setprop persist.service.lgospd.enable 0;
setprop user.feature.flex true;
setprop user.feature.lgdrm false;
setprop user.feature.lgresource false;
setprop user.feature.lgpoweroff false;
setprop user.feature.ls_event false;
setprop user.feature.ls_normal false;
setprop user.feature.sui false;
setprop media.stagefright.enable-player false;
setprop media.stagefright.enable-meta true;
setprop media.stagefright.enable-scan true;
setprop media.stagefright.enable-http true;
echo "0" > /proc/sys/net/ipv4/tcp_timestamps;
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse;
echo "1" > /proc/sys/net/ipv4/tcp_sack;
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle;
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling;
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes;
echo "30" > /proc/sys/net/ipv4/tcp_keepalive_intvl;
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout;
echo "404480" > /proc/sys/net/core/wmem_max;
echo "404480" > /proc/sys/net/core/rmem_max;
echo "256960" > /proc/sys/net/core/rmem_default;
echo "256960" > /proc/sys/net/core/wmem_default;
echo "4096,16384,404480" > /proc/sys/net/ipv4/tcp_wmem;
echo "4096,87380,404480" > /proc/sys/net/ipv4/tcp_rmem;
MAX_PHONE()
{
pidphone=`pidof com.android.phone`;
if [ $pidphone ];
then
/system/xbin/echo "-17" > /proc/$pidphone/oom_adj;
renice -20 $pidphone;
exit;
else
MAX_PHONE;
fi;
}
MAX_ACORE()
{
pidacore=`pidof android.process.acore`;
if [ $pidacore ];
then
/system/xbin/echo "-17" > /proc/$pidacore/oom_adj;
renice -3 $pidacore;
exit;
else
MAX_ACORE;
fi;
}
MAX_MEDIA()
{
pidmedia=`pidof android.process.media`;
if [ $pidmedia ];
then
/system/xbin/echo "-17" > /proc/$pidmedia/oom_adj;
renice -20 $pidmedia;
exit;
else
MAX_MEDIA;
fi;
}
MAX_UI()
{
pidui=`pidof com.android.systemui`;
if [ $pidui ];
then
/system/xbin/echo "-17" > /proc/$pidui/oom_adj;
renice -20 $pidui;
exit;
else
MAX_UI;
fi;
}
Thanks!
user.feature.lgdrm=false disable DRM Service, so you can not use the default phone ringtones and notifications but if you are planning to use your custom files without DRM then there are no problems.
Regards.

Proper executing of sysctl.conf during boot

Edit: For some strange reason it suddenly works after posting this topic.. :') Delete please
Ok so this is the deal, I'm currently working on broodKernel v1.2 (yes not 1.1 but 1.2) and I've noticed that sysctl.conf isn't loaded in any way, I tried loading it with "sysctl -p" and also with su -c "sysctl -p", both tried it in the kernel itself and in init.d scripts, for some reason it doesn't load on boot, but when I load it myself with "su -c "sysctl -p" it works correctly :silly:
mode is: 644, also tried to chown it to system and/or root, both didn't work. then I question myself. is my init.d method correct? Is it running in root mode? I use this:
Code:
service initd /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
oneshot
doesn't it need a "user root" at the bottom?, I feel kinda like this emoticon ":silly:" to ask such question, but I really don't know why it's not running correctly, anyhow the sysctl values from the latest thunderbolt seem so unrealistic?:
Code:
vm.dirty_expire_centisecs = 3000
vm.dirty_writeback_centisecs = 500
But ok that's the thunderbolt settings, also I'm not sure if this really improves the system, I've noticed that the first few benchmarks score pretty high but then suddenly the sdcard read/write speed gets screwed by something.
Anyway, here are the scripts (so far):
/system/etc/init.d/00broodkernel:
Code:
#!/system/bin/sh
# Created by broodplank1337
# broodKernel v1.2
# =================================== #
# broodKernel v1.2 Configuration File #
# =================================== #
# =================================== #
# >>> Available Settings <<< #
# =================================== #
#
# - Set I/O Scheduler
# - Set SDCARD Readahead
# - Enable/Disable Error Reporting
# - Enable/Disable sysctl.conf file
# - See 01screenstatescaling for (advanced) CPU Settings / Tweaks
#
# =================================== #
# =================================== #
#
# >>> I/O Scheduler <<<
#
SCHEDULER="noop"; # noop/cfq
#
# =================================== #
#
# >>> Set SDCard Read Ahead <<<
#
SDCARDREADAHEAD="1024"; # 128/256/512/1024/2048/3072/4096
#
# =================================== #
#
# >>> Google Error Reporting <<<
#
ERRORREPORTING="disabled"; # enabled/disabled
#
# =================================== #
#
# >>> Sysctl.conf Support <<<
#
SYSCTLSUPPORT="enabled"; # enabled/disabled
#
# =================================== #
# Execute Settings:
echo $SCHEDULER > /sys/block/mmcblk0/queue/scheduler
echo $SCHEDULER > /sys/block/mmcblk1/queue/scheduler
# Error Reporting
if [[ "$ERRORREPORTING" == "enabled" ]]
then
setprop profiler.force_disable_err_rpt 0
setprop profiler.force_disable_ulog 0
setprop ro.config.nocheckin 0
else
setprop profiler.force_disable_err_rpt 1
setprop profiler.force_disable_ulog 1
setprop ro.config.nocheckin 1
fi;
# Sysctl.conf
if [[ "$SYSCTLSUPPORT" == "enabled" ]]
then
sysctl -p
else
busybox mv /system/etc/sysctl.conf /system/etc/sysctl.conf.disabled
fi;
# Readahead
echo $SDCARDREADAHEAD > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
echo "256" > /sys/devices/virtual/bdi/179:32/read_ahead_kb;
echo "256" > /sys/devices/virtual/bdi/default/read_ahead_kb;
/system/etc/init.d/01screenstatescaling: (really like this one )
Code:
#!/system/bin/sh
# Credits to pikachu01 and FloHimself for governor tweaks / screenstatescaling script
# Edited by broodplank1337 to fit broodKernel v1.2
# Mount
mount -o remount rw /system
# =====================================================================================
# >>> broodKernel v1.2 CPU Configuration File / Screenstatescaling Script >>> #
# =====================================================================================
# >>> Notes <<<
#
# - This script manages the cpu settings for awake and sleep state.
# - Be sure not to set the max frequency lower then the min frequency.
# - Please only use existing governors to prevent boot problems.
# - Additional governor tweaks can be enabled for a better battery life,
# the governor tweaks may lower performance (only theoretical, like cpu score in Antutu)
# - You can choose to use this file only for CPU Settings,
# this will modify the /system/etc/init.qcom.post_boot.sh file to not set a governor,
# when enabled and 01screenstatescaling is absent, your system will not boot properly
# settings can be restored by place this line:
# =====================================================================================
# >>> Basic CPU Settings <<< # Please only use the values below as settings
# =====================================================================================
# Awake CPU Settings
AWAKE_GOVERNOR="ondemand"; # ondemand/performance/conservative/userspace
MIN_SPEED_AWAKE="245760"; # 122880/245760/368640
MAX_SPEED_AWAKE="1401600"; # 768000/806400/1024000/1200000/1401600
# Sleep CPU Settings
SLEEP_GOVERNOR="ondemand"; # ondemand/conservative/powersave
MIN_SPEED_SLEEP="122880"; # 122880/245760/368640
MAX_SPEED_SLEEP="245760"; # 122880/245760/368640
# Governor Tweaks
ENABLE_ONDEMAND_TWEAKS="no"; # yes/no
ENABLE_CONSERVATIVE_TWEAKS="no"; # yes/no
# =====================================================================================
# =====================================================================================
# >>> Advanced CPU Settings << # Use at own risk, don't change if inexperienced.
# =====================================================================================
# Use 01screenstatescaling as primary CPU Management script
DISABLE_POSTBOOT_CPU="no"; # yes/no (only enable if you know what you're doing!)
# =====================================================================================
# Execute Settings
# Disable Postboot CPU Management
if [[ "$DISABLE_POSTBOOT_CPU" == "no" ]]
then
if [ -e /system/etc/init.qcom.post_boot.sh.bak ]; then
busybox cp -f /system/etc/init.qcom.post_boot.sh.bak /system/etc/init.qcom.post_boot.sh
else
sleep 1
fi;
else
if [ -e /system/etc/init.qcom.post_boot.sh.bak ]; then
sleep 1
else
busybox cp -f /system/etc/init.qcom.post_boot.sh /system/etc/init.qcom.post_boot.sh.bak
sed '33d' /system/etc/init.qcom.post_boot.sh > /sdcard/temp.sh # Remove line that sets governor
busybox mv -f /sdcard/temp.sh /system/etc/init.qcom.post_boot.sh
chmod 644 /system/etc/init.qcom.post_boot.sh
chown root:root /system/etc/init.qcom.post_boot.sh
fi;
fi;
# Ondemand Tweaks
if [[ "$ENABLE_ONDEMAND_TWEAKS" == "yes" ]]
then
if [ -e /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold ]; then
echo "95" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold;
echo "5" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/down_differential;
#echo "0" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_down_factor;
echo "100000" > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate;
fi;
if [ -e /sys/devices/system/cpu/cpufreq/ondemand/up_threshold ]; then
echo "95" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold;
echo "5" > /sys/devices/system/cpu/cpufreq/ondemand/down_differential;
#echo "0" > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy;
echo "1" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor;
echo "100000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate;
fi;
else
sleep 1
fi;
# Conservative Tweaks
if [[ "$ENABLE_CONVERVATIVE_TWEAKS" == "yes" ]]
then
if [ -e /sys/devices/system/cpu/cpu0/cpufreq/conservative/up_threshold ]; then
echo "95" > /sys/devices/system/cpu/cpu0/cpufreq/conservative/up_threshold;
echo "90" > /sys/devices/system/cpu/cpu0/cpufreq/conservative/down_threshold; # 35 # 12 # 30 (higher will lead to noticable lags) # 35 # screen off: # 50 ## 35
echo "20" > /sys/devices/system/cpu/cpu0/cpufreq/conservative/freq_step; # more aggressive ramping up (50) # screen off: # 10
echo "1" > /sys/devices/system/cpu/cpu0/cpufreq/conservative/sampling_down_factor;
echo "100000" > /sys/devices/system/cpu/cpu0/cpufreq/conservative/sampling_rate;
fi;
if [ -e /sys/devices/system/cpu/cpufreq/conservative/up_threshold ]; then
echo "95" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold;
echo "90" > /sys/devices/system/cpu/cpufreq/conservative/down_threshold; # 35 # 12 # 30 (higher will lead to noticable lags) # 35 # screen off: # 50 ## 35
echo "20" > /sys/devices/system/cpu/cpufreq/conservative/freq_step; # more aggressive ramping up (50) # screen off: # 10
echo "1" > /sys/devices/system/cpu/cpufreq/conservative/sampling_down_factor;
echo "100000" > /sys/devices/system/cpu/cpufreq/conservative/sampling_rate;
fi;
else
sleep 1
fi;
# Screenstatescaling loop
(while [ 1 ];
do
# ==============================================================
# settings for while the screen is on / usage
# ==============================================================
AWAKE=`cat /sys/power/wait_for_fb_wake`;
if [ $AWAKE = "awake" ]; then
sleep 2
log -p i -t screenstate_scaling "State: Awake, switching CPU governor to -> $AWAKE_GOVERNOR"
echo $AWAKE_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
echo $MIN_SPEED_AWAKE > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo $MAX_SPEED_AWAKE > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
fi;
# ==============================================================
# settings for while the screen is off
# ==============================================================
SLEEPING=`cat /sys/power/wait_for_fb_sleep`;
if [ $SLEEPING = "sleeping" ]; then
sleep 2
log -p i -t screenstate_scaling "State: Sleeping, switching CPU governor to -> $SLEEP_GOVERNOR"
echo $SLEEP_GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
echo $MIN_SPEED_SLEEP > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo $MAX_SPEED_SLEEP > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
fi;
done &);
/system/etc/sysctl.conf:
Code:
vm.page-cluster = 3
vm.laptop_mode = 0
vm.dirty_expire_centisecs = 3000
vm.dirty_writeback_centisecs = 500
vm.dirty_background_ratio = 40
vm.dirty_ratio = 80
vm.vfs_cache_pressure = 10
vm.overcommit_memory = 1
vm.oom_kill_allocating_task = 0
vm.min_free_kbytes = 4096
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_dsack = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_moderate_rcvbuf = 1
kernel.sem = "500 512000 100 2048"
kernel.shmmax = 268435456
kernel.msgmni = 1024

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