This page describes how to import a modified power_button pre-compiled kernel module for the WD MyBook World (blue ring) editions.
(Thanks to boondoklife for testing this on a dual-drive version!!)
I noticed that the power button on this unit seemed to have the ability to be more than just a power button.
On further investigation, I found that it's monitoring is handled by a kernel module called "power_button".
After about 30-40 hours of hard graft, I finally managed to modify and successfully compile and load this module with the capability to handle a "short press".
Preparing your system
- First you will need to download the modified kernel module from here (source code available here).
- Login to your system and sudo or su to 'root'.
- Run the following command:
modprobe -vr power_button
..you should see a response of: Unloading module power_button
Installing the module
Now that your system is ready, let install the modified module:
- rename/backup the original module
mv /lib/modules/2.6.17.14/kernel/arch/arm/mach-oxnas/power_button.ko /lib/modules/2.6.17.14/kernel/arch/arm/mach-oxnas/power_button.ko.orig
- copy the modified module into place
cp /<some_path>/power_button.ko /lib/modules/2.6.17.14/kernel/arch/arm/mach-oxnas/
- and load the module into the kernel
modprobe -v power_button
..you should see a response of: Loading module power_button
Using the new module
The new module will respond as follows:
- button press >= 3sec: system shutdown (normal operation)
- button press < 3sec: execute '/etc/init.d/power_button_short_press'
Needless to say, this script file must be created by you and be executable with an appropriate opening #! line.
Any short press of the power button will spawn off a process to run the script and write a log to /var/log/messages.
If the script errors for any reason (file does not exist, not executable, etc), an error will be written to the messages log file; if the execution is successful, the PID of the process that was launched will be written to the log.
I know that my wife will really appreciate the ability to refresh our uShare database at the touch of a button now without having to go to the study or fire up her phone's browser!!!