Skip to contentSkip to conversation

2.6.24-rc: fix ACPI battery technology reporting

PATCH Applied Andrey Borzenkov 3 participants 3 messages Nov 10, 2007 – Dec 7, 2007 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.6.24-rc: fix ACPI battery technology reporting

Subject: [PATCH] 2.6.24-rc: fix ACPI battery technology reporting
From: Andrey Borzenkov <[email protected]>

At least some systems report technology information with trailing spaces:

{pts/1}% cat -E /var/tmp/bat/2.6.23 | grep type
battery type: Li-ION $

Use strncasecmp to compare model string to skip trailing part

---

 drivers/acpi/battery.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/battery.c +0 -0
index c2ce0ad..1905b88 100644
@@ -125,7 +125,7 @@ static int acpi_battery_technology(struct acpi_battery 

*battery)
return POWER_SUPPLY_TECHNOLOGY_NiMH;
if (!strcasecmp("LION", battery->type))
return POWER_SUPPLY_TECHNOLOGY_LION;
- if (!strcasecmp("LI-ION", battery->type))
+ if (!strncasecmp("LI-ION", battery->type, 6))
return POWER_SUPPLY_TECHNOLOGY_LION;
if (!strcasecmp("LiP", battery->type))
return POWER_SUPPLY_TECHNOLOGY_LIPO;

Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Andrey Borzenkov

Subject: [PATCH] 2.6.24-rc: fix ACPI battery technology reporting
From: Andrey Borzenkov <[email protected]>

At least some systems report technology information with trailing spaces:

{pts/1}% cat -E /var/tmp/bat/2.6.23 | grep type
battery type: Li-ION $

Use strncasecmp to compare model string to skip trailing part

Quoted 20 lines

---

 drivers/acpi/battery.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/battery.c +1 -1
index c2ce0ad..1905b88 100644
@@ -125,7 +125,7 @@ static int acpi_battery_technology(struct acpi_battery 
 *battery)
 		return POWER_SUPPLY_TECHNOLOGY_NiMH;
 	if (!strcasecmp("LION", battery->type))
 		return POWER_SUPPLY_TECHNOLOGY_LION;
-	if (!strcasecmp("LI-ION", battery->type))
+	if (!strncasecmp("LI-ION", battery->type, 6))
 		return POWER_SUPPLY_TECHNOLOGY_LION;
 	if (!strcasecmp("LiP", battery->type))

return POWER_SUPPLY_TECHNOLOGY_LIPO;

reviewer Applied
#2 lore raw

applied.

though kmail found it to be impossible to save an un-corrupted plain text version of andrezy's message.

should the other string compares be updated like this one?

-len

Quoted 41 lines · Alexey Starikovskiy
Quoted 13 lines · Andrey Borzenkov

Subject: [PATCH] 2.6.24-rc: fix ACPI battery technology reporting
From: Andrey Borzenkov <[email protected]>

At least some systems report technology information with trailing spaces:

{pts/1}% cat -E /var/tmp/bat/2.6.23 | grep type
battery type: Li-ION $

Use strncasecmp to compare model string to skip trailing part

Quoted 18 lines

---

 drivers/acpi/battery.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/battery.c +1 -1
index c2ce0ad..1905b88 100644
@@ -125,7 +125,7 @@ static int acpi_battery_technology(struct acpi_battery 
 *battery)
 		return POWER_SUPPLY_TECHNOLOGY_NiMH;
 	if (!strcasecmp("LION", battery->type))
 		return POWER_SUPPLY_TECHNOLOGY_LION;
-	if (!strcasecmp("LI-ION", battery->type))
+	if (!strncasecmp("LI-ION", battery->type, 6))
 		return POWER_SUPPLY_TECHNOLOGY_LION;
 	if (!strcasecmp("LiP", battery->type))
Quoted 2 lines

return POWER_SUPPLY_TECHNOLOGY_LIPO;

-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html