linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 2.6.24-rc: fix ACPI battery technology reporting
@ 2007-11-10 17:02 Andrey Borzenkov
  2007-11-11 22:38 ` Alexey Starikovskiy
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Borzenkov @ 2007-11-10 17:02 UTC (permalink / raw)
  To: linux-acpi, Alexey Starikovskiy

[-- Attachment #1: Type: text/plain, Size: 1076 bytes --]

Subject: [PATCH] 2.6.24-rc: fix ACPI battery technology reporting
From: Andrey Borzenkov <arvidjaar@mail.ru>

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

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>

---

 drivers/acpi/battery.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index c2ce0ad..1905b88 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -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;

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] 2.6.24-rc: fix ACPI battery technology reporting
  2007-11-10 17:02 [PATCH] 2.6.24-rc: fix ACPI battery technology reporting Andrey Borzenkov
@ 2007-11-11 22:38 ` Alexey Starikovskiy
  2007-12-07  3:31   ` Len Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Starikovskiy @ 2007-11-11 22:38 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: linux-acpi

Andrey Borzenkov wrote:
> Subject: [PATCH] 2.6.24-rc: fix ACPI battery technology reporting
> From: Andrey Borzenkov <arvidjaar@mail.ru>
>
> 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
>
> Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
>
>   
Acked-by: Alexey Starikovskiy <astarikovskiy@suse.de>
> ---
>
>  drivers/acpi/battery.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> index c2ce0ad..1905b88 100644
> --- a/drivers/acpi/battery.c
> +++ b/drivers/acpi/battery.c
> @@ -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;
>   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] 2.6.24-rc: fix ACPI battery technology reporting
  2007-11-11 22:38 ` Alexey Starikovskiy
@ 2007-12-07  3:31   ` Len Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Len Brown @ 2007-12-07  3:31 UTC (permalink / raw)
  To: Alexey Starikovskiy; +Cc: Andrey Borzenkov, linux-acpi

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

On Sunday 11 November 2007 17:38, Alexey Starikovskiy wrote:
> Andrey Borzenkov wrote:
> > Subject: [PATCH] 2.6.24-rc: fix ACPI battery technology reporting
> > From: Andrey Borzenkov <arvidjaar@mail.ru>
> >
> > 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
> >
> > Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
> >
> >   
> Acked-by: Alexey Starikovskiy <astarikovskiy@suse.de>
> > ---
> >
> >  drivers/acpi/battery.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> > index c2ce0ad..1905b88 100644
> > --- a/drivers/acpi/battery.c
> > +++ b/drivers/acpi/battery.c
> > @@ -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;
> >   
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-12-07  3:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-10 17:02 [PATCH] 2.6.24-rc: fix ACPI battery technology reporting Andrey Borzenkov
2007-11-11 22:38 ` Alexey Starikovskiy
2007-12-07  3:31   ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).