yashsingh1/xdaforums huggingface dataset:
[Nexus One Android Development] ch33kybutt:
I've tried a lot of performance-boosting and battery-saving mods, but none of them worked well together. It was a case of exclusive-OR, i.e. either set only for performance-boost OR only for battery-saving.

So I adapted 2 existing scripts (screenstate_scaling and battery tweak) and came up with SS4N1, which combines the best of both worlds ... performance-boost whenever I use my N1, and battery-saving whenever my N1 is idle.

SS4N1 : ScreenState for Nexus One

auto-switch the following settings based on screen-state (AWAKE/SLEEPING)

virtual memory

cpufreq governor

cpu scheduler

undervoltage

performance tweaks on startup

dialer optimization

remount partitions with noatime

storage/IO tuning

UI/homescreen optimization

network performance tuning

ability to enable/disable any or all of the above features

adapted from screenstate_scaling (FloHimself@xda) & battery tweak (collin_ph@xda)

DOWNLOADS from my mediafire site

[MOD/SCRIPT] SS4N1

[KERNEL] Savaged-Zen for N1 (2.6.38.8, 128-1190, BFS/CFS, SWAP, NOOP, HAVS, AXI, HW3D)

#include <std_disclaimer.h>
/*
* Your warranty is now void.
*
* I am not responsible for bricked devices, dead SD cards, thermonuclear war,
* or you getting fired because the alarm app failed. Please do some research if
* you have any concerns about features included in these ROMs, mods & kernels
* before flashing! YOU are choosing to make these modifications, and if you
* point the finger at me for messing up your device, I will laugh at you.
*/
[Nexus One Android Development] ch33kybutt:
Changelog for SS4N1

# ===============

# SS4N1 changelog

# ===============

# Initial

# + port script from Spica to N1

#

# 20110329

# + added SD Card Speed Fix in TWEAK_STORAGE section

#

# 20110403

# + changed deprecated oom_adj to oom_score_adj for MAX_PHONE function and sscfg

#

# 20110403A

# + added auto-check of kernel version for oom-killer parameter for MAX_PHONE function and sscfg

# + updated check for cpufreq up_threshold for Auto Switch function

#

# 20110404

# + changed from init.d script to init.local.rc service to fix "hung-on-X" when not running dt-a2sd

#

# 20110505

# + modified to apply UV for Hybrid-AVS (Tiamat, SavagedZen, new-IR) and Customizable-AVS (old-IR)

#

# 20110519

# + added option for new interactiveX governor

# + removed tweaks for TCP/IP redirects

#

# 20110525

# + disabled dewonkifier feature in all preset profiles (thx 2 jyxent!)

# + tuned preset profiles to more conservative undervolt values

# + added option to display HAVS Min & Max VDD levels (CPU voltage table)

# + added option to display misc information (CPU info, kernel version, etc)
[Nexus One Android Development] sir*mez:
Yes finally! Thank you for bringing your expertise here! The all-in-one script perfect for everything! I've been a fan of this script for a long time now!
[Nexus One Android Development] ch33kybutt:
You're most welcome! Not sure if I have the time to update this thread regularly, but I'll try my best as always.
[Nexus One Android Development] hextence:
Does it work with MIUI Roms?
[Nexus One Android Development] ch33kybutt:
The last time I tried a few months back, yes it did.
[Nexus One Android Development] hextence:
Thanks! It works, and quite well too! :)
[Nexus One Android Development] ch33kybutt:
Thanks for letting me know. I've updated OP and added MIUI in ROMs section.
[Nexus One Android Development] hotweiss:
What gains have you seen with this mod?
[Nexus One Android Development] ch33kybutt:
That's the thing about this mod, it's ultimately up to the user to decide what type of profile they want. I put no stock in so-called benchmarks but UI is smooth and lag-free (especially with BFS kernel) whenever I use it and I get less than 1% battery decrease per hour overnight when phone is idle (from 100% to 96% in 7 hours).
[Nexus One Android Development] terente0081:
Thanks ch33kybutt, it was about time you started your own thread for this great script! I've been using it since it's first incarnation, on MIUI alone with great success. Battery life is better, phone runs very smooth and the best thing is that you can set a different CPU governor for AWAKE/SLEEP modes plus all those tweaks.

