[EMAIL PROTECTED] wrote:
> Author:       mekius
> Date:         2008-09-12 14:31:46 -0700 (Fri, 12 Sep 2008)
> New Revision: 35971
>
> Modified:
>   trunk/e/src/modules/battery/batget.c 
> Log:
>
> Fix a couple typos and detection of sysfs acpi battery info.
>
> Modified: trunk/e/src/modules/battery/batget.c
> ===================================================================
> --- trunk/e/src/modules/battery/batget.c      2008-09-12 21:26:53 UTC (rev 
> 35970)
> +++ trunk/e/src/modules/battery/batget.c      2008-09-12 21:31:46 UTC (rev 
> 35971)
> @@ -434,7 +434,7 @@
>  static Ecore_Timer *sys_class_delay_check = NULL;
>  
>  static int
> -linux_sys_class_powe_supply_cb_delay_check(void *data)
> +linux_sys_class_power_supply_cb_delay_check(void *data)
>  {
>     linux_sys_class_power_supply_init();
>     poll_cb(NULL);
> @@ -445,7 +445,7 @@
>  static Ecore_Timer *re_init_timer = NULL;
>  
>  static int
> -linux_sys_class_powe_supply_cb_re_init(void *data)
> +linux_sys_class_power_supply_cb_re_init(void *data)
>  {
>     Sys_Class_Power_Supply_Uevent *sysev;
>     
> @@ -506,12 +506,12 @@
>            free(sysev);
>            
>            if (re_init_timer) ecore_timer_del(re_init_timer);
> -          re_init_timer = ecore_timer_add(1.0, 
> linux_sys_class_powe_supply_cb_re_init, NULL);
> +          re_init_timer = ecore_timer_add(1.0, 
> linux_sys_class_power_supply_cb_re_init, NULL);
>         }
>       else
>         {
>            if (sys_class_delay_check) ecore_timer_del(sys_class_delay_check);
> -          sys_class_delay_check = ecore_timer_add(0.2, 
> linux_sys_class_powe_supply_cb_delay_check, NULL);
> +          sys_class_delay_check = ecore_timer_add(0.2, 
> linux_sys_class_power_supply_cb_delay_check, NULL);
>         }
>       }
>     return 1;
> @@ -603,6 +603,24 @@
>       }
>  }
>  
> +static int
> +linux_sys_class_power_supply_is_battery(char *name)
> +{
> +  int fd;
> +  char buf[255];
> +  char tmp[255];
> +
> +  memset(tmp, 0, 255);
> +  snprintf(buf, 255, "/sys/class/power_supply/%s/type", name);
> +  if (!(fd = open(buf, O_RDONLY)))
> +    return 0;
> +  if (read(fd, tmp, 255) < 1)
> +    return 0;
> +  if (!strncmp(tmp, "Battery", 7))
> +    return 1;
>   
close(fd);

I'm sorry i forget to close the filedescriptor.. so my patch is not so 
great :) Sorry again.
> +  return 0;
> +}
> +
>  static void
>  linux_sys_class_power_supply_init(void)
>  {
> @@ -627,8 +645,9 @@
>            while ((name = ecore_list_next(bats)))
>              {
>                 Sys_Class_Power_Supply_Uevent *sysev;
> -          
> -               if (strncasecmp("bat", name, 3)) continue;
> +
> +               if (!(linux_sys_class_power_supply_is_battery(name)))
> +                 continue;
>                 sysev = E_NEW(Sys_Class_Power_Supply_Uevent, 1);
>                 sysev->name = strdup(name);
>                 snprintf(buf, sizeof(buf), 
> "/sys/class/power_supply/%s/uevent", name);
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> enlightenment-svn mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>   


-- 
Bauland 'rookmoot' Stephane                    | Epitech lille
Assistant Epitech Roux                         | [EMAIL PROTECTED]
~ "eh tizot, ti quere el'pitech ? hein ?" - "bah ouai t'inquiete !" ~


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to