Talk:SMAPI support for Linux

From ThinkWiki
Revision as of 18:36, 16 December 2005 by Spiney (Talk | contribs) (Kernel Patch?: autologin silliness reverted)
Jump to: navigation, search

Great, great work! Really! This completely rocks. I just stopped my battery from charging at 77% and restarted charging a bit later, no problems whatsoever. BTW, this is on kernel

--spiney 21:25, 5 Dec 2005 (CET)

None of the fuctions is working on my T40, kernel 2.6.14-mm2.

--lammic, 2005.12.05

Works for me on a T41 running 2.6.12-10-686 (Ubuntu 5.10).

--berndtnm, 2005.12.06

Including stop_charge_thresh? That one seems to be missing on the T42p.

--Thinker 00:46, 7 Dec 2005 (CET)

tp_smapi works just fine on an R52 with Ubuntu Breezy stock kernel.

--Micampe 12:52, 7 Dec 2005 (CET)

To set the thresholds for starting and stopping battery charging (in percent of current capacity):

current really? That'd be weird, I'd expect it to be percent of total capacity.

--Micampe 14:39, 7 Dec 2005 (CET)

"Current full charge capacity", as opposed to "current remaining capacity" or "designed full charge capacity"...

--Thinker 15:05, 7 Dec 2005 (CET)

Battery features don't work with my T41p. I can't check this with windows. Can anybody try these features?

-- Nils, 7 Dec 2005

Nils, does cdrom_speed work for you on the T41p? Could you provide the details requested in the README (dmesg etc.)?

--Thinker 21:57, 7 Dec 2005 (CET)

CDRom Speed seems to work. (I see no warnings, but I have to do a speed test.) Now, I've send all outputs to the email-address in the readme.

-- Nils, 8 Dec 2005

All the features except the stop_charge_thresh seem to work here on a t42p. One note, the start_charge_thresh seems to really be stop_charge_thresh. Ie, If I set that to lower than my current battery %, it will never charge, and if I set it to 100 the battery charges all the way.

--Nirik 16 Dec 2005

Nirik, "all the features" as of which version? For example, do the force_discharge{1,2} in tp_smapi 0.12 also work for you? See the table in the article page. About start_charge, that's odd. Can you send me a log of what you did, what was the result a what was the dmesg output for each operation?

--Thinker 14:16, 16 Dec 2005 (CET)

Changing the CD speed when the CD is being accessed will hang your computer

I don't have this problem on my T40p. CDROM is mounted and file on CD is opened. Change speed do not hang my system.

-- Stefan Schmidt

An open file looks fine if you're not reading/writing at that point. But my T43 does hangs on this:

# dd if=/dev/scd0 of=/dev/null &
# echo 1 > /sys/devices/platform/smapi/cdrom_speed

--Thinker 16:41, 7 Dec 2005 (CET)

OK, sorry. I was to fast. My system hangs on this commands, too. :(

-- Stefan Schmidt

Works well. Great.

T42 2373-8zh. Working :cdrom_speed and start_charge_thresh. Untest : inhibit_charge_minutes.

-- Haifeng Chen

cdrom_speed works on my T40.

-- lammic, 2005.12.09

"thinkpad" module kernel compatibility

Ajunge, how do you compile the "thinkpad" module compile on kernel >=2.6.9? The latest thinkpad version (5.8) still uses "get_cpu_ptr" and "set_cpu_ptr", which were removed in 2.6.9.

--Thinker 13:53, 10 Dec 2005 (CET)

Kernel Patch?

Hello Thinker,

would it be possible to provide the SMAPI support as kernel patch as well? Something along the lines of: (0.12 against 2.6.15-rc5)

diff -Nrp drivers/acpi.orig/Kconfig drivers/acpi/Kconfig
*** drivers/acpi.orig/Kconfig   Thu Dec 15 19:58:21 2005
--- drivers/acpi/Kconfig        Fri Dec 16 10:30:51 2005
*************** config ACPI_IBM
*** 206,211 ****
--- 206,221 ----

          If you have an IBM ThinkPad laptop, say Y or M here.

+       tristate "IBM ThinkPad SMAPI Support"
+       depends on X86
+       ---help---
+         This adds SMAPI support on IBM ThinkPads, mostly used for battery 
+         charge control. For more information about this driver see
+         <> .
+         If you have an IBM ThinkPad laptop, say Y or M here.
        tristate "Toshiba Laptop Extras"
        depends on X86
diff -Nrp drivers/acpi.orig/Makefile drivers/acpi/Makefile
*** drivers/acpi.orig/Makefile  Thu Dec 15 19:58:21 2005
--- drivers/acpi/Makefile       Fri Dec 16 10:27:36 2005
*************** obj-$(CONFIG_ACPI_DEBUG)        += debug.o
*** 54,59 ****
--- 54,60 ----
  obj-$(CONFIG_ACPI_NUMA)               += numa.o
  obj-$(CONFIG_ACPI_ASUS)               += asus_acpi.o
  obj-$(CONFIG_ACPI_IBM)                += ibm_acpi.o
+ obj-$(CONFIG_ACPI_IBM_SMAPI)  += tp_smapi.o
  obj-$(CONFIG_ACPI_TOSHIBA)    += toshiba_acpi.o
  obj-y                         += scan.o motherboard.o
  obj-$(CONFIG_ACPI_HOTPLUG_MEMORY)     += acpi_memhotplug.o
diff -Nrp drivers/acpi.orig/tp_smapi.c drivers/acpi/tp_smapi.c
*** drivers/acpi.orig/tp_smapi.c        Thu Jan  1 01:00:00 1970
--- drivers/acpi/tp_smapi.c     Fri Dec 16 10:27:10 2005
*** 0 ****
--- 1,1318 ----

Deleted the tp_smapi.c file at the end, out of obvious reasons, and I'm not sure about the placement in the ACPI section, OTOH there it would be found easily next to ibm_acpi.

Providing a patch would help when recompiling the kernel often, I hate recompiling external modules every time (even got me a kernel-upgrade script to do most of it automatically). But of course it's up to you. :)

--spiney 09:52, 16 Dec 2005 (CET)

I'll be glad to add this, but I don't want to go through additional manual steps in the release process (there are already quite a few). Can you add a "make patch" functionality to the Makefile, or something of the sort, to automatically generate a full patch (including tp_smapi.c) against current kernel sources?

Also, this shouldn't be under drivers/acpi, since it doesn't use ACPI at all (that's why I didn't make it a patch to ibm_acpi). I think the right place is drivers/firmware, like the dell_rbu driver for Dell laptops.

BTW, the convention for kernel patches is to start them once level higher:

 diff -Nurp kernel-2.6.14-vanilla kernel-2.6.14-patched

--Thinker 17:12, 16 Dec 2005 (CET)

Of course it's from the wrong level, as usual I was just lazy/inattentive. And at one point I'll remember who likes what patch format, promise. ;)

A patch target as in "create a new file holding a correct diff to current kernel source" would be rather difficult, since line numbers might change etc., but applying the patch should be straighforward with a bit of sed. Of course I could just do that, create a patch with the diff command and then apply the new patch file in reverse. ;)

--spiney 18:36, 16 Dec 2005 (CET)