I'd like more control over the audio volume, I feel as it's not loud enough; is it possible to add a tweakable audio boost function? Something that would make the ringtones ring louder?
[Nexus One Android Development] ch33kybutt:
Audioboost is built into the kernel upon compiling. But I think there's a volume hack app floating around the dev section that you can use.
[Nexus One Android Development] terente0081:
Thanks for answering! I know about the app, I was wondering if that tweak can also be implemented in ss4n1.
[Nexus One Android Development] PnkPwrRngr:
Installation instructions?
[Nexus One Android Development] ch33kybutt:
- Download latest zip

- Save to sdcard

- Boot phone to recovery and install zip

- Check OP for "How to enable SS4N1"
[Nexus One Android Development] uoY_redruM:
Hmmm....I think I may have to look into this one!

Seems interesting. Don't know how I missed this being posted 3 days ago.
[Nexus One Android Development] uoY_redruM:
ch33ky, are the settings in picture 8 your optimal settings?

I'm not 100% confident in making my own settings yet and I'd like to use that as a guide.

I actually set mine to whatever your first picture shows but before saving I realized picture 8 had different settings and since I flashed your kernel as well I figured I'd try out your settings..
[Nexus One Android Development] ch33kybutt:
I'm actually using the settings in pic 2 right now.
[Nexus One Android Development] uoY_redruM:
How are they working for you? Picture8 settings are causing a pretty bad delay when loading multiple web pages at once and when typing it is falling WAY behind me. I have to stop every few seconds and let it catch up.
[Nexus One Android Development] ch33kybutt:
That's probably because you're using SavagedZen governor in awake-mode. SavagedZen cpu governor is more attuned to battery-savings than performance-boost. Try switching to interactive governor instead.
[Nexus One Android Development] n0w4y:
Could someone please explain me, how to undervolt the right way?

Should I only undervolt the min voltages, as I'm running a HAVS Kernel, and, as I know, this will set the voltage depending on system load? (So far I undervolted both)

At which voltage do you run your Nexus?

I've tried a lot, but still getting random reboots.

Many thanks in advance :-)
[Nexus One Android Development] :
hello. i'm on cm7 nightly #208 (2.3.7 based) w/ the latest IR AVS kernel and if i activate ss4n1 w/ my profile i get lot of reboots. w/o ss4n1 disabled i get none.

any ideas what could cause this?

here's my cfg

ENABLE_SS4N1=0
ENABLE_MAXPHONE=1
DEWONKIFIER=0
TWEAK_NOATIME=1
TWEAK_STORAGE=1
TWEAK_UI=1
TWEAK_NETWORK=1
ENABLE_SWITCH=1
SWITCH_UV=1
SWITCH_CPUSCHED=1
SWITCH_VM=1
SWITCH_CPUFREQ=1
AWAKE_GOVERNOR=SavagedZen
AWAKE_MIN_FREQ=128000
AWAKE_MAX_FREQ=998400
AWAKE_UP_THRESHOLD=
AWAKE_MIN_UV=0
AWAKE_MAX_UV=0
SLEEP_GOVERNOR=conservative
SLEEP_MIN_FREQ=128000
SLEEP_MAX_FREQ=384000
SLEEP_UP_THRESHOLD=99
SLEEP_MIN_UV=200
SLEEP_MAX_UV=100
CHARG_GOVERNOR=ondemand
CHARG_MIN_FREQ=128000
CHARG_MAX_FREQ=998400
CHARG_UP_THRESHOLD=
CHARG_MIN_UV=0
CHARG_MAX_UV=0
A128000=128000,950,975
A245000=245000,950,1000
A384000=384000,950,1025
A422400=422400,950,1050
A460800=460800,975,1050
A499200=499200,1000,1075
A537600=537600,1000,1075
A576000=576000,1025,1100
A614400=614400,1050,1100
A652800=652800,1075,1125
A691200=691200,1100,1150
A729600=729600,1125,1175
A768000=768000,1150,1200
A806400=806400,1175,1225
A844800=844800,1200,1250
A883200=883200,1200,1275
A921600=921600,1225,1275
A960000=960000,1225,1275
A998400=998400,1225,1275
A1036800=1036800,1275,1275
A1075200=1075200,1275,1275
A1113600=1113600,1275,1275
S128000=128000,950,975
S245000=245000,950,1000
S384000=384000,950,1025
S422400=422400,950,1050
S460800=460800,975,1050
S499200=499200,1000,1075
S537600=537600,1000,1075
S576000=576000,1025,1100
S614400=614400,1050,1100
S652800=652800,1075,1125
S691200=691200,1100,1150
S729600=729600,1125,1175
S768000=768000,1150,1200
S806400=806400,1175,1225
S844800=844800,1200,1250
S883200=883200,1200,1275
S921600=921600,1225,1275
S960000=960000,1225,1275
S998400=998400,1225,1275
S1036800=1036800,1275,1275
S1075200=1075200,1275,1275
S1113600=1113600,1275,1275
[Nexus One Android Development] heywtf:
ss4n1 is great and I have been using it for a while now. Thanks a lot ch33kybutt.

However is there any possibility of moving the config folder from /sdcard/ss4n1 to /sdcard/Android/data/ss4n1 or maybe /sdcard/.ss4n1 (to mark it as hidden)? It's not a folder that needs to be accessed regularly and nobody likes SD card clutter.
[Nexus One Android Development] bassmadrigal:
Totally agree with this. Preferably the /sdcard/Android/data/ss4n1 or something similar. Most of my file browsers show "hidden" folders, so I would prefer it in another folder that already exists.
[Nexus One Android Development] avgjoemomma:
I posted this on CM's forum but in the meantime, I'm currently running CM7.1 Build #220 and used CKZTools to install and configure SS4N1. Unfortunately, it doesn't seem that init.local.rc in /system/etc is being properly imported by /init.rc so upon a reboot, SS4N1 is not started. I have to go back to CKZTools to get it to run again. Any ideas?:confused:
[Nexus One Android Development] :
anyone on 7.2 still using ss4n1? as mentioned in my reply before, it hasn't been stable for me. plus IR hasn't updated his kernel lately...
[Nexus One Android Development] Deliamber:
I'm using it here on CM 7.2 final, stock CM kernel (so no voltage scaling). Seems to be fine. No reboots anyway.
[Nexus One Android Development] bunnahabhain:
running pretty good on MIUI 1.5.20!

Using interactiveX here - never heard of that btw
[Nexus One Android Development] meechto:
@ch33kybutt

Glad that you finally have your own thread :D

Have a quick question - Does the script work on basis of screen state only or can it detect whether or not some application is running when the screen has switched off and adjust the governor, scheduler etc. accordingly? For e.g.: I have noticed that with SetCPU, while running backup & restore apps or transferring files from the phone to the PC or vice-versa when the screen turns off and the 'Screen Off' profile activates, the apps run much slower (as the CPU is scaled down) leading to the phone heating up and eventually draining more battery than it should have saved otherwise :( Does SS4N1 handle such scenarios? :confused:
[Nexus One Android Development] ch33kybutt:
Based solely on screenstate, just like setcpu. Having to check running applications would require polling, which would eat up more battery.
[Nexus One Android Development] meechto:
Thanks for the prompt response :) The script is more versatile and feature rich than SetCPU anyway. I am gonna check it out for sure ;)
[Nexus One Android Development] mtw4991:
I assume this will work with Redstar's 1190 kernel + Dt a2sd/d2sd ext4?
[Nexus One Android Development] sir*mez:
Yes sir you are correct.
[Nexus One Android Development] RogerPodacter:
What current readings ate you guys seeing with this script over night idle?
[Nexus One Android Development] momomok:
This script seems nice.

One problem though, when I flash this my screen turns on and off itself when I try to unlock.

Have to disable the UI optimization to make it working
[Nexus One Android Development] ch33kybutt:
The UI tweak actually just sets refresh rate from default 55 to 60 (setprop windowsmgr.max_events_per_sec 60). So it shouldn't really affect screen on/off. But hey, whatever works for you :)
[Nexus One Android Development] momomok:
Hmmm. Then maybe I have hitted a bug in the nightlies, or a bug in IR's kernel...

Damn I shouldn't play with three potentially buggy stuff atbthe same time! LOL
[Nexus One Android Development] RogerPodacter:
This is a separate bug many of us have with latest cyan nightlies.
[Nexus One Android Development] fs61:
When in flash the IR-Kernel and the zip file my phone stocks after reboot...
[Nexus One Android Development] momomok:
Hmm. Is my situation a variant of the black screen bug?

Anyway, this script is not to be blamed. I found the cause of my situation: I have enabled "Screen On Animation", disable it and everything is alright.
[Nexus One Android Development] ch33kybutt:
Try to wipe cache + dalvik-cache, re-flash kernel, reboot.
[Nexus One Android Development] fs61:
Aight, i will give them a try :-D
[Nexus One Android Development] momomok:
A quick question.

Do I have to reflash this everytime I flash a new nightly?
[Nexus One Android Development] ch33kybutt:
Yup. So save your preferred settings to sdcard, so you can easily reload after each ROM flashing.
[Nexus One Android Development] yumcax:
This is amazing, like all of the little tweaks I had installed bundled into one sleek package. Sure makes installing new ROMs easier.
[Nexus One Android Development] access9:
Is this intended to work in conjunction with setCPU or as a replacement? TIA.
[Nexus One Android Development] ch33kybutt:
Both, actually. When I was trying out IR's overclocked kernels, using setcpu would always result in reboots. But modifying the kernel parameters directly using scripts provided better stability. Not knocking setcpu, which is a great app, but guess my N1 couldn't handle it for overclocking.

In short, here's how to use SS4N1 ...

- with SetCPU : Disable autoswitch for CPU frequency governor

- without SetCPU : Enable autoswitch for CPU frequency governor
[Nexus One Android Development] momomok:
It's too late. I have already flashed the latest nightly... :(

but nvm, i love typing command :D
[Nexus One Android Development] ReTro FuZe:
Does this work with Tiamat's Kernel?
[Nexus One Android Development] ch33kybutt:
Yes

10 chars
[Nexus One Android Development] PnkPwrRngr:
Have an issue... Every time I try to load one the presets, my phone will freeze/reboot and won't boot back into cm7 until I reflash the ss4n1 zip. I have to remove the battery to get back into recovery, the three button reset won't work after the freeze/reboot.

Are the preset profiles designed to work on the N1? If the presets aren't designed to work, any setting suggestions that will work well for moderate performance and audio playback while phone is asleep?

PS. running savagezen cfs kernal and cm 7.0.3
[Nexus One Android Development] PsychoKilla666:
Hey guys this looks excellent

I had a few questions

Can someone give me a simple explanation of cfs vs bfs

Does the N1 kernel support sbc and can we use the sbc switch apk ?

If we don't setup setcpu this mod is just as good switching states and saving battery ?

Possible to run this issue free with WiFi calling hack ?

Appreciate it, can't wait to flash back to cyan and try this

Thanks
[Nexus One Android Development] ch33kybutt:
Probably caused by UV setting. Did u try Default profile? That has no UV.
[Nexus One Android Development] PnkPwrRngr:
The default profile seems to be working fine. Aren't I missing out on some performance without UV settings?
[Nexus One Android Development] ch33kybutt:
cfs : more stable, higher throughput, good for browsing. Bfs : less stable, better interactivity, smoother UI.

Unfortunately, SBC not enabled. Get compile errors. But then again SBC has added risk of battery damage if constantly charging.

Works better for me instead of setcpu, but YMMV.

I don't use wifi calling so don't know how it will affect.
[Nexus One Android Development] ch33kybutt:
Try the customization feature. Decrease gradually in steps of 25mV.
[Nexus One Android Development] PsychoKilla666:
Great, thank you for quick reply and hard work, I'll try cfs without setcpu and pray WiFi call works ;)
[Nexus One Android Development] pen²:
With latest IR Kernel (.38.7, CAVS Noboost) and fit's build, sscfg tells me that there is no CAVS kernel installed... any advice?
[Nexus One Android Development] ch33kybutt:
If you're referring to the option to "Display AWAKE/SLEEP mode voltage table", that's only available for IR's older CAVS kernels, pre-14-May, before he started using eviollet's HAVS method.

Otherwise, option to "Customize CAVS/HAVS - set min & max UV values" should still work, and allow you to enter min & max UV settings.

I'll try to include the option to view current HAVS voltage table (/sys/devices/system/cpu/cpu0/cpufreq/vdd_levels_havs) in the next update.
[Nexus One Android Development] viper2g1:
I'm experiencing very frequent random reboots with this, ir's latest kernel and latest cm nightly. I'm guessing its the uv setting? I used the setup on your second picture and disabled set cpu to auto start. Please advise.
[Nexus One Android Development] pen²:
Ah ok, that clarifies a lot ;-) Thanks for the explanation... Unfortunately, like viper2g1, I too get lots of reboots after enabling ss4n1 with Redstars 950mv kernel and IRs latest, but I will keep trying other kernels - this collection of scripts sounds really good ;-)
[Nexus One Android Development] ch33kybutt:
Yes, UV is the probable culprit. Not all phones can take such OC+UV settings. You should experiment by gradually increasing in 25mV increments.
[Nexus One Android Development] ch33kybutt:
SS4N1 updated

# 20110525

# + disabled dewonkifier feature in all preset profiles (thx 2 jyxent!)

# + tuned preset profiles to more conservative undervolt values

# + added option to display HAVS Min & Max VDD levels (CPU voltage table)

# + added option to display misc information (CPU info, kernel version, etc)
[Nexus One Android Development] timmoty_g:
Hi ch33kybutt,

I'm using MIUI 1.5.20 without custom kernel.

Do we have to use one of those custom kernel?

thanks and regards,

Timmoty
[Nexus One Android Development] ch33kybutt:
No custom kernel required, just no undervolting available.
[Nexus One Android Development] miguelm75:
ch33kybutt, sorry for little OT: i would like to try this: http://xdaforums.com/showthread.php?t=1061648. do you think, that i can use SZ kernel and your script?
[Nexus One Android Development] ch33kybutt:
SS4N1 should work. But SZ kernel is for CM7 only. If you use it with an OTA ROM, camera won't work, and possibly other stuff will fc as well. But no harm in trying ... and sharing ur results.
[Nexus One Android Development] miguelm75:
hmm, i was afraid of that. and what about that one: http://xdaforums.com/showthread.php?t=966635?
[Nexus One Android Development] ch33kybutt:
Superaosp is based on CM7 (I think) so should be fine.
[Nexus One Android Development] bryanchapman9999:
Just flash over the top of previous or remove first?
[Nexus One Android Development] b1337:
Flash it and see, if u read the op u will see that its aosp
[Nexus One Android Development] ch33kybutt:
There's no need to remove previous, but best to save your custom settings (if any) to sdcard before flashing new version. Then you can quickly re-load your saved settings.
[Nexus One Android Development] momomok:
maybe it's time to change the thread title to show that it has been updated..? :P
[Nexus One Android Development] kklang:
I guess it's a bad luck. I ve applied the Kernel and script from the first post and had the phone reboot twice in 4 hours for no reason. And also hanging on black screen non responsive when charging. Was only able to bring it back to life taking out the battery.

