Aspireone the noisy fan hack

  • Download the acer_ec.pl script.
  • Download the acerfand daemon script.
  • Execute these lines in a terminal in the directory you downloaded the above scripts:
    chmod a+x acerfand
    sudo cp acer_ec.pl acerfand /usr/local/bin/

    To run it straight away:
    sudo acerfand
    To run it at boot:
    In Ubuntu:
    gksu gedit /etc/rc.local
    Insert the following line above the “exit 0” at the bottom:
    /usr/local/bin/acerfand
    In Linpus Linux Lite: (default Aspire One installation)
    As root :
    vi /etc/rc.local
    Press i to switch to INSERT mode and add the following line at the bottom :
    /usr/local/bin/acerfand
    Press Esc and type :wq to save and quit
    Optionally create an /etc/acerfand.conf file. The file is just a shell script that sets up to three values. eg:
    INTERVAL=5
    FANOFF=60
    FANAUTO=70

    Those are the default values, if the /etc/acerfand.conf file isn’t found.
    INTERVAL is the polling interval in seconds
    FANOFF is the temperature at or below which to turn the fan off, if it’s currently on auto
    FANAUTO is the temperature at or above which to turn the fan to auto, if it’s currently off.
    ==========
    Read all registers:
    sudo perl acer_ec.pl regs
    sudo perl acer_ec.pl regs > test.txt

    Read one register:
    # 51 is the address of the register in hexadecimal
    sudo perl acer_ec.pl ?= 51
    Write value to one register:
    # 51 is the address in hexadecimal of the register to be written, and 0 is the value to write, also in hexadecimal.
    sudo perl acer_ec.pl := 51 0

    Convenient commandline to monitor the temperature. (Register 58 is thought to be CPU temperature, in degrees C):
    This also assumes you’re already root and have made acer_ec.pl executable. eg:
    # Become root
    sudo su -
    # Make the script executable
    chmod a+x acer_ec.pl
    # Read the temperature and display in decimal every 2 seconds
    watch -n 2 'echo Temp: $[$(./acer_ec.pl ?= 58 | cut -f 3 -d" ")] C'

    NB: For this to work, /bin/sh must invoke bash. Usually /bin/sh is a symlink to /bin/bash, but in Ubuntu this is not the default, and as a result the conversion of the temperature from hexadecimal to decimal won’t occur.

    To change /bin/sh to point to /bin/bash, on Ubuntu, as root:
    ln -sfn /bin/bash /bin/sh

    Backup Linux Hard driver image

    Linux does not restrict you from copying anything so use TAR to archive all files in one directory. (next time I will try Ghost)

    1: Backing-up
    sudo su [become a super user]
    cd / [ mvoe to the root directory)
    tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /
    [c: to create a new archive; v: print verbose info on screen; p:preserve permissions'(to keep the same permissions on everything the same); z for file compress, it might not be a good idea to compress files, use it for non critical applicatons. f: file name]
    [make sure you don’t include the file itself, or else you’ll get weird results. You might also not want to include the /mnt folder if you have other partitions mounted there or you’ll end up backing those up too. Also make sure you don’t have anything mounted in /media (i.e. don’t have any cd’s or removable media mounted). Either that or exclude /media.]
    [At the end of the process you might get a message along the lines of ‘tar: Error exit delayed from previous errors’ or something, but in most cases you can just ignore that.]

    2: Restoring
    Make sure you are root and that you and the backup file are in the root of the filesystem.
    WARNING: this will overwrite every single file on your partition with the one in the archive!
    tar xvpfz backup.tgz -C /

    3: Re-create the directories that were excluded:

    • mkdir proc
    • mkdir lost+found
    • mkdir mnt
    • mkdir sys
    • etc…

    And when you reboot, everything should be the way it was when you made the backup!

    4: GRUB restore
    If you installed windows or your GRUB was damaged. then

    1. Pop in the Live CD, boot from it until you reach the Desktop.
    2. Open a terminal window or switch to a tty.
    3. Type “grub”
    4. Type “root (hd0,6)”, or whatever your harddisk + boot partition numbers are (my /boot is at /dev/sda7, which translates to hd0,6 for grub).
    5. Type “setup (hd0)”, ot whatever your harddisk nr is.
    6. Quit grub by typing “quit”.
    7. Reboot.

    How to delete a file by using PHP

    Due to some reason I uploaded a plugin called “wpaudio-mp3-player.2.1.0.zip”, which is a light weight mp3 player, to the wordpress /uploads directory. Looks like my web server do not like the word mp3 anywhere in my file name (you have to pay to get around it). so even though I was able to upload it by a program, I can not just delete it by using a command in my FTP client. The only way I can remove this file is to use PHP unlink function.

    <?php
    $myFile = "wpaudio-mp3-player.2.1.0.zip";
    unlink($myFile);
    ?>

    Save this to a php file and upload it to the same directory that I want the file to be deleted. then run this php, I’m done. Apparently php uses similar syntax to the Unix C unlink() function. Everyone thinks there should be a delete command, php.net even has a delete dummy entry only point to the unlink command.