Difference between revisions of "Installing Fedora 11 on a ThinkPad T60"
(add T60p, newer stuff, ultrabay eject) |
|||
Line 1: | Line 1: | ||
{{NOTE|This is based on the x86-64 pre-release version of Fedora 11, but should give a good indication of what to expect of the final release}} | {{NOTE|This is based on the x86-64 pre-release version of Fedora 11, but should give a good indication of what to expect of the final release}} | ||
+ | |||
+ | {{NOTE|ThinkPad T60p is reported here as well}} | ||
== Success Chart == | == Success Chart == | ||
Line 17: | Line 19: | ||
| Laptop Screen || {{Cyes}} || only 1 video mode available | | Laptop Screen || {{Cyes}} || only 1 video mode available | ||
|- | |- | ||
− | | VGA || {{Cyes}} || with hotplug only | + | | VGA || {{Cyes}} || with hotplug only ? |
|- | |- | ||
− | | DVI || {{Cyes}} || with hotplug only | + | | DVI || {{Cyes}} || with hotplug only ? |
|- | |- | ||
|rowspan=3|Display - ATI | |rowspan=3|Display - ATI | ||
− | | Laptop Screen || {{ | + | | Laptop Screen || {{Cyes}} || everything works, including rotation |
|- | |- | ||
− | | VGA || {{ | + | | VGA || {{Cyes}} || everything works, including rotation and mirroring |
|- | |- | ||
− | | DVI || {{Cunk}} || | + | | DVI || {{Cunk}} (should work) || no reason this wouldn't work |
|- | |- | ||
|rowspan=2|Power Management | |rowspan=2|Power Management | ||
Line 37: | Line 39: | ||
|rowspan=5| Wireless || WiFi - Atheros|| {{Cyes}} || occasional disconnect/reconnect | |rowspan=5| Wireless || WiFi - Atheros|| {{Cyes}} || occasional disconnect/reconnect | ||
|- | |- | ||
− | | WiFi - Intel|| {{ | + | | WiFi - Intel|| {{Cyes}} || no problems at all |
|- | |- | ||
| Bluetooth || {{Cyes}} || | | Bluetooth || {{Cyes}} || | ||
Line 62: | Line 64: | ||
| USB || {{Cyes}} || | | USB || {{Cyes}} || | ||
|- | |- | ||
− | | PCMCIA/Cardbus || {{Cyes}} || | + | | PCMCIA/Cardbus || {{Cyes}} || even ATA adaptors (for CF cards, etc) now work! |
|- | |- | ||
| colspan=2| Harddisk Active Protection || {{Cno}} || | | colspan=2| Harddisk Active Protection || {{Cno}} || | ||
|- | |- | ||
− | | colspan=2| Ultrabay device hotswap || {{ | + | | colspan=2| Ultrabay device hotswap || {{Cpart}} || see below, use with |
+ | caution out of the box | ||
|- | |- | ||
| colspan=2| Fingerprint reader || {{Cunk}} (should work)|| F11 has standard support for Fingerprint readers | | colspan=2| Fingerprint reader || {{Cunk}} (should work)|| F11 has standard support for Fingerprint readers | ||
Line 76: | Line 79: | ||
= Tested and Verified on Fedora 11 = | = Tested and Verified on Fedora 11 = | ||
− | Information in this section has been tested and verified using Fedora 11. | + | Information in this section has been tested and verified using Fedora 11, including the pre-release (post-beta) version. The development version of Fedora 11 (rawhide) is quite stable and even suitable for day-to-day use, if you are a bit brave. You will be automatically switched over to the release version of Fedora 11 if you keep everything up to date. |
== Installation == | == Installation == | ||
Line 88: | Line 91: | ||
Fedora 11 uses KMS (Kernel Mode Setting) by default, which for now has some up and down sides for external displays. | Fedora 11 uses KMS (Kernel Mode Setting) by default, which for now has some up and down sides for external displays. | ||
− | The down sides are that external displays attached during boot might not function properly, but they do when hot plugged afterwards. Another down side is that currently mirror mode is very limited as the ThinkPad LCD (LVDS) is limited to one single display mode, so only if the external display supports this same mode can you activate mirror mode. On the other hand with KMS enabled the maximum virtual display size is now 4096x4096 (2048x2048 without KMS) meaning you can have an extended desktop. | + | The down sides are that external displays attached during boot might not function properly (mostly they may have non-optimal resolution), but they do when hot plugged afterwards. Another down side is that currently mirror mode is very limited as the ThinkPad LCD (LVDS) is limited to one single display mode, so only if the external display supports this same mode can you activate mirror mode. On the other hand with KMS enabled the maximum virtual display size is now 4096x4096 (2048x2048 without KMS) meaning you can have an extended desktop. |
These issues have been reported to Red Hat bugzilla. | These issues have been reported to Red Hat bugzilla. | ||
+ | |||
+ | On a T60p, displays work well, with multiple mirrored and non-mirrored displays and even with one of the displays being rotated! This may also work on a base T60, as there has been a lot of effort put into getting this to work right. | ||
+ | |||
+ | One thing that still doesn't work quite right is screensavers and screen blanking. There is something wrong with the timers, which may result in your screen blanking while you are typing. Recovery is a simple as waiting until the screen is completely blank and then type or click to wake up the screen. | ||
+ | |||
+ | Another thing that doesn't work quite right is screen resolution when booting with multiple screens. If one screen doesn't not have a preferred resolution, a poor resolution may be used for both screens during the booting process. Everything works fine after login, however. | ||
+ | |||
==== Desktop Effects ==== | ==== Desktop Effects ==== | ||
− | Compiz (wobbly windows, desktops on a cube) seems to work | + | Compiz (wobbly windows, desktops on a cube) seems to work. Direct display of video may be problematic with Compiz, however. |
=== dpi === | === dpi === | ||
− | On the 1400x1050 LCD Fedora comes up with a DPI of 124. While this is correct for the physical screen size, it waists a lot of screen real estate. | + | On the 1400x1050 (and 1600x1200) LCD Fedora comes up with a DPI of 124 (or higher). While this is correct for the physical screen size, it waists a lot of screen real estate. |
− | To change to the more typical 96 DPI, go to System -> Preferences -> Appearance. Now in Appearance Preferences select the Fonts tab and press the "Details ..." button. Here you can change the dots per inch to 96. | + | To change to the more typical 96 DPI, go to System -> Preferences -> Appearance. Now in Appearance Preferences select the Fonts tab and press the "Details ..." button. Here you can change the dots per inch to 96. Of course, many things will shrink, but that is what you wanted, after all. |
=== Wireless Network === | === Wireless Network === | ||
Line 103: | Line 113: | ||
Both the Intel and Atheros wireless should work out of the box. | Both the Intel and Atheros wireless should work out of the box. | ||
− | Atheros was tested and works, but you may encounter occasional disconnects and reconnects. Intel wireless | + | Atheros was tested and works, but you may encounter occasional disconnects and reconnects. Intel wireless also works. |
=== ThinkPad keys === | === ThinkPad keys === | ||
Line 120: | Line 130: | ||
| Fn-F5 || wireless || thinkpad_acpi || {{Cyes}} || {{Cpart}} || No default action, but can be associated with gnome-keybinding-properties | | Fn-F5 || wireless || thinkpad_acpi || {{Cyes}} || {{Cpart}} || No default action, but can be associated with gnome-keybinding-properties | ||
|- | |- | ||
− | | Fn-F7 || videomode || thinkpad_acpi || {{Cyes}} || {{Cyes}} || | + | | Fn-F7 || videomode || thinkpad_acpi || {{Cyes}} || {{Cyes}} || Cycles through only LCD, only external, both (mirrored), and both (non-mirrored) |
|- | |- | ||
| Fn-F8 || mouse input select || thinkpad_acpi || {{Cyes}} || {{Cpart}} || No default action, but can be associated with gnome-keybinding-properties | | Fn-F8 || mouse input select || thinkpad_acpi || {{Cyes}} || {{Cpart}} || No default action, but can be associated with gnome-keybinding-properties | ||
Line 128: | Line 138: | ||
| Fn-F12 || hibernate || acpi button|| {{Cyes}} || {{Cpart}} || does the same as Fn-F4 (suspend), not hibernate | | Fn-F12 || hibernate || acpi button|| {{Cyes}} || {{Cpart}} || does the same as Fn-F4 (suspend), not hibernate | ||
|- | |- | ||
− | | Fn-Home || brightness up || acpi video || {{Cyes}} || {{Cyes}} || | + | | Fn-Home || brightness up || acpi video || {{Cyes}} || {{Cyes}} || includes on-screen display of brightness level |
|- | |- | ||
− | | Fn-End || brightness down || acpi video || {{Cyes}} || {{Cyes}} || | + | | Fn-End || brightness down || acpi video || {{Cyes}} || {{Cyes}} || includes on-screen display of brightness level |
|- | |- | ||
| Fn-PgUp || thinklight || - || {{Cno}} || {{Cyes}} || changing thinkpad_acpi hotkey_mask, causes HAL events. No OSD in any case. | | Fn-PgUp || thinklight || - || {{Cno}} || {{Cyes}} || changing thinkpad_acpi hotkey_mask, causes HAL events. No OSD in any case. | ||
Line 162: | Line 172: | ||
| Dock || Dock eject button || acpi dock || {{Cyes}} || {{Cpart}} || causes unload of USB devices (including internal BlueTooth!!) and switch to battery mode. Does not restore video to ThinkPad only. Causes HAL event, but not a button event. | | Dock || Dock eject button || acpi dock || {{Cyes}} || {{Cpart}} || causes unload of USB devices (including internal BlueTooth!!) and switch to battery mode. Does not restore video to ThinkPad only. Causes HAL event, but not a button event. | ||
|- | |- | ||
− | | Ultrabay || Ultrabay eject switch || | + | | Ultrabay || Ultrabay eject switch || ??? || {{Cno}} || {{Cpart}} || causes a udev event, which can be handled as in [How to hotswap Ultrabay devices], with minor changes, but should be handled better |
|- | |- | ||
− | | Radio switch || Radio kill switch || || {{Cyes}} || {{ | + | | Radio switch || Radio kill switch || || {{Cyes}} || {{Cyes}} || previous comment on Bluetooth only may be a result of networkmanager keeping information around - however integration with networkmanager and bluetooth applet is not complete |
|- | |- | ||
|} | |} | ||
− | = Untested on Fedora 11 = | + | === Ultrabay === |
+ | |||
+ | The Ultrabay has some glitches out of the box with respect to hotswapping. It is possible to lock the machine when pulling out devices, even the CD/DVD device. | ||
+ | |||
+ | The culprit is that the Ultrabay pre-eject switch is not hooked into anything useful. It does cause udev events, but nothing is listening for them. When a device that has a mounted partition or CD is actually pulled out it is too late to do the right thing. Fedora 11 will usually just complain, sometimes bitterly, but may also lock up for some unknown reason, even if just pulling out a CD/DVD device with a mounted CD. | ||
+ | |||
+ | Manually unmounting before removal will help. Manual powering down may also be required for correct performance. | ||
+ | |||
+ | A better solution is to set up a udev rule and script to handle the pre-eject switch event for Ultrabay devices that have mountable things in them as in [How to hotswap Ultrabay devices]. | ||
+ | |||
+ | The revised solution here works well. Pushing the pre-eject switch either does the unmounting and powering off and then emits a low beep, or fails and then emits a triple beep. After success the device can be safely removed or the eject lever can be pushed back and everything will be remounted. After failure pusing the eject lever back in does nothing, permitting continuing as if nothing happened or allowing changes to be made before the next attempt to remove. | ||
+ | |||
+ | Unfortunately the code below is complex and may be fragile. A better solution would be very useful. | ||
+ | |||
+ | To set this solution up, first | ||
+ | create the file /etc/udev/rules.d/50-ibm-ultrabay.rules | ||
+ | |||
+ | <pre> | ||
+ | ls -lZ /etc/udev/rules.d/50-ibm-ultrabay.rules | ||
+ | -rw-r--r--. root root system_u:object_r:etc_runtime_t:s0 /etc/udev/rules.d/50-ibm-ultrabay.rules | ||
+ | cat /etc/udev/rules.d/50-ibm-ultrabay.rules | ||
+ | ENV{BAY_EVENT}=="3", ACTION=="change", SUBSYSTEM=="scsi", RUN+="/usr/local/sbin/ultrabay_eject" | ||
+ | </pre> | ||
+ | |||
+ | Then create the executable file /usr/local/sbin/ultrabay_eject | ||
+ | <pre> | ||
+ | #!/bin/bash | ||
+ | |||
+ | ULTRABAY_SYSDIR=/sys$DEVPATH | ||
+ | shopt -s nullglob | ||
+ | logger ultrabay_eject storage device $DEVPATH | ||
+ | |||
+ | # Umount the filesystem(s) backed by the given major:minor device(s) | ||
+ | unmount_rdev() { perl - "$@" <<'EOPERL' # let's do it in Perl | ||
+ | for $major_minor (@ARGV) { | ||
+ | $major_minor =~ m/^(\d+):(\d+)$/ or die; | ||
+ | push(@tgt_rdevs, ($1<<8)|$2); | ||
+ | } | ||
+ | # Sort by reverse length of mount point, to unmount sub-directories first | ||
+ | open MOUNTS,"</proc/mounts" or die "$!"; | ||
+ | @mounts=sort { length($b->[1]) <=> length($a->[1]) } map { [ split ] } <MOUNTS>; | ||
+ | close MOUNTS; | ||
+ | foreach $m (@mounts) { | ||
+ | ($dev,$dir)=@$m; | ||
+ | next unless -b $dev; $rdev=(stat($dev))[6]; | ||
+ | next unless grep($_==$rdev, @tgt_rdevs); | ||
+ | system("logger","ultrabay_eject","umounting",$dev,$dir); | ||
+ | system("umount","-v","$dir")==0 or $bad=1; | ||
+ | } | ||
+ | exit 1 if $bad; | ||
+ | EOPERL | ||
+ | } | ||
+ | |||
+ | # Get the UltraBay's /dev/foo block device node | ||
+ | ultrabay_dev_node() { | ||
+ | UDEV_PATH="`readlink -e "$ULTRABAY_SYSDIR/block/"*`" || return 1 | ||
+ | UDEV_NAME="`udevinfo -q name -p $UDEV_PATH`" || return 1 | ||
+ | echo /dev/$UDEV_NAME | ||
+ | } | ||
+ | |||
+ | if [ -d $ULTRABAY_SYSDIR ]; then | ||
+ | sync | ||
+ | # Unmount filesystems backed by this device | ||
+ | ## This seems to be very inelegant and prone to failure | ||
+ | unmount_rdev `cat $ULTRABAY_SYSDIR/block/*/dev \ | ||
+ | $ULTRABAY_SYSDIR/block/*/*/dev` \ | ||
+ | || { | ||
+ | logger ultrabay_eject umounting failed | ||
+ | echo 2 > /proc/acpi/ibm/beep; # triple error tone | ||
+ | exit 1; | ||
+ | } | ||
+ | sync | ||
+ | # Nicely power off the device | ||
+ | DEVNODE=`ultrabay_dev_node` && hdparm -Y $DEVNODE | ||
+ | # Let HAL+KDE notice the unmount and let the disk spin down | ||
+ | sleep 0.5 | ||
+ | # Unregister this SCSI device: | ||
+ | sync | ||
+ | echo 1 > $ULTRABAY_SYSDIR/delete | ||
+ | else | ||
+ | logger ultrabay_eject no ultrabay device directory | ||
+ | echo 2 > /proc/acpi/ibm/beep # triple error tone | ||
+ | exit 1 | ||
+ | fi | ||
+ | |||
+ | # We need sleep here so someone can disconnect the bay and the drive | ||
+ | sleep 1 | ||
+ | |||
+ | # Turn off power to the UltraBay | ||
+ | dock=$( /bin/grep ata_bay /sys/devices/platform/dock.?/type ) | ||
+ | dock=${dock%%/type:ata_bay} # needed for 2.6.27 and later | ||
+ | if [ -n "$dock" -a -d "$dock" ]; then | ||
+ | logger ultrabay_eject undocking $dock | ||
+ | echo 1 > $dock/undock | ||
+ | fi | ||
+ | # Tell the user we're OK | ||
+ | logger ultrabay_eject done | ||
+ | echo 12 > /proc/acpi/ibm/beep | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | == Untested on Fedora 11 == | ||
− | + | The Fingerprint reader and the WWAN options have not been tested yet. If you tried them with Fedora 11, please update the table. | |
− | [[Category:T60]][[Category:Fedora]] | + | [[Category:T60]][[Category:Fedora]][[Category:T60p]] |
Revision as of 16:31, 6 May 2009
Contents
Success Chart
Item | Working | Notes | |
Installation | Local CD/DVD install | yes | |
Network Installation | yes | ||
USB Installation | yes | ||
Display - Intel | Laptop Screen | yes | only 1 video mode available |
VGA | yes | with hotplug only ? | |
DVI | yes | with hotplug only ? | |
Display - ATI | Laptop Screen | yes | everything works, including rotation |
VGA | yes | everything works, including rotation and mirroring | |
DVI | unknown (should work) | no reason this wouldn't work | |
Power Management | Software Suspend (hibernate) | yes | |
Suspend to Memory (ACPI sleep) | yes | ||
Audio | yes | ||
Wireless | WiFi - Atheros | yes | occasional disconnect/reconnect |
WiFi - Intel | yes | no problems at all | |
Bluetooth | yes | ||
WWAN - Verizon | unknown | ||
WWAN - Cingular | unknown | ||
Extra Buttons | Keyboard Section | partial | see ThinkPad keyboard section below |
Ports | Ethernet | yes | |
Modem | no | Requires closed-source driver | |
Serial | yes | Requires port-replicator or dock | |
IrDA | no | Device is detected, but no device files are created | |
PS/2 Keyboard/Mouse | unknown (should work) | Requires port-replicator or dock | |
Parallel | unknown (should work) | Requires port-replicator or dock | |
USB | yes | ||
PCMCIA/Cardbus | yes | even ATA adaptors (for CF cards, etc) now work! | |
Harddisk Active Protection | no | ||
Ultrabay device hotswap | partial | see below, use with
caution out of the box | |
Fingerprint reader | unknown (should work) | F11 has standard support for Fingerprint readers | |
TPM (security subsystem) | unknown | Not brave enough to mess around with it |
Tested and Verified on Fedora 11
Information in this section has been tested and verified using Fedora 11, including the pre-release (post-beta) version. The development version of Fedora 11 (rawhide) is quite stable and even suitable for day-to-day use, if you are a bit brave. You will be automatically switched over to the release version of Fedora 11 if you keep everything up to date.
Installation
Installation is straight forward; you can follow the generic Fedora install instructions.
Configuration
X Server (Intel)
Basic X server functionality should work out of the box on the ThinkPad LCD (LVDS), as long as no external displays are attached at boot.
Fedora 11 uses KMS (Kernel Mode Setting) by default, which for now has some up and down sides for external displays. The down sides are that external displays attached during boot might not function properly (mostly they may have non-optimal resolution), but they do when hot plugged afterwards. Another down side is that currently mirror mode is very limited as the ThinkPad LCD (LVDS) is limited to one single display mode, so only if the external display supports this same mode can you activate mirror mode. On the other hand with KMS enabled the maximum virtual display size is now 4096x4096 (2048x2048 without KMS) meaning you can have an extended desktop.
These issues have been reported to Red Hat bugzilla.
On a T60p, displays work well, with multiple mirrored and non-mirrored displays and even with one of the displays being rotated! This may also work on a base T60, as there has been a lot of effort put into getting this to work right.
One thing that still doesn't work quite right is screensavers and screen blanking. There is something wrong with the timers, which may result in your screen blanking while you are typing. Recovery is a simple as waiting until the screen is completely blank and then type or click to wake up the screen.
Another thing that doesn't work quite right is screen resolution when booting with multiple screens. If one screen doesn't not have a preferred resolution, a poor resolution may be used for both screens during the booting process. Everything works fine after login, however.
Desktop Effects
Compiz (wobbly windows, desktops on a cube) seems to work. Direct display of video may be problematic with Compiz, however.
dpi
On the 1400x1050 (and 1600x1200) LCD Fedora comes up with a DPI of 124 (or higher). While this is correct for the physical screen size, it waists a lot of screen real estate.
To change to the more typical 96 DPI, go to System -> Preferences -> Appearance. Now in Appearance Preferences select the Fonts tab and press the "Details ..." button. Here you can change the dots per inch to 96. Of course, many things will shrink, but that is what you wanted, after all.
Wireless Network
Both the Intel and Atheros wireless should work out of the box.
Atheros was tested and works, but you may encounter occasional disconnects and reconnects. Intel wireless also works.
ThinkPad keys
ThinkPad keys are handled by a mixture of the thinkpad_acpi, acpi button, acpi dock and acpi video drivers.
Key | Function | Handled by | HAL event | Works | Notes |
Fn-F2 | lock screen | thinkpad_acpi | yes | yes | |
Fn-F3 | battery | thinkpad_acpi | yes | yes | |
Fn-F4 | suspend | acpi button | yes | yes | |
Fn-F5 | wireless | thinkpad_acpi | yes | partial | No default action, but can be associated with gnome-keybinding-properties |
Fn-F7 | videomode | thinkpad_acpi | yes | yes | Cycles through only LCD, only external, both (mirrored), and both (non-mirrored) |
Fn-F8 | mouse input select | thinkpad_acpi | yes | partial | No default action, but can be associated with gnome-keybinding-properties |
Fn-F9 | undock | thinkpad_acpi | yes | partial | No default action, but can be associated with gnome-keybinding-properties |
Fn-F12 | hibernate | acpi button | yes | partial | does the same as Fn-F4 (suspend), not hibernate |
Fn-Home | brightness up | acpi video | yes | yes | includes on-screen display of brightness level |
Fn-End | brightness down | acpi video | yes | yes | includes on-screen display of brightness level |
Fn-PgUp | thinklight | - | no | yes | changing thinkpad_acpi hotkey_mask, causes HAL events. No OSD in any case. |
Fn-Space | zoom | thinkpad_acpi | yes | no | |
VolumeUp | Volume Up | - | no | yes | changing thinkpad_acpi hotkey_mask, causes HAL events. But OSD is wrong |
VolumeDown | Volume Down | - | no | yes | changing thinkpad_acpi hotkey_mask, causes HAL events. But OSD is wrong |
Mute | Mute | - | no | yes | changing thinkpad_acpi hotkey_mask, causes HAL events and OSD. works as a on/off toggle |
ThinkVantage | Vendor key | thinkpad_acpi | yes | partial | No default action, but can be associated with gnome-keybinding-properties |
NextTab | Browser Next tab | standard keyboard driver | yes | yes | |
PreviousTab | Browser Previous tab | standard keyboard driver | yes | yes | |
Fn-Up | Stop | standard keyboard driver | yes | yes | |
Fn-Left | reverse | standard keyboard driver | yes | yes | |
Fn-Right | forward | standard keyboard driver | yes | yes | |
Fn-Down | play/pause | standard keyboard driver | yes | yes | |
Power | Power button | acpi button | yes | yes | Need to press button for ~1 second to trigger event |
Lid | Lid button | acpi button | yes | yes | |
Dock | Dock eject button | acpi dock | yes | partial | causes unload of USB devices (including internal BlueTooth!!) and switch to battery mode. Does not restore video to ThinkPad only. Causes HAL event, but not a button event. |
Ultrabay | Ultrabay eject switch | ??? | no | partial | causes a udev event, which can be handled as in [How to hotswap Ultrabay devices], with minor changes, but should be handled better |
Radio switch | Radio kill switch | yes | yes | previous comment on Bluetooth only may be a result of networkmanager keeping information around - however integration with networkmanager and bluetooth applet is not complete |
Ultrabay
The Ultrabay has some glitches out of the box with respect to hotswapping. It is possible to lock the machine when pulling out devices, even the CD/DVD device.
The culprit is that the Ultrabay pre-eject switch is not hooked into anything useful. It does cause udev events, but nothing is listening for them. When a device that has a mounted partition or CD is actually pulled out it is too late to do the right thing. Fedora 11 will usually just complain, sometimes bitterly, but may also lock up for some unknown reason, even if just pulling out a CD/DVD device with a mounted CD.
Manually unmounting before removal will help. Manual powering down may also be required for correct performance.
A better solution is to set up a udev rule and script to handle the pre-eject switch event for Ultrabay devices that have mountable things in them as in [How to hotswap Ultrabay devices].
The revised solution here works well. Pushing the pre-eject switch either does the unmounting and powering off and then emits a low beep, or fails and then emits a triple beep. After success the device can be safely removed or the eject lever can be pushed back and everything will be remounted. After failure pusing the eject lever back in does nothing, permitting continuing as if nothing happened or allowing changes to be made before the next attempt to remove.
Unfortunately the code below is complex and may be fragile. A better solution would be very useful.
To set this solution up, first create the file /etc/udev/rules.d/50-ibm-ultrabay.rules
ls -lZ /etc/udev/rules.d/50-ibm-ultrabay.rules -rw-r--r--. root root system_u:object_r:etc_runtime_t:s0 /etc/udev/rules.d/50-ibm-ultrabay.rules cat /etc/udev/rules.d/50-ibm-ultrabay.rules ENV{BAY_EVENT}=="3", ACTION=="change", SUBSYSTEM=="scsi", RUN+="/usr/local/sbin/ultrabay_eject"
Then create the executable file /usr/local/sbin/ultrabay_eject
#!/bin/bash ULTRABAY_SYSDIR=/sys$DEVPATH shopt -s nullglob logger ultrabay_eject storage device $DEVPATH # Umount the filesystem(s) backed by the given major:minor device(s) unmount_rdev() { perl - "$@" <<'EOPERL' # let's do it in Perl for $major_minor (@ARGV) { $major_minor =~ m/^(\d+):(\d+)$/ or die; push(@tgt_rdevs, ($1<<8)|$2); } # Sort by reverse length of mount point, to unmount sub-directories first open MOUNTS,"</proc/mounts" or die "$!"; @mounts=sort { length($b->[1]) <=> length($a->[1]) } map { [ split ] } <MOUNTS>; close MOUNTS; foreach $m (@mounts) { ($dev,$dir)=@$m; next unless -b $dev; $rdev=(stat($dev))[6]; next unless grep($_==$rdev, @tgt_rdevs); system("logger","ultrabay_eject","umounting",$dev,$dir); system("umount","-v","$dir")==0 or $bad=1; } exit 1 if $bad; EOPERL } # Get the UltraBay's /dev/foo block device node ultrabay_dev_node() { UDEV_PATH="`readlink -e "$ULTRABAY_SYSDIR/block/"*`" || return 1 UDEV_NAME="`udevinfo -q name -p $UDEV_PATH`" || return 1 echo /dev/$UDEV_NAME } if [ -d $ULTRABAY_SYSDIR ]; then sync # Unmount filesystems backed by this device ## This seems to be very inelegant and prone to failure unmount_rdev `cat $ULTRABAY_SYSDIR/block/*/dev \ $ULTRABAY_SYSDIR/block/*/*/dev` \ || { logger ultrabay_eject umounting failed echo 2 > /proc/acpi/ibm/beep; # triple error tone exit 1; } sync # Nicely power off the device DEVNODE=`ultrabay_dev_node` && hdparm -Y $DEVNODE # Let HAL+KDE notice the unmount and let the disk spin down sleep 0.5 # Unregister this SCSI device: sync echo 1 > $ULTRABAY_SYSDIR/delete else logger ultrabay_eject no ultrabay device directory echo 2 > /proc/acpi/ibm/beep # triple error tone exit 1 fi # We need sleep here so someone can disconnect the bay and the drive sleep 1 # Turn off power to the UltraBay dock=$( /bin/grep ata_bay /sys/devices/platform/dock.?/type ) dock=${dock%%/type:ata_bay} # needed for 2.6.27 and later if [ -n "$dock" -a -d "$dock" ]; then logger ultrabay_eject undocking $dock echo 1 > $dock/undock fi # Tell the user we're OK logger ultrabay_eject done echo 12 > /proc/acpi/ibm/beep
Untested on Fedora 11
The Fingerprint reader and the WWAN options have not been tested yet. If you tried them with Fedora 11, please update the table.