mirror of
https://gitlab.freedesktop.org/upower/power-profiles-daemon.git
synced 2026-05-07 14:18:35 +02:00
trickle-charge: Don't write to already configured supplies
Don't write charge type to devices that are already setup with that charge type, it serves no purpose and might cause bugs in some drivers.
This commit is contained in:
parent
b9730ebc3c
commit
92cf0278b0
1 changed files with 6 additions and 1 deletions
|
|
@ -54,8 +54,13 @@ set_charge_type (PpdActionTrickleCharge *action,
|
|||
|
||||
for (l = devices; l != NULL; l = l->next) {
|
||||
GUdevDevice *dev = l->data;
|
||||
const char *value;
|
||||
|
||||
if (!g_udev_device_has_sysfs_attr (dev, CHARGE_TYPE_SYSFS_NAME))
|
||||
value = g_udev_device_get_sysfs_attr_uncached (dev, CHARGE_TYPE_SYSFS_NAME);
|
||||
if (!value)
|
||||
continue;
|
||||
|
||||
if (g_strcmp0 (charge_type, value) == 0)
|
||||
continue;
|
||||
|
||||
ppd_utils_write_sysfs (dev, CHARGE_TYPE_SYSFS_NAME, charge_type, NULL);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue