new set speed script for bugless!

Discussion in 'Bugless' started by Se7enLC, Jun 10, 2010.

  1. Se7enLC
    Offline

    Se7enLC New Member

    Joined:
    Nov 16, 2009
    Messages:
    1,263
    Likes Received:
    0
    Trophy Points:
    0
    NOTE: BuglessBeast Experimental Froyo 0.2.1 now does automatic Max frequency scaling using the same method I use here! If you just want it to always scale to the max supported and min speed of 250Mhz using the ondemand governor, there is no need to use this script. If you want to adjust the speed and have those changes persist after a reboot, however, read on...

    I wrote a little script to make it easier to adjust the maximum frequency scaling without using SetCPU. USE AT YOUR OWN RISK, THIS IS A WORK IN PROGRESS! That being said, I'm writing it to be as robust as possible, so it shouldn't screw anything up. Let me know if it does, I'll fix it.

    You can use this script to easily switch your maximum and minimum speed, as well as governor.

    To install:
    First, copy setspeed.txt to your sd card. I'm assuming you put it in the root and called it "setspeed.txt"
    Code:
    su
    sh /sdcard/setspeed.txt
    
    Once you have done this, you can delete the file off the sdcard if you like. On the first run, it will install itself into /system/xbin/setspeed, create links for the setmax, setmin, and setgov commands, and install itself into the startup script install-recovery.sh

    How To Use:
    To set your max speed, type "setmax 600" or "setmax 800" or whatever speed you want. If you type "setmax" by itself, it will list off your available speeds, including the virtual speed of "max", which will automatically determine the maximum supported speed and set that.

    To set your min speed, it's the same as setting the maximum, but with "setmin", and with the virtual speed of "min" in addition to normal speeds.

    To set your governor, type "setgov ondemand" or "setgov conservative". Those are probably the only governors you will want to play with. powersave, performance, and userspace really don't make sense to use on the droid.

    With any of these three settings, your choice will be applied immediately and saved and re-applied on every reboot.

    NOTE: When you are plugged into AC, the Droid will ignore any frequency scaling settings below 500Mhz, so don't be alarmed if it just sits at 500 instead of scaling down to 400,250,125, etc.
    NOTE: You can set unsupported speeds as the minimum. The Droid will scale down to whatever step is equal to or greater than that minimum.
    NOTE: Tested with BB Froyo 0.1, 0.2, and 0.2.1, and it works with all of them

    ChangeLog
    3.2
    Fixed a bug where setmin wasn't working at all
    3.1
    Script has been updated to work with BB 0.3 - the busybox binary was moved to /system/bin
    3.0
    Script is now "setspeed", supports governors, and is easier to use.
    2.0
    Added md5sum check so that new versions will auto-install and overwrite when you install them.
    1.9
    Fixed a bug where filenames that end with a non-integer (ie, things with a .txt extension) won't run. Invalid speeds are now replaced with "600".
    1.8
    Script is now self-installing. speed000 will now set the maximum speed at boot time, rather than storing the maximum speed to set at boot time.
    1.7

    Now allows you to optionally specify a minimum frequency as well, by typing it on the command-line after the script. "speed600 250" will set the max to 600, and the minimum to 250. The minimum will also be restored on a reboot.
    Last edited: Jun 30, 2010
  2. chadamir
    Offline

    chadamir New Member

    Joined:
    May 23, 2010
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    0
    This is great, but I can't find the /system/xbin/pete file.
  3. Se7enLC
    Offline

    Se7enLC New Member

    Joined:
    Nov 16, 2009
    Messages:
    1,263
    Likes Received:
    0
    Trophy Points:
    0
    The BB Froyo release candidate doesn't have that script - previous BB releases do, and I assume future froyo releases will, eventually, as well.
  4. actngrezy
    Offline

    actngrezy New Member Developer

    Joined:
    Mar 21, 2010
    Messages:
    1,074
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    delaware
    Thats awesome. You could help me in my scripting class lol. but im sorry how do you create a symlink. Sorry for the newb question
  5. budmonster
    Online

    budmonster Guest

    so this doesnt work on froyo yet, correct? could you take the pete script from bb v1.1 and place it in the xbin folder on froyo bb?
  6. Se7enLC
    Offline

    Se7enLC New Member

    Joined:
    Nov 16, 2009
    Messages:
    1,263
    Likes Received:
    0
    Trophy Points:
    0
    It does work on froyo - it just doesn't set the CPU speed on bootup. Setting the max CPU speed in real time works fine - once you run that command, your CPU will be set until the next reboot.

    You could take the pete script from 1.1, but I don't think it will execute on boot. If it did, I suspect pete would have put it there himself :)

    EDIT: Oh, clever! Pete stuck the contents of his script into install-recovery.sh. That script gets run automatically on every boot, regardless of kernel!

    To apply the change to allow my speedXXX scripts to work, you will want to edit that file. Look for this line:
    Code:
    echo "800000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    
    and replace it with this:
    Code:
    cat /system/etc/bb_scaling_max_freq > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    
    Last edited: Jun 10, 2010
  7. Se7enLC
    Offline

    Se7enLC New Member

    Joined:
    Nov 16, 2009
    Messages:
    1,263
    Likes Received:
    0
    Trophy Points:
    0
    I had a few examples in the first post right after the part where I said you need to make the symlinks :)
  8. budmonster
    Online

    budmonster Guest

    Do you have GTALK? I might need some help on this...

    BTW, what is the benefit of using this rather than just removing Petes script and just using setCPU?
  9. czerdrill
    Offline

    czerdrill New Member

    Joined:
    Jan 2, 2010
    Messages:
    4,828
    Likes Received:
    12
    Trophy Points:
    0
    gotta love grep
  10. Se7enLC
    Offline

    Se7enLC New Member

    Joined:
    Nov 16, 2009
    Messages:
    1,263
    Likes Received:
    0
    Trophy Points:
    0
    I just uploaded a new version to the first post - it will automatically modify the startup script once you run it the first time. How's that for snazzy?

    Honestly, I'm not sure what the benefit really is. SetCPU supposedly uses a lot of unnecessary resources, whereas setting your max scaling frequency on boot uses NO resources.
  11. Se7enLC
    Offline

    Se7enLC New Member

    Joined:
    Nov 16, 2009
    Messages:
    1,263
    Likes Received:
    0
    Trophy Points:
    0
    You sed it!

    (ohh, I went there....)
  12. kodiak799
    Offline

    kodiak799 Well-Known Member

    Joined:
    Feb 20, 2010
    Messages:
    4,801
    Likes Received:
    218
    Trophy Points:
    63
    According to Systempanel, the SetCPU service uses 9.0mgs of active memory.

    I run a lot of widgets, so getting rid of unnecessary/redundant services is key for me.

    Going to try your script. Thanks!
  13. Se7enLC
    Offline

    Se7enLC New Member

    Joined:
    Nov 16, 2009
    Messages:
    1,263
    Likes Received:
    0
    Trophy Points:
    0
    If anyone is using this script, please let me know if it's working for you and what you think of it! The latest version is auto-installing, all you have to do is run it and it will automatically generate the rest of the necessary speedXXX scripts for you.
  14. FSRBIKER
    Offline

    FSRBIKER New Member

    Joined:
    Dec 12, 2009
    Messages:
    645
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Oak Ridge, NJ
    So download the file to the SD card and rename it to speed600(no extension) and then using Terminal Emulator type this:
    sysrw
    cp /sdcard/speed000 /system/xbin
    chmod 755 /system/xbin/speed000
    speed000
    Now anytime I install a new kernel it will automatically use Pete's autoscaling script up to the max of the installed kernel?
    Does this file need to be on the root of the SD card or can it be in a folder?
  15. YellowTwo
    Offline

    YellowTwo New Member

    Joined:
    Feb 4, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Santa Barbara, CA
    More speed options would be nice. It generates 700mhz then jumps up to 1000mhz... Thanks!
  16. Se7enLC
    Offline

    Se7enLC New Member

    Joined:
    Nov 16, 2009
    Messages:
    1,263
    Likes Received:
    0
    Trophy Points:
    0
    EDIT: No longer true

    You have to name it "speed600" when you are installing it and running it for the first time. If you want to then make a link as speed000, you can. It will set to the maximum speed *at the time you run it*, and set to that speed again on every reboot - it doesn't currently set to the maximum speed ON reboot - that would be an easy option to add, though, as an alternative to having a user-adjustable setting.

    The file does not need to be on the root of the SD card, although the directions assume that it is. Once you copy the script into /system/xbin, you no longer need to have it on the sd card at all, I just made that assumption to make the installation directions easier.
    Last edited: Jun 12, 2010
  17. Se7enLC
    Offline

    Se7enLC New Member

    Joined:
    Nov 16, 2009
    Messages:
    1,263
    Likes Received:
    0
    Trophy Points:
    0
    The frequency steps are a function of your kernel, not the script. If you want different steps to pick from, you can select a different kernel (but you won't find more than 7 total steps to my knowledge).
  18. YellowTwo
    Offline

    YellowTwo New Member

    Joined:
    Feb 4, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Santa Barbara, CA
    Oooh okay. Good to know.
  19. Se7enLC
    Offline

    Se7enLC New Member

    Joined:
    Nov 16, 2009
    Messages:
    1,263
    Likes Received:
    0
    Trophy Points:
    0
    I made some more changes to the set speed script:

    1). It's now much easier to install (it doesn't care what you name it, you just run it and it will install itself to the right place)

    2). speed000 will set the speed to maximum at boot time, rather than collecting the maximum speed immediately and then setting it at boot time.
  20. actngrezy
    Offline

    actngrezy New Member Developer

    Joined:
    Mar 21, 2010
    Messages:
    1,074
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    delaware

    Do we still need to edit the install-recovery.sh file to get this to work? or is that not a factor anymore?
Search tags for this page
android /sys/devices/system/cpu/cpu0/cpufreq/scaling max fre
,
android connectbot set min freq
,
android cpu scaling
,
android speed scripts
,

droid 4 speedscript

,
init.d script for max cpu frequency android
,
manually set android governor minimum frequency
,
scaling setspeed unsupported android problem
,
scripts android scalling cpu max
,
scripts for changing cpu frequency android
,
setting cpu speed
,

speed scripts for android