tswxl:~# cat /proc/buffalo/kernevnt SATA 0 pluggedtswxl:~# tswxl:~# cat /proc/buffalo/kernevnt SATA 1 unpluggedtswxl:~# tswxl:~# cat /proc/buffalo/kernevnt SATA 2 unpluggedtswxl:~# tswxl:~# cat /proc/buffalo/kernevnt SATA 3 unpluggedtswxl:~# tswxl:~# cat /proc/buffalo/kernevnt lanact 0 full eth0tswxl:~# tswxl:~# cat /proc/buffalo/kernevnt lanact 1000 full eth0tswxl:~# tswxl:~# cat /proc/buffalo/kernevnt tswxl:~# /usr/local/sbin/miconapl -a int_get_switch_status #[miconapl.int_get_switch_status] int=unknown tswxl:~# /usr/local/sbin/miconapl -a int_get_switch_status #[miconapl.int_get_switch_status] int=unknown tswxl:~# /usr/local/sbin/miconapl -a int_get_switch_status #[miconapl.int_get_switch_status] int=power_sw tswxl:~#一緒
tswxl:~# cat > /usr/local/sbin/kernelmon
#!/bin/sh
while :
do
LINE=`cat /proc/buffalo/kernevnt`
if [ "$LINE" = micon_interrupts ]
then
case `/usr/local/sbin/miconapl -a int_get_switch_status | sed -n -e 's/int=//p'` in
power_sw)
shutdown -h now
;;
*)
;;
esac
fi
done
tswxl:~#
手動で実行し、電源SWを長押ししてシャットダウンが走ることを確認する。
tswxl:~# sh /usr/local/sbin/kernelmon (電源ボタンを長押しする) INIT:BuffaloGpio_ChangePowerStatus > Writing 0x02 Stopping internet superserver: inetd. Saving the system clock. Cannot access the Hardware Clock via any known method. Use the --debug option to see the details of our search for an access method. Stopping enhanced syslogd: rsyslogd. Asking all remaining processes to terminate...done. All processes ended within 1 seconds....done. Deconfiguring network interfaces...eth0: stopped done. Cleaning up ifupdown.... Deactivating swap...done. Unmounting local filesystems...done. Will now halt. md: stopping all md devices. md: md1 still in use. md: md10 switched to read-only mode. md: md0 switched to read-only mode. sd 0:0:0:0: [sda] Synchronizing SCSI cache ^ESystem halted. BuffaloChangePowerStatusBeforeHalt > Check power status. MagicKey = 0x02 BuffaloGpio_ChangePowerStatus > Writing 0x7a BuffaloChangePowerStatusBeforeHalt > Changed to 0x7a from 0x02 >miconCntl_PowerOff >miconCntl_ShutdownWait
tswxl:~# cat > /etc/init.d/kernelmon
#!/bin/sh
case "$1" in
start)
if [ -e /proc/buffalo/gpio/switch/sw_control ]
then
echo on > /proc/buffalo/gpio/switch/sw_control
fi
/usr/local/sbin/kernelmon &
;;
stop)
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0
tswxl:~# chmod +x /usr/local/sbin/kernelmon
tswxl:~# chmod +x /etc/init.d/kernelmon
tswxl:~# ln -s ../init.d/kernelmon /etc/rcS.d/S81kernelmon
tswxl:~#
tswxl:~# /etc/rcS.d/S81kernelmon start tswxl:~#電源ボタンを長押しする
INIT: SendinBuffaloGpio_ChangePowerStatus > Writing 0x02 Stopping internet superserver: inetd. Saving the system clock. Cannot access the Hardware Clock via any known method. Use the --debug option to see the details of our search for an access method. Stopping enhanced syslogd: rsyslogd. Asking all remaining processes to terminate...done. All processes ended within 1 seconds....done. Deconfiguring network interfaces...eth0: stopped done. Cleaning up ifupdown.... Deactivating swap...done. Unmounting local filesystems...done. Will now halt. md: stopping all md devices. md: md1 still in use. md: md10 switched to read-only mode. md: md0 switched to read-only mode. sd 0:0:0:0: [sda] Synchronizing SCSI cache System halted. BuffaloChangePowerStatusBeforeHalt > Check power status. MagicKey = 0x02 BuffaloGpio_ChangePowerStatus > Writing 0x7a BuffaloChangePowerStatusBeforeHalt > Changed to 0x7a from 0x02 >miconCntl_PowerOff >miconCntl_ShutdownWait無事落ちたが、「ぴっ」といって欲しいな。
tswxl:~# cat /etc/init.d/miconapl
#!/bin/sh
[ -f /usr/local/sbin/miconapl ] || exit 0
case "$1" in
start)
ldconfig
/usr/local/sbin/miconapl -b -a boot_flash_ok
/usr/local/sbin/miconapl -a boot_end
/usr/local/sbin/miconapl -a serialmode_console
;;
stop)
/usr/local/sbin/miconapl -a bz_on button
/usr/local/sbin/miconapl -a shutdown_wait
/usr/local/sbin/miconapl -a lcd_set_dispitem off
/usr/local/sbin/miconapl -a led_set_cpu_mcon off
/usr/local/sbin/miconapl -a led_set_on_off off
/usr/local/sbin/miconapl -a led_set_brink off
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0
tswxl:~#
電源ボタンを長押しし、「ぴっ」といってから落ちることを確認する。
|
|
← 初期化/終了スクリプト |
ハックの記録 LinkStation/玄箱 をハックしよう |
→ ファンコントロール |