ACPI fix + comments
Hi!
This patch fixes ACPI oops on my toshiba.. This should go to Linus.
drivers/acpi/cmbatt.c +6 -4
@@ -163,11 +167,13 @@ result->battery_capacity_granularity_1=objs[7 ].integer.value; result->battery_capacity_granularity_2=objs[8 ].integer.value; +#define Xstrncpy (a, b, c) if (b) strncpy(a,b,c); else strncpy(a, "unknown", c); +/* BUG: trailing NULL issue */ -strncpy (result->model_number, objs[9 ].string.pointer,MAX_BATT_STRLEN -1 ); -strncpy (result->serial_number, objs[10 ].string.pointer,MAX_BATT_STRLEN -1 ); -strncpy (result->battery_type, objs[11 ].string.pointer,MAX_BATT_STRLEN -1 ); -strncpy (result->oem_info, objs[12 ].string.pointer,MAX_BATT_STRLEN -1 ); +Xstrncpy (result->model_number, objs[9 ].string.pointer,MAX_BATT_STRLEN -1 ); +Xstrncpy (result->serial_number, objs[10 ].string.pointer,MAX_BATT_STRLEN -1 ); +Xstrncpy (result->battery_type, objs[11 ].string.pointer,MAX_BATT_STRLEN -1 ); +Xstrncpy (result->oem_info, objs[12 ].string.pointer,MAX_BATT_STRLEN -1 );kfree (buf.pointer);
And working around error in running sta makes it actually usefull. This is ugly workaround, should not be applied to official tree.
drivers/acpi/namespace/nsxfobj.c +4 -2
@@ -591,14 +591,16 @@* Run _STA to determine if device is present */ +printk ("Running sta on %x: " , node); status =acpi_cm_execute_STA (node, &flags);if (ACPI_FAILURE (status)) { -return (status); +printk ("error (%x)\n" , status); +/* return (status); */ }if (!(flags &0x01 )) {/* don't return at the device or children of the device if not there */ - +printk ("not there\n" );return (AE_CTRL_DEPTH ); }
And now questions: Why are numbers reported in hexadecimal? Reporting voltage in hexadecimal is nice nonsense to me...
I believe that we should keep description: value format, and switch to decimal. Plus, units are nonsensical in some cases:
Remaining Capacity: 59a
~~~ should be in mAh, probably
Battery discharging
Battery rate 7c5
~~~ should be in either Ampers or Wats
Battery capacity 59a mA
~~ capacity is in miliAmps * hours, or mAh (or we
could use wats, because we know voltage)
Battery voltage 2b8e volts
~~~~~~ should be milivolts, or mV
_info is not much better:
Last Full Capacity e43 mA /hr
~~~~~~ I believe this is meant to be mA *hr (or mAh)
Design Capacity fa0 mA /hr
~~~~~~ same here
Secondary Battery Technology
Design Voltage 2a30 mV
Design Capacity Warning 74
Design Capacity Low 0
Battery Capacity Granularity 1 40
Battery Capacity Granularity 2 40
model number
serial number
battery type
OEM info unknown
(Oh, btw, those are actuall values from my toshiba satellite. It seems it does not want to talk about its serial/model numbers; OEM info is even NULL...)
Pavel
PS: What should be difference between _info and _status? Both contain fields that change with time...
Signature · 13 lines
I'm [email protected]. "In my country we have almost anarchy and I don't care." Panos Katsaloulis describing me w.r.t. patents at [email protected] ----- End forwarded message ----- -- I'm [email protected]. "In my country we have almost anarchy and I don't care." Panos Katsaloulis describing me w.r.t. patents at [email protected] - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] Please read the FAQ at http://www.tux.org/lkml/