Installing FreeBSD 7 (i386) on a ThinkPad T43

From ThinkWiki
Revision as of 10:08, 21 September 2008 by Juedan (Talk | contribs) (Tips and Tricks)
Jump to: navigation, search

Features

FreeBSD is an UNIX operating system for x86 and others compatible architectures. It is derived from BSD, the version of UNIX® developed at the University of California, Berkeley. It is developed and maintained by a team of individuals.

FreeBSD offers advanced networking, performance, security and compatibility features which are still missing in some of the best commercial operating systems.

FreeBSD makes an ideal Internet or Intranet server. It provides robust network services under the heaviest loads and uses memory efficiently to maintain good response times for thousands of simultaneous user processes. But on notebooks it is a very usable and a great operating system with many features for power management.

With over 17,000 ported libraries and applications for desktop, server, appliance, and embedded environments. There are many applications which were designed for the use with notebooks.

The best is that FreeBSD is free. On the one side the licence model guaranties that (BSD or BSDL licence) and on the other hand it costs nothing. It is certainly possible to buy CDs or DVDs.


Installation

The best way to install FreeBSD on a ThinkPad T43 is to download the ISO files and burn them. You can find the ISOs right here: FTP Server of FreeBSD. Choose the version you want to install.

Hint:
It is better to choose one of the mirrors which you can find here: List of mirrors


Known Issues

Everythings works like a charme except one thing: Suspend und Resume.

ATTENTION!
Currently suspend and resume works only once. I don't know whether it depends on the operation system or on Gnome powermanagement. Entering # acpiconf -s 3 works perfect.


Post-Installation Setup

After installation of FreeBSD you have to do some additional setup. Most things work out of the box, but some parts need additional configuration.

First of all type dmesg on a console and you will see which hardware is detected from GENERIC kernel:

# dmesg | more

You get an output like the following:

Copyright (c) 1992-2008 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 7.1-PRERELEASE #0: Fri Sep 19 07:11:52 CEST 2008
    juergen@t43.juergendankoweit.net:/usr/obj/usr/src/sys/T43
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel(R) Pentium(R) M processor 1.86GHz (1862.01-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x6d8  Stepping = 8
  Features=0xafe9fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,TM,PBE>
  Features2=0x180<EST,TM2>
  AMD Features=0x100000<NX>
real memory  = 1072562176 (1022 MB)
avail memory = 1040035840 (991 MB)
ACPI APIC Table: <IBM    TP-1Y   >
ACPI Warning (tbfadt-0505): Optional field "Gpe1Block" has zero address or length:        0    102C/0 [20070320]
ioapic0: Changing APIC ID to 1
ioapic0 <Version 2.0> irqs 0-23 on motherboard
kbd1 at kbdmux0
ath_hal: 0.9.20.3 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413)
acpi0: <IBM TP-1Y> on motherboard
acpi0: [ITHREAD]
acpi_ec0: <Embedded Controller: GPE 0x1c, ECDT> port 0x62,0x66 on acpi0
acpi0: Power Button (fixed)
acpi0: reservation of 0, a0000 (3) failed
acpi0: reservation of 100000, 3ff00000 (3) failed
Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1008-0x100b on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib1: <ACPI PCI-PCI bridge> irq 16 at device 1.0 on pci0
pci1: <ACPI PCI bus> on pcib1
vgapci0: <VGA-compatible display> port 0x2000-0x20ff mem 0xc0000000-0xc7ffffff,0xb0100000-0xb010ffff irq 16 at device 0.0 on pci1
drm0: <ATI Radeon Mobility X300 M22> on vgapci0
info: [drm] Initialized radeon 1.25.0 20060524
pcib2: <ACPI PCI-PCI bridge> irq 20 at device 28.0 on pci0
pci2: <ACPI PCI bus> on pcib2
bge0: <Broadcom NetXtreme Gigabit Ethernet Controller, ASIC rev. 0x4101> mem 0xb0200000-0xb020ffff irq 16 at device 0.0 on pci2
miibus0: <MII bus> on bge0
brgphy0: <BCM5750 10/100/1000baseTX PHY> PHY 1 on miibus0
brgphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
bge0: Ethernet address: 00:15:58:30:2a:a3
bge0: [ITHREAD]
pcib3: <ACPI PCI-PCI bridge> irq 22 at device 28.2 on pci0
pci3: <ACPI PCI bus> on pcib3
uhci0: <Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-A> port 0x1800-0x181f irq 16 at device 29.0 on pci0
uhci0: [GIANT-LOCKED]
uhci0: [ITHREAD]
usb0: <Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-A> on uhci0
usb0: USB revision 1.0
uhub0: <Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1> on usb0
uhub0: 2 ports with 2 removable, self powered
uhci1: <Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-B> port 0x1820-0x183f irq 17 at device 29.1 on pci0
uhci1: [GIANT-LOCKED]
uhci1: [ITHREAD]
usb1: <Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-B> on uhci1
usb1: USB revision 1.0
uhub1: <Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1> on usb1
uhub1: 2 ports with 2 removable, self powered
uhci2: <Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-C> port 0x1840-0x185f irq 18 at device 29.2 on pci0
uhci2: [GIANT-LOCKED]
uhci2: [ITHREAD]
usb2: <Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-C> on uhci2
usb2: USB revision 1.0
uhub2: <Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1> on usb2
uhub2: 2 ports with 2 removable, self powered
uhci3: <Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-D> port 0x1860-0x187f irq 19 at device 29.3 on pci0
uhci3: [GIANT-LOCKED]
uhci3: [ITHREAD]
usb3: <Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-D> on uhci3
usb3: USB revision 1.0
uhub3: <Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1> on usb3
uhub3: 2 ports with 2 removable, self powered
ehci0: <Intel 82801FB (ICH6) USB 2.0 controller> mem 0xb0000000-0xb00003ff irq 19 at device 29.7 on pci0
ehci0: [GIANT-LOCKED]
ehci0: [ITHREAD]
usb4: EHCI version 1.0
usb4: companion controllers, 2 ports each: usb0 usb1 usb2 usb3
usb4: <Intel 82801FB (ICH6) USB 2.0 controller> on ehci0
usb4: USB revision 2.0
uhub4: <Intel EHCI root hub, class 9/0, rev 2.00/1.00, addr 1> on usb4
uhub4: 8 ports with 8 removable, self powered
pcib4: <ACPI PCI-PCI bridge> at device 30.0 on pci0
pci11: <ACPI PCI bus> on pcib4
cbb0: <RF5C476 PCI-CardBus Bridge> mem 0xb4010000-0xb4010fff irq 16 at device 0.0 on pci11
cardbus0: <CardBus bus> on cbb0
pccard0: <16-bit PCCard bus> on cbb0
cbb0: [ITHREAD]
ath0: <Atheros 5212> mem 0xb4000000-0xb400ffff irq 21 at device 2.0 on pci11
ath0: [ITHREAD]
ath0: WARNING: using obsoleted if_watchdog interface
ath0: Ethernet address: 00:14:a4:5c:86:b4
ath0: mac 5.9 phy 4.3 radio 3.6
pcm0: <Intel ICH6 (82801FB)> port 0x1c00-0x1cff,0x1880-0x18bf mem 0xb0000800-0xb00009ff,0xb0000400-0xb00004ff irq 22 at device 30.2 on pci0
pcm0: [ITHREAD]
pcm0: <Analog Devices AD1981B AC97 Codec>
isab0: <PCI-ISA bridge> at device 31.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <Intel ICH6M SATA150 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0x18c0-0x18cf at device 31.2 on pci0
ata0: <ATA channel 0> on atapci0
ata0: [ITHREAD]
ata1: <ATA channel 1> on atapci0
ata1: [ITHREAD]
pci0: <serial bus, SMBus> at device 31.3 (no driver attached)
cpu0: <ACPI CPU> on acpi0
est0: <Enhanced SpeedStep Frequency Control> on cpu0
p4tcc0: <CPU Frequency Thermal Control> on cpu0
acpi_lid0: <Control Method Lid Switch> on acpi0
acpi_button0: <Sleep Button> on acpi0
acpi_tz0: <Thermal Zone> on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
atkbd0: [ITHREAD]
psm0: <PS/2 Mouse> flags 0x2000 irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: [ITHREAD]
psm0: model Generic PS/2 mouse, device ID 0
sio0: configured irq 4 not in bitmap of probed irqs 0
sio0: port may not be enabled
sio0: configured irq 4 not in bitmap of probed irqs 0
sio0: port may not be enabled
sio0: <16550A-compatible COM port> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
sio0: type 8250 or not responding
sio0: [FILTER]
sio1: configured irq 3 not in bitmap of probed irqs 0
sio1: port may not be enabled
battery0: <ACPI Control Method Battery> on acpi0
acpi_acad0: <AC Adapter> on acpi0
acpi_ibm0: <IBM ThinkPad ACPI Extras> on acpi0
sio1: configured irq 3 not in bitmap of probed irqs 0
sio1: port may not be enabled
pmtimer0 on isa0
orm0: <ISA Option ROMs> at iomem 0xc0000-0xcffff,0xd1800-0xd27ff,0xdc000-0xdffff,0xe0000-0xeffff pnpid ORM0000 on isa0
ppc0: parallel port not found.
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
sio1: configured irq 3 not in bitmap of probed irqs 0
sio1: port may not be enabled
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
ubt0: <Broadcom IBM Bluetooth Module, class 224/1, rev 1.10/0.09, addr 2> on uhub2
ubt0: Interface 0 endpoints: interrupt=0x81, bulk-in=0x82, bulk-out=0x2
ubt0: Interface 1 (alt.config 4) endpoints: isoc-in=0x83, isoc-out=0x3; wMaxPacketSize=64; nframes=5, buffer size=320
Timecounter "TSC" frequency 1862012116 Hz quality 800
Timecounters tick every 1.000 msec
ad0: 38154MB <HTS541040G9AT00 MB2IA5BJ> at ata0-master UDMA100
acd0: DVDROM <HL-DT-STDVD-ROM GDR8083N/0K04> at ata1-master UDMA33
Trying to mount root from ufs:/dev/ad0s1a
acd0: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00 
cd0 at ata1 bus 0 target 0 lun 0
cd0: <HL-DT-ST DVD-ROM GDR8083N 0K04> Removable CD-ROM SCSI-0 device 
cd0: 33.000MB/s transfers
cd0: Attempt to query device size failed: NOT READY, Medium not present
WARNING: attempt to net_add_domain(bluetooth) after domainfinalize()
WARNING: attempt to net_add_domain(netgraph) after domainfinalize()

As easily can be seen the following for additional setup important components are detected:

Device Type Device Driver Device Name
CPU CPU Intel(R) Pentium(R) M processor 1.86GHz (1862.01-MHz 686-class CPU) Origin = "GenuineIntel" Id = 0x6d8 Stepping = 8
Memory RAM real memory = 1072562176 (1022 MB), avail memory = 1040035840 (991 MB)
LAN controller bge0 Broadcom NetXtreme Gigabit Ethernet Controller BCM5750 10/100/1000baseTX
WLAN controller ath0 Atheros 5212
(S)ATA controller atapci0 Intel ICH6M SATA150 controller
sound device pcm0 Intel ICH6 (82801FB): Analog Devices AD1981B AC97 Codec
USB controller uhcin Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-N (n: 1...4, N: A...D)
CardBus controller cbb0 RF5C476 PCI-CardBus Bridge
Bluetooth device ubt0 Broadcom IBM Bluetooth Module, class 224/1, rev 1.10/0.09, addr 2 on uhub2
video controller drm0 ATI Radeon Mobility X300 M22
harddrive ad0 38154MB <HTS541040G9AT00 MB2IA5BJ> at ata0 master UDMA100
optical drive acd0 DVDROM <HL-DT-STDVD-ROM GDR8083N/0K04> at ata1 master UDMA33


General System Settings

The general system settings are done in my case in the following files:

/boot/loader.conf
In this file you enter modules and settings which must be loaded or set before the kernel is loaded.
/boot/device.hints
Here you can modify device settings and turn on or off devices
/etc/rc.conf
This file is called by the FreeBSD init subsystem. All daemons which should be started and additional settings for these daemons are done done in this file
/etc/sysctl.conf
In this file all settings are done which manipulate deverse kernel parameters
/etc/devd.conf
This file configurates the behavior of the devd device state change daemon
ATTENTION!
The following sections describe how I was able to get everything to work. These are only hints. I am not responsible for any damages which were caused through these settings. You are responsible for yourself what you are doing!

The following sections describe the parameters for each component.


ACPI

This section is the most difficult part of the description.

ACPI stands for Advanced Configuration and Power Interface which defines common interfaces for hardware recognition, motherboard and device configuration and power management. FreeBSD and ACPI is difficult relationship: either it works or it works not. But it is on the way getting better.

It costs a lot of time to get ACPI to work. Therefore a small hint if you want to do it on your own: When you are doing some configuration and testing on your ACPI settings then you will soon recognize that the notebook will be inaccessable and have to press the Power button. The system does not have any chance to shutdown the filesystem and this will result that at every boot the filesystem must be checked and corrected. Therefore it is a good idea to manipulate the mount table /etc/fstab like the following example:

# Device	Mountpoint	FStype	Options		Dump	Pass#
/dev/ad0s1b	none		swap	sw		0	0
/dev/ad0s1a	/		ufs	rw		1	1
# /dev/ad0s1g	/home		ufs	rw		2	2
/dev/ad0s1d	/tmp		ufs	ro		2	2
/dev/ad0s1f	/usr		ufs	ro		2	2
/dev/ad0s1e	/var		ufs	ro		2	2
# /dev/acd0	/cdrom		cd9660	ro,noauto	0	0
proc		/proc		procfs	rw		0	0
linprocfs	/compat/linux/proc	linprocfs	rw	0	0

The readonly option for the mount command prevents the corruption of the filesystem. If there are important files on your home partition then it is better not to mount it. When everthing works for your satifaction then you can restore the old state of the mount table.

To make ACPI work under FreeBSD the following files have to be edited:

/boot/loader.conf
Add the following line for loading the module acpi_ibm.mo to enable the Thinkpad specific functions like Thinkpad keys:
acpi_ibm_load="YES"
This module can also be loaded directly from the console. For this use the command
# kldload acpi_ibm
/boot/device.hints
Search for the lines which sets the parameters for the mouse driver. They look like these:
hint.psm.0.at="atkbdc"
hint.psm.0.irq="12"
Add or change the flags to this value:
hint.psm.0.flags="0x2000"
This enables the mouse daemon after resume.
/etc/sysctl.conf
In this file the diverse ACPI states have to connected to several events:
hw.acpi.reset_video=1
hw.acpi.lid_switch_state=S3
hw.acpi.sleep_button_state=S3
hw.acpi.power_button_state=S5
hw.acpi.sleep_delay=3
hw.acpi.verbose=1
You also have to enable the Thinkpad buttons with
dev.acpi_ibm.0.events=1
When the notebook resumes after a suspend call it is very likely that the display shows nothing or only rubbish. The reason is that the video controller is not in an defined state. It does not know whether it should display the textmode or the graphics mode. Therefore the switching to the textmode must be enabled:
hw.syscons.sc_no_suspend_vtswitch=0
This values can also be changed directly from the console. For this use the command
# sysctl <mib>
where mib represents each line of /etc/sysctl.conf.
/etc/devd.conf
With device change state daemon it is possible to react on changes in the device state. This can be used for calling the suspend mode. For this the following lines have to be added to the configuration file:
notify 10 {
	match "system" "ACPI";
	match "subsystem" "IBM";
	match "notify" "0x04";
	action "/usr/sbin/acpiconf -s 3";
};
After this the devd daemon has to be restarted:
# /etc/rc.d/devd restart

After changing all these files or values you can do some tests. Hopefully these tests are successful.


Video

On my Thinkpad I use the following XOrg version:

  • X.Org Version 7.3
  • X.Org X Server 1.4.0
  • Release Date: 5 September 2007

Setting up XOrg is very easy and can be done in a few minutes. For this enter on the console # X -configure This will create a configuration file based on the hardware Xorg has found. This file should be copied to /etc/X11/xorg.conf after the changes were made.

ATTENTION!
It is very important to disable DRI (direct rendering interface) because DRI is responsible for system crashes when calling suspend or resume. Therefore the line Option "DRI" "FALSE" in the section Section "Device", Identifier "T43Card" is highly recommended!

Here is my working XOrg configuration:

Section "ServerLayout"
	Identifier     "X.org Configured"
	Screen      0  "T43Screen" 0 0
	InputDevice    "T43Mouse" "CorePointer"
	InputDevice    "T43Keyboard" "CoreKeyboard"
EndSection

Section "Files"
	RgbPath     "/usr/local/share/X11/rgb"
	ModulePath  "/usr/local/lib/xorg/modules"
	FontPath    "/usr/local/lib/X11/fonts/misc/"
	FontPath    "/usr/local/lib/X11/fonts/TTF/"
	FontPath    "/usr/local/lib/X11/fonts/OTF"
	FontPath    "/usr/local/lib/X11/fonts/Type1/"
	FontPath    "/usr/local/lib/X11/fonts/StarType"
	FontPath    "/usr/local/lib/X11/fonts/100dpi/"
	FontPath    "/usr/local/lib/X11/fonts/75dpi/"
EndSection

Section "Module"
	Load        "GLcore"
	Load        "dbe"
	Load        "dri"
	Load        "extmod"
	Load        "glx"
	Load        "record"
	Load        "xtrap"
	Load        "freetype"
	Load        "type1"
EndSection

Section "InputDevice"
	Identifier  "T43Keyboard"
	Option      "XKBLayout" "de"
	Driver      "kbd"
EndSection

Section "InputDevice"
	Identifier  "T43Mouse"
	Driver      "mouse"
	Option	    "Protocol" "auto"
	Option	    "Device" "/dev/sysmouse"
	Option	    "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
	Identifier  "T43Monitor"
	VendorName  "IBM"
	ModelName   "TFT-Thinkpad T43"
	Option      "DPMS" "TRUE"
	Modeline    "1024x768" 56.00  1024 1072 1104 1184  768 771 775 790 +hsync -vsync
	DisplaySize 285 213
EndSection

Section "Device"
	Identifier  "T43Card"
	Driver      "radeon"
	VendorName  "ATI Technologies Inc"
	BoardName   "M22 [Mobility Radeon X300]"
	BusID       "PCI:1:0:0"
        Option      "AGPMode" "1"
        Option      "DynamicClocks" "TRUE"
        Option      "VGAAccess" "TRUE"
        Option      "DRI" "FALSE"
	Option      "PanelSize" "1024x768"
	Option      "DDCMode" "TRUE"
	Option      "MonitorLayout" "LVDS"
	Option      "EnablePageFlip" "TRUE"
	Option      "VBERestore" "TRUE"
	Option      "DevicePresence" "TRUE"
#	 Option      "BIOSHotkeys" "ON"
EndSection

Section "Screen"
	Identifier "T43Screen"
	Device     "T43Card"
	Monitor    "T43Monitor"
	DefaultDepth 24
	SubSection "Display"
		Viewport   0 0
		Modes      "1024x768"
		Depth      24
	EndSubSection
EndSection


Network

The configuration of the LAN device Broadcom Ethernet Controller BCM5750 (bge0) is very easy and it is in a few minutes done.

Network with DHCP
In this case in the system wide configuration file /etc/rc.conf only these entries have to be inserted:
hostname="t43.domain.tld"
ifconfig_bge0="DHCP"
That's it
Network without DHCP
Here you have to insert in the file /etc/rc.conf the IP address of the notebook, the fully qualified hostname and the default router:
hostname="t43.domain.tld"
defaultrouter="<IP address of the router>"
ifconfig_bge0="<IP address of the notebook>"

If the notebook is used in an network with wireless LAN the following lines describe how to do a setup of the WLAN card.

TODO
The setup around the Atheros card (ath0) can be done, when my new WLAN is configured


Bluetooth

Bluetooth works under FreeBSD well. It depends on which devices you use. Generally one line has to be added to /boot/loader.conf:

ng_ubt_load="YES"

This enables the Bluetooth stack for other drivers and daemon processes.

In my case I use an Siemens S55 mobile phone. Therefore the following three lines enabling a communication with the mobile:

hcsecd_enable="YES"
sdpd_enable="YES"
bluetooth_enable="YES"
TODO
Description of the entries and a small startup script for establishing a connect to mobile phone


Sound

For enabling the sound card only one line in /boot/loader.conf has to be added:

snd_ich_load="YES"

Now the sound card can do its job.


Gnome Desktop

Applications

Applets

Additional Hardware

In this section some interesting hardware for the ThinkPad T43 is shown. It is tested under FreeBSD and works perfect.

Adaptec SCSI-Card

A few years ago Adaptec has developed a PCCard for connecting SCSI devices to the notebook. It is called Adaptec SlimSCSI 1460D. This PCCard is recognized correctly from FreeBSD and the device driver aic1 is responsible for that piece of hardware. The card can be changed during a session without restarting the whole system.

NOTE!
The Adaptec SlimSCSI 1460 adapter has to be inserted in the lower slot of the two PCCard/PCMCIA slots!

Here a short excerpt of the system logfile /var/log/messages:

inserting the card
Sep 20 17:24:24 t43 kernel: aic1: <Adaptec, Inc. APA-1460 SCSI Host Adapter> at port 0x340-0x35f irq 16
                                  function 0 config 9 on pccard0
Sep 20 17:24:24 t43 kernel: aic1: AIC6360, dma, disconnection, parity check, fast SCSI
Sep 20 17:24:24 t43 kernel: aic1: [GIANT-LOCKED]
Sep 20 17:24:24 t43 kernel: aic1: [ITHREAD]
removing the card
Sep 20 17:25:34 t43 kernel: aic1: detached

It is an interesting option for backup solutions. So it is possible to connect an tape streamer or DVD-RAM drive (e.g. Panasonic LF-D201, 4,7GB single sided, 9,4GB double sided).

Tips and Tricks

In this section some tips and tricks are described.

Thinkpad buttons

In the section about ACPI the key pair Fn + F4 was used to switch to suspend mode. The other interesting key pair is Fn + F5 which enables or disables the buildin Bluetooth device. Instead of writing for each function a separate script it is better to have one script which execute all functions.

To get the script run you must modify the entry in /etc/devd.conf:

notify 10 {
	match "system" "ACPI";
	match "subsystem" "IBM";
	action "/usr/sbin/acpi_keys.sh $notify ibm";
};

Here is the (extendable) script with the name /usr/sbin/acpi_keys.sh:

#!/bin/sh
#

# Check if all parameters are set
if [ "$1" = "" -o "$2" = "" ]
then
	echo "usage: $0 notify oem_name"
	exit 1
fi

# storing the parameters in variables
NOTIFY=`echo $1`
OEM=$2

# for easier modification set some variables to system commands
LOGGER="/usr/bin/logger"
SYSCTL="/sbin/sysctl"
ACPICONF="/usr/sbin/acpiconf"

# start scripts for bluetooth
# important: set all to "YES" in /etc/rc.conf!

# hcsecd_enable="YES"
HCSECD_ENABLE="/etc/rc.d/hcsecd start"
HCSECD_DISABLE="/etc/rc.d/hcsecd stop"

# sdpd_enable="YES"
SDPD_ENABLE="/etc/rc.d/sdpd start"
SDPD_DISABLE="/etc/rc.d/sdpd stop"

# bluetooth_enable="YES"
BT_ENABLE="/etc/rc.d/bluetooth start ubt0"
BT_DISABLE="/etc/rc.d/bluetooth stop ubt0"

# check which key was pressed
case ${NOTIFY} in
	0x04)
		# suspend/resume key Fn + F4
		MESSAGE="ACPI mode S3 activated"
		${ACPICONF} -s 3
		;;
	0x05)
		# bluetooth on/off key Fn + F5
		LEVEL=`sysctl -n dev.acpi_${OEM}.0.bluetooth`
		if [ "$LEVEL" = "1" ]
		then
			${MOBILE_DISABLE}
			${HCSECD_DISABLE}
			${SDPD_DISABLE}
			${BT_DISABLE}
			${SYSCTL} dev.acpi_${OEM}.0.bluetooth=0
			MESSAGE="bluetooth disabled"
		else
			${SYSCTL} dev.acpi_${OEM}.0.bluetooth=1
			MESSAGE="bluetooth enabled"
			sleep 2
			${HCSECD_ENABLE}
			${SDPD_ENABLE}
			${BT_DISABLE} # reinitialize BT stack
			${BT_ENABLE}
		fi
		;;
	*)
		;;
esac

# log all activities to syslog (/var/log/messages)
${LOGGER} ${MESSAGE}

exit 0

See also

References

The following man pages are important for understanding:

External links