Decyphering some code
I am trying to find out how to power off and on UltraBay in my ThinkPad laptop. So far, I got halfway.
From this I discovered how to power it off:
The command is
This file is write-only, by the way.
echo 1 > /sys/devices/platform/dock.2/undock
Now, I was looking for a method to power it back on here:
but I can't figure it out.
does nothing, and /sys/devices/platform/dock.2/docked is read-only. Permission denied. If I change it to rw, it does nothing.
echo 0 > /sys/devices/platform/dock.2/undock
Can someone give me a hand with it?
Well, the system thinks it is undocked - ie, not there. You will have to remove it, and plug it back in so the OS gets the signal that the device has been plugged into the system. What you did is in effect the equivalent to the Windows "Safely Remove Hardware" gizmo.
The links I provided lead to the source of a program that, among other things, can switch it on and off. I want to be able to switch it off while on battery, and then on, when AC is connected.
What do you have in the bay? A CD/DVD drive? When they are not being used, their power consumption, AFAIK, is pretty minimal. It sounds like you are trying to squeeze every last erg out of your batteries. My solution has always to get the biggest capacity battery available for the system, and at least one more for good measure. Then, when the system starts to run out of juice, it hibernates, I switch the battery, restart the system, and continue from where i was before!