Page 1 of 1

Linux, T61p, Ultrabay Battery Compatability

Posted: Fri Sep 05, 2008 5:21 pm
by eateryofpiza
Hello,

How is the compatibility with the Ultrabay Battery on Linux? I'm running Ubuntu 8.04 x64 (2.6.24-19-generic) on a T61p (specs in sig). I've read some general things from thinkwiki, which says that the switchover from a dead main battery to a full ultrabay battery should be automatic, but I was hoping for some more specificity with my own setup. Also, are there any GUIs that can show the discharge level of each battery and other sort of stats like that? And how is the hotswapping compatibility?

Thanks

Posted: Fri Sep 05, 2008 7:20 pm
by lightweight
tp_smapi gives good control of the ultrabay battery assuming there is hardware support. I have an ugly one liner in this thread that will switch from the ultrabay to the main battery in this thread, if wanted: http://forum.thinkpads.com/viewtopic.php?t=64288

You can monitor your battery stats with a

Code: Select all

cat /proc/acpi/battery/BAT{0,1}/*
If you want to spit this to a log file so you can watch it by, say, day, add this to your crontab:

Code: Select all

(date; cat /proc/acpi/battery/BAT{0,1}/*) > ~/battery_state
For a GUI of battery status, all desktops (XFCE, Gnome, KDE, etc) have one. If you're looking for lean, you could do it with conky or xbattbar. All of these methods just parse proc/acpi/battery.

Posted: Fri Sep 05, 2008 7:31 pm
by eateryofpiza
Thanks for the info lightweight, but have there been any reports about specific compatibility between the T61p and Ultrabay battery?

Also, I see from your script that it echos to /sys/devices/platform/smapi/BAT0/force_discharge. I can't seem to find that directory, but if I modprobe -l, tp_smapi is loaded

Code: Select all

user@GAMERA:~$ modprobe -l *smapi*
/lib/modules/2.6.24-19-generic/ubuntu/misc/tp_smapi.ko

Code: Select all

user@GAMERA:~$ ls -a /sys/devices/platform/
.   bay.0  bluetooth  i8042     pcspkr  serial8250     thinkpad_hwmon
..  bay.1  dock.0     iTCO_wdt  power   thinkpad_acpi  uevent
Thanks.

Posted: Fri Sep 05, 2008 7:52 pm
by lightweight
Glad to help. Thinkwiki's based on submissions and I would hope their T61 entry is based on realy input: http://www.thinkwiki.org/wiki/Tp_smapi#T_series

What's in bay.0 and bay.1?

Posted: Fri Sep 05, 2008 8:34 pm
by eateryofpiza
lightweight wrote:What's in bay.0 and bay.1?

Code: Select all

user@GAMERA:~$ ls -a /sys/devices/platform/bay.*/*
/sys/devices/platform/bay.0/eject     /sys/devices/platform/bay.1/eject
/sys/devices/platform/bay.0/modalias  /sys/devices/platform/bay.1/modalias
/sys/devices/platform/bay.0/present   /sys/devices/platform/bay.1/present
/sys/devices/platform/bay.0/uevent    /sys/devices/platform/bay.1/uevent

/sys/devices/platform/bay.0/power:
.  ..  wakeup

/sys/devices/platform/bay.0/subsystem:
.  ..  devices  drivers  drivers_autoprobe  drivers_probe  uevent

/sys/devices/platform/bay.1/power:
.  ..  wakeup

/sys/devices/platform/bay.1/subsystem:
.  ..  devices  drivers  drivers_autoprobe  drivers_probe  uevent
I haven't bought the battery yet since I don't want to burn ~$120 on something that may turn into a brick.

Do you think that it would show up once I plug it in? But I would think that there would be entries for battery 0 (main battery)?

Posted: Fri Sep 05, 2008 10:25 pm
by aaa
My opinion is that it should work automatically, don't see how software support comes into play except for finer-grained control of the battery. You should be able see individual battery stats, have automatic switchover, etc. I have not tried this myself though, only on T4x (which works fine even without tp_smapi).

Posted: Fri Sep 05, 2008 10:49 pm
by eateryofpiza
hrmm... When I was reading the thread you linked to, it said that fully discharging the battery would lead to reduced battery life. I would like to avoid this, so do you know of another way for me to trigger the switchover manually?

Posted: Fri Sep 05, 2008 11:13 pm
by aaa
eateryofpiza wrote:hrmm... When I was reading the thread you linked to, it said that fully discharging the battery would lead to reduced battery life. I would like to avoid this, so do you know of another way for me to trigger the switchover manually?
On my T40, which doesn't have the fine-grained battery control in hardware, the only way to keep it running the battery down to 0 before switching is to remove the battery.

Posted: Sat Sep 06, 2008 12:01 am
by lightweight
Check this out:

Code: Select all

:~$ ls /sys/devices/platform
bay.0      dock.0  iTCO_wdt    pcspkr  serial8250  thinkpad_acpi   uevent
bluetooth  i8042   nsc-ircc.0  power   smapi       thinkpad_hwmon  vesafb.0
:~$ lsmod |grep api
tp_smapi               21296  0 
thinkpad_ec             6960  1 tp_smapi
:~$ sudo modprobe -r tp_smapi
:~$ lsmod |grep api

:~$ ls /sys/devices/platform
bay.0      dock.0  iTCO_wdt    pcspkr  serial8250     thinkpad_hwmon  vesafb.0
bluetooth  i8042   nsc-ircc.0  power   thinkpad_acpi  uevent
So, unloading tp_smapi on my boxes removes /sys/devices/platform/smapi, which makes sense. Are you sure tp_smapi is loaded? (modprobe -l lists all modules, loaded or not.) If not, this should be as easy as a

Code: Select all

sudo modprobe tp_smapi
You'll have a BAT0 and a BAT1 whether the batteries are in there or not -- empty devices will just be empty, like

(no ultrabay battery)

Code: Select all

:~$ cat /sys/devices/platform/smapi/BAT1/power_now 
cat: /sys/devices/platform/smapi/BAT1/power_now: No such device or address
Hope this helps.

Posted: Sat Sep 06, 2008 2:23 pm
by eateryofpiza
@lightweight:

Oh hey, that worked. I didn't know modprobe -l listed every package.

How do I ensure the module is loaded every time I boot?

Thanks a bunch.

Posted: Sat Sep 06, 2008 2:40 pm
by lightweight
I didn't know that about modprobe either, and was initially too lazy to go past a modprobe --help. I had to man it :)

Append /etc/modules (only writeable by root) with "tp_smapi". You can do this from a terminal with a

Code: Select all

echo tp_smapi |sudo tee -a /etc/modules

Posted: Sun Sep 07, 2008 10:21 pm
by eateryofpiza
lightweight wrote:I didn't know that about modprobe either, and was initially too lazy to go past a modprobe --help. I had to man it :)

Append /etc/modules (only writeable by root) with "tp_smapi". You can do this from a terminal with a

Code: Select all

echo tp_smapi |sudo tee -a /etc/modules
Sweet thanks. I'm going to go get that battery now.