Should I have done a full wipe before installing this?

Im on CM7.0.3
[Nexus One Android Development] CyberHarm:
I just flashed #87 with the latest IR CAVS kernel and the SS4N1 script. I copied the settings as displayed in screenshot 2.

My N1 work OK for about 5 minutes and then got really slow. Every app including LPP FC'ed and I couldn't start the terminal to disable SS4N1, so I wiped and reflashed my phone.

Does anyone has an idea what went wrong or what I did wrong?
[Nexus One Android Development] b1337:
superaosp is based off of aosp :p some cyan mixed in
[Nexus One Android Development] uoY_redruM:
I've tried it with several different settings, and on 3 different kernels and I've had the same issue. It'll run fine then I'll get random reboots, if I plug in my charger it'll lock up and restart (not always but sometimes), one particular app which uses GPS will lock up the phone as soon as it finds me with the GPS then it resets. I disabled it and haven't used it with Moviestars newest MIUI ROM (which I flashed this afternoon). I'm considering giving it one last shot, but so far its been a disaster.
[Nexus One Android Development] ch33kybutt:
Not all phones can OC to 1.19MHz successfully. Suggest you try using lower CPU frequencies.
[Nexus One Android Development] PnkPwrRngr:
Is anyone else not able to undervolt their N1 even 1 increment (25mV) on stock frequencies, or does my N1 just suck?

I try setting awake min uv to 25, and my phone reboots a soon as I touch the screen.
[Nexus One Android Development] k3vink3vin:
I know mine doesn't like UV either so you are not alone :)
[Nexus One Android Development] CyberHarm:
Thanks!

So is it only the OC that's causing the trouble? Or can there be problems with the UV too?

Something else: Can I go into recovery and only flash the SS4N1 script or do I need to flash it together with a custom ROM?
[Nexus One Android Development] ch33kybutt:
If you read previous posts, some phones even have issues with just -25mV UV. So as with all of the settings, YMMV.

Depends on which ROM you're using. SS4N1 requires a rooted ROM with init.local.rc startup feature.
[Nexus One Android Development] vithudu:
I am using N1 with Tasker CPU Control, SuperPower for hope to prolong battery life. So, some clarifications are needed:

It will be there any conflict if I am using both Tasker and SS4N1 at the same time? Because they all tweak freqs and governer profiles???

SS4N1 would be fine with RedStar kernel???

Thanks, very obliged
[Nexus One Android Development] ch33kybutt:
You should only have 1 app controlling CPU governor and frequencies at any one time, or else there might be unintended consequences. SS4N1 can be used with Tasker, provided the "Autoswitch for CPU frequency governor" is disabled. And yes, it will work with Redstar's kernels.
[Nexus One Android Development] ch33kybutt:
SavagedZen kernels updated!
[Nexus One Android Development] PnkPwrRngr:
Changelog for sz kernel?
[Nexus One Android Development] ch33kybutt:
No code changes, only recompiled with updated GCC 4.6.1 toolchain.
[Nexus One Android Development] PnkPwrRngr:
Ugh, I want UV to work so bad! My phone craps itself with a 25mV UV on sleep mode with 128-245 freq.

Am I doing something wrong?
[Nexus One Android Development] apratomo:
To use this script, do you recommend with stock cm7 kernel or savagedzen (assuming savagedzen can work with cm7) or even other kernel?
[Nexus One Android Development] ch33kybutt:
What are your settings?
[Nexus One Android Development] ch33kybutt:
Only custom kernels (IR, SZ & Tiamat) have HAVS which allow undervolting. All other features should be available on stock kernel.