Skip to content

Battery status remains unchanged with eudev pre 3.2.14 and libgudev 238 #254

@NaofumiHonda

Description

@NaofumiHonda

This issue is completely irrelevant with a current tag implementation.
A cause of the problem is that the behavior of udev_device_set_sysattr_value() in udev is recently modified so that
a cache value of sysfs attr is cleared when it is called with a null pointer value.
According to this change, libgudev's g_udev_device_get_sysfs_attr_uncached is quite simplified in version 238 like

   udev_device_set_sysattr_value (device->priv->udevice, name, NULL);                                 
   return g_udev_device_get_sysfs_attr (device, name);   

Under the above implementation, for example, upower always get cached values of battery state because the current eudev does not clear cached values in udev_device_set_sysattr_value() call with a null pointer value.

A solution is very easy to add the following code in udev_device_set_sysattr_value:

       if (value == NULL) {                                                                       
               struct udev_list_entry *list_entry;                                                  
                                                                                                    
               list_entry = udev_list_get_entry(&udev_device->sysattr_value_list);                  
               list_entry = udev_list_entry_get_by_name(list_entry, sysattr);                       
               if (list_entry != NULL)                                                              
                       udev_list_entry_delete(list_entry);                                          
               ret = 0;                                                                             
               goto out;                                                                            
       }                 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions