[ltp] How does /proc/acpi/ibm/bay work
Theodore Ts'o
linux-thinkpad@linux-thinkpad.org
Thu, 31 Mar 2005 08:49:30 -0500
--yrj/dFKFPuw6o+aM
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Thu, Mar 31, 2005 at 07:39:59AM +0200, Tino Keitel wrote:
> > Does anyone use /proc/acpi/ibm/bay and can write about his/her
> > experiences, especially what does work and what doesn't?
>
> Hum, is there really nobody out there who uses UltraBay hotswapping?
I can swap my DVD/CD-RW drive, as well as an additional IDE hard
drive. In fact, I regularly use the hot-swap feature so that I can
disable the ultrabay when I am not using the disk, and when I am
suspending the laptop for additional power savings.
This is on a T40, using the the following scripts. The idectl script
is from the hdparm sources, in the contrib directory.
- Ted
--yrj/dFKFPuw6o+aM
Content-Type: application/x-sh
Content-Disposition: attachment; filename="eject.sh"
Content-Transfer-Encoding: quoted-printable
#!/bin/bash=0A=0A/bin/sync=0A/usr/local/sbin/idectl 1 off=0A=0A/bin/echo ej=
ect > /proc/acpi/ibm/bay=0A
--yrj/dFKFPuw6o+aM
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=idectl
#!/bin/sh
HDPARM=/sbin/hdparm
MAX_IDE_NR=1
IDE_IO_0=0x1f0
IDE_IO_1=0x170
USE_IDE_DEV_0=/dev/hdc
USE_IDE_DEV_1=/dev/hda
usage () {
if [ $# -gt 0 ]; then
echo $* >&2
echo
fi
echo "usage: $0 ide-channel-nr [off|on|rescan]" 2>&1
exit 1
}
IDE_NR=$1
MODE=$2
do_register=0
do_unregister=0
if [ ! "$IDE_NR" ] || [ $IDE_NR -lt 0 ] || [ $IDE_NR -gt $MAX_IDE_NR ]; then
usage "Unrecognized IDE-channel number"
fi
case "$MODE" in
on ) do_register=1 ;;
off ) do_unregister=1 ;;
rescan ) do_unregister=1; do_register=1 ;;
* ) usage "Unrecognized command" ;;
esac
eval "IDE_IO=\$IDE_IO_$IDE_NR"
eval "USE_IDE_DEV=\$USE_IDE_DEV_$IDE_NR"
[ $do_unregister -eq 1 ] && eval "$HDPARM -U $IDE_NR $USE_IDE_DEV > /dev/null"
[ $do_register -eq 1 ] && eval "$HDPARM -R $IDE_IO 0 0 $USE_IDE_DEV > /dev/null"
--yrj/dFKFPuw6o+aM--