Thursday, February 21, 2008

Install Fedora 8 in Thinkpad T60

The whole process was extremely simple and smooth. You can find a lot information about how-to install Fedora on laptops. The following are some information that I found are quite useful but missed in standard installation instructions.

  1. Install ATI driver and enable compiz-fusion
  2. Install pdftk
  3. Install Mac4lin
  4. Enable full function of Keyboard
  5. Power management 'acpi' configuratio
OK, I am going to start with step 4, since step 1,2 and 3 were already done. I'll add these steps when I have spare time which I rarely have :-(
  1. n/a
  2. n/a
  3. n/a
  4. IBM hotkeys
    First, make sure you have the thinkpad-acpi module loaded (which you
    should):
    lsmod | grep thinkpad (look for thinkpad-acpi in the output)
    By default, FC7 will switch to low power mode when the lid is
    closed. I don't like that. I simply want the screen turned off
    when the lid is closed and back on when it's open. To do this,
    follow these steps:
    a. Go to /etc/acpi/events/
    b. Edit a-lid-aticonfig.conf and comment out the line
    that start with event= (Add a #-symbol at
    the beginning of that line). This will disable the
    default lid behavior
    c. Add the following line at the end of the file:
    action=/etc/acpi/actions/lid
    (This will redirect the event to our own custom script)
    d. Go to /etc/acpi/actions/
    e. Create a file named lid with the following lines:
    #!/bin/bash
    # Check LID state
    export XAUTHORITY=/var/gdm/\:0.Xauth
    if grep -q open /proc/acpi/button/lid/LID/state
    then
    /etc/acpi/actions/screen_on.sh
    else
    /etc/acpi/actions/screen_off.sh
    fi
    f. Create a file screen_on.sh with
    #!/bin/sh
    /usr/bin/xset -display :0 dpms force on
    g. Create a file screen_off.sh with
    #!/bin/sh
    /usr/bin/xset -display :0 dpms force off
    h. Set proper permissions
    chmod 755 lid
    chmod 755 screen_on.sh
    chmod 755 screen_off.sh

    Additionally, I like to be able to switch on and off the screen
    by pressing Fn+F3. To do this we first have to enable the IBM
    hotkeys by doing:
    echo enable > /proc/acpi/ibm/hotkey
    This will signal your laptop to generate acpi events whenever
    Fn+F3 (or any other Fn+FX key combination) is pressed. Include
    the line above in your /etc/rc.d/rc.local so that it is enabled
    at boot time. Now we have to create handlers for the Fn+F3
    hotkey. Go to /etc/acpi/events/ and create the file FnF3.conf
    # ACPI Configuration to execute action when pressing Fn+F3
    event=ibm/hotkey HKEY 00000080 00001003
    action=/etc/acpi/actions/FnF3.sh

    Now go to /etc/acpi/actions/ and create FnF3.sh, as follows
    #!/bin/bash
    export XAUTHORITY=/var/gdm/\:0.Xauth
    # Check if working on single or dual mode
    Mode="single"
    LCDgrep=`aticonfig --query-monitor | grep Connected | grep lvds`
    CRTgrep=`aticonfig --query-monitor | grep Connected | grep crt1`
    if [ "$LCDgrep" != "" ] && [ "$CRTgrep" != "" ]; then
    Mode="dual"
    fi
    if [ $Mode == "single" ]; then
    # Turn off screen
    /etc/acpi/actions/screen_off.sh
    else
    # Cycle screens
    /etc/acpi/actions/FnF3_dual.sh
    fi

    This will check if we're working on the LCD screen alone (single
    mode) or if we have both the screen and an external monitor
    connected (dual mode). If it's single mode, Fn+F3 will simply
    turn off the screen. If it's dual mode, then Fn+F3 will cycle
    between various states when the LCD and the monitor are
    alternatively turned on and off. For this scheme to work, you
    need the following FnF3_dual.sh file in /etc/acpi/actions/:

    #!/bin/bash
    # Cycle turning on/off monitors

    LCD="off"
    CRT="off"
    LCDgrep=`aticonfig --nobackup --query-monitor | grep Enabled | grep lvds`
    if [ "$LCDgrep" != "" ]; then
    LCD="on"
    fi
    CRTgrep=`aticonfig --nobackup --query-monitor | grep Enabled | grep crt1`
    if [ "$CRTgrep" != "" ]; then
    CRT="on"
    fi

    echo "LCD screen is $LCD. External screen is $CRT"

    if [ "$LCD" == "on" ] && [ "$CRT" == "on" ]; then
    # Turn on external monitor and off LCD
    echo "Turning off LCD, keeping external screen on"
    /usr/bin/aticonfig --nobackup --enable-monitor=crt1
    fi

    if [ "$LCD" == "off" ] && [ "$CRT" == "on" ]; then
    # Turn on LCD and off external monitor
    echo "Turning LCD on and external screen off"
    /usr/bin/aticonfig --nobackup --enable-monitor=lvds
    fi

    if [ "$LCD" == "on" ] && [ "$CRT" == "off" ]; then
    # Turn off external monitor and LCD
    echo "Turning off both LCD and external screen"
    /usr/bin/aticonfig --nobackup --enable-monitor=crt1,lvds
    /etc/acpi/actions/screen_off.sh
    fi

    if [ "$LCD" == "off" ] && [ "$CRT" == "off" ]; then
    # Turn on external monitor and LCD
    echo "Turning on both LCD and external screen"
    /usr/bin/aticonfig --nobackup --enable-monitor=crt1,lvds
    fi

    Don't forget to set appropriate permissions for these files:
    chmod 755 FnF3.sh
    chmod 755 FnF3_dual.sh


    Now let's create a suspend event and action script. Go to
    /etc/acpi/events/ and create this FnF4.conf file:
    # ACPI Configuration to execute action when pressing Fn+F4
    event=ibm/hotkey HKEY 00000080 00001004
    action=/etc/acpi/actions/suspend.sh
    Now put this script in /etc/acpi/actions/suspend.sh
    #!/bin/sh

    # remove USB 1.1 driver
    rmmod uhci_hcd

    # sync filesystem and clock
    sync
    /sbin/hwclock --systohc

    # switch to console
    FGCONSOLE=`fgconsole`
    chvt 6
    #/usr/sbin/radeontool light off
    /usr/sbin/vbetool dpms suspend

    # go to sleep
    #sleep 5 && echo -n "mem" > /sys/power/state
    echo -n "mem" > /sys/power/state

    # readjust the clock (it might be off a bit after suspend)
    /sbin/hwclock --adjust
    /sbin/hwclock --hctosys

    And set execute permissions with
    chmod 755 suspend.sh

    WARNING: At the time of writing this there seems to be a bug
    in the current kernel version 2.6.22 that makes my computer freeze
    during suspend. If you do a echo -n "mem" > /sys/power/state it
    freezes after the "Suspending console(s)" message. One can only hope
    that this will get fixed soon and then suspend will work again.Disable horizontal scrolling in the touchpad to act like BACK
    button in Firefox:

    Open Firefox and type about:config in the URL window
    In the filter field, enter mousewheel
    Set
    mousewheel.horizscroll.withnokey.action to 0
    mousewheel.horizscroll.withnokey.sysnumlines to true

No comments: