User:Profilek

From ThinkWiki
Jump to: navigation, search

I own Lenovo ThinkPad x60s. Using Gentoo Linux I managed to have (thank to thinkwiki and Forums Gentoo) fully working notebook under Linux:

  • net (e1000, ipw3945),
  • bluetooth,
  • dri - including compiz and beryl with xfce, however on battery I recommend something like Fluxbox w/o dri,
  • suspend-to-ram (Forest Zhao patches for AHCI: 1,2,3,4,5,6),
  • suspend-to-disk (suspend2.net),
  • fingerprint,
  • hdaps,
  • extra keys (Fn+F?).

The issues which are annoying for me in Lenovo Linux support are:

  • much lower battery efficiency (Windows around 4h to 2.2h under Linux),
  • power drain for usb driver (bye bye fingerprint on battery),
  • higher temperatures running Linux (hence I hear the fan - quite silently but still you can hear it).

I wrote script for ipw3945d daemon. It handles loading and unloading the modules. Such behavior helps because sometimes in order to make wifi reassociate one needs to reload the modules. The script assumes that the wifi is eth1. /etc/init.d/ipw3945d

PIDFILE=/var/run/ipw3945d/ipw3945d.pid

depend() {
       before net
}

start() {
   ebegin "Starting ipw3945d"
   wifi_state=`grep '0x40:' /proc/acpi/ibm/ecdump | sed 's/  /-/g' | sed 's/\*/-/g' | cut -d '-' -f  10`
   if [ $wifi_state == "02" ];
   then 
       if  lsmod | grep -q ^ipw3945; 
       then 
           ebegin "Reloading modules"
           /sbin/modprobe -r --quiet ipw3945 ieee80211_crypt_wep ieee80211_crypt_tkip ieee80211_crypt_ccmp ieee80211 ieee80211_crypt
           /sbin/modprobe --quiet ipw3945
           eend ${?}
       else 
           ebegin "Loading modules"
           /sbin/modprobe --quiet ipw3945
           eend ${?}
       fi
       sleep 2
       start-stop-daemon --start --exec /sbin/ipw3945d --pidfile ${PIDFILE} -- \
                   --pid-file=${PIDFILE} ${ARGS}
       eend ${?}
   else
      ewarn "    Please switch on the wireless -- kill switch on" 
      eend 1
fi;
}

stop() {
   ebegin "Stopping ipw3945d"
   /etc/init.d/net.eth1 stop
   start-stop-daemon --stop --exec /sbin/ipw3945d --pidfile ${PIDFILE}
   /sbin/modprobe -r --quiet ipw3945 ieee80211_crypt_wep ieee80211_crypt_tkip ieee80211_crypt_ccmp ieee80211 ieee80211_crypt
   eend ${?}
}

For this script one can add acpid actions and events scripts. It uses experimental feature of ibm-acpi module. What is different than the other script it does not need to have ipw3945 module loaded and running ipw3945d daemon, instead, it checks /proc/acpi/ibm/ecdump if the kill switch is on or off. This helps in power saving (wifi drains 4W :-). /etc/acpi/actions/radio

#!/bin/bash 
wifi_state=`grep '0x40:' /proc/acpi/ibm/ecdump | sed 's/  /-/g;s/\*/-/g' | cut -d '-' -f 10`

#echo "wifi is in " $wifi_state
if [ $wifi_state == "02" ];
then 
    /etc/init.d/ipw3945d --quiet start; 
else 
    /etc/init.d/ipw3945d --quiet stop; 
fi;

/etc/acpi/events/radio

event=ibm/hotkey HKEY 00000080 00007000
action=/etc/acpi/actions/radio

Don't forget to set proper permissions for /etc/acpi/actions/radio.