Skip to content

Instantly share code, notes, and snippets.

@guiambros
Last active August 23, 2021 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save guiambros/f2bf07f1cc085f8f0b0a9e04c0a767b4 to your computer and use it in GitHub Desktop.
Save guiambros/f2bf07f1cc085f8f0b0a9e04c0a767b4 to your computer and use it in GitHub Desktop.
upower patch
--- up-device.c 2021-07-18 00:27:11.329004126 -0400
+++ up-device-silent.c 2021-07-18 00:27:51.785006055 -0400
@@ -63,6 +63,15 @@
UpDeviceLevel warning_level, battery_level;
UpExportedDevice *skeleton = UP_EXPORTED_DEVICE (device);
+ /* Disable warning notifications for wireless mice with rechargeable batteries */
+ int type = up_exported_device_get_type_ (skeleton);
+ int state = up_exported_device_get_state(skeleton);
+ if (type == UP_DEVICE_KIND_MOUSE && state == UP_DEVICE_STATE_DISCHARGING) {
+ warning_level = UP_DEVICE_LEVEL_NONE;
+ up_exported_device_set_warning_level (skeleton, warning_level);
+ return;
+ }
+
/* If the battery level is available, and is critical,
* we need to fallback to calculations to get the warning
* level, as that might be "action" at this point */
--- up-device.c 2019-06-15 00:18:57.607554731 -0400
+++ up-device-silent.c 2019-06-15 00:19:03.207705276 -0400
@@ -63,6 +63,15 @@
UpDeviceLevel warning_level, battery_level;
UpExportedDevice *skeleton = UP_EXPORTED_DEVICE (device);
+ /* Disable warning notifications for wireless mice with rechargeable batteries */
+ int type = up_exported_device_get_type_ (skeleton);
+ int state = up_exported_device_get_state(skeleton);
+ if (type == UP_DEVICE_KIND_MOUSE && state == UP_DEVICE_STATE_DISCHARGING) {
+ warning_level = UP_DEVICE_LEVEL_NONE;
+ up_exported_device_set_warning_level (skeleton, warning_level);
+ return;
+ }
+
/* Not finished setting up the object? */
if (device->priv->daemon == NULL)
return;
--- up-device.c 2019-06-15 00:18:57.607554731 -0400
+++ up-device-silent.c 2019-06-15 00:19:03.207705276 -0400
@@ -63,6 +63,15 @@
UpDeviceLevel warning_level, battery_level;
UpExportedDevice *skeleton = UP_EXPORTED_DEVICE (device);
+ /* Disable warning notifications for wireless mice with rechargeable batteries */
+ int type = up_exported_device_get_type_ (skeleton);
+ int state = up_exported_device_get_state(skeleton);
+ if ((type == UP_DEVICE_KIND_MOUSE || type == UP_DEVICE_KIND_KEYBOARD) && state == UP_DEVICE_STATE_DISCHARGING) {
+ warning_level = UP_DEVICE_LEVEL_NONE;
+ up_exported_device_set_warning_level (skeleton, warning_level);
+ return;
+ }
+
/* Not finished setting up the object? */
if (device->priv->daemon == NULL)
return;
@Ian-T-Price
Copy link

Make is asking for gudev-1.0 1:234 but the latest version for Ubuntu 20.04 is 233.
Make fails if you set
GUDEV_LIBS=>=233
GUDEV_CFLAGS=>=233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment