Le Wed, Sep 27, 2023 at 08:41:51AM +0200, Landry Breuil a écrit :
> hi,
>
> small update mostly merging our patches, but also other fixes per
> https://gitlab.freedesktop.org/upower/upower/-/releases/v1.90.1 &
> https://gitlab.freedesktop.org/upower/upower/-/releases/v1.90.2
>
> future releases drop lid handling for logind (yay) but i havent found
> the corresponding issue/discussion in gitlab.fd.o.
even better with a diff, thanks tb@ :)
? patch-src_up-device-battery_c
? patch-src_up-device_c
? upower-0.99.11-libupower-glib.so.2.1
? upower-0.99.13-libupower-glib.so.2.1
? upower-0.99.7-libupower-glib.so.2.1
? upower-0.99.9-libupower-glib.so.2.1
? upower-1.90.wip.diff
? upower-1.90.wip2.diff
? upower-1.90.wip3.diff
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/upower/Makefile,v
retrieving revision 1.69
diff -u -r1.69 Makefile
--- Makefile 10 Aug 2022 13:34:03 -0000 1.69
+++ Makefile 27 Sep 2023 06:38:34 -0000
@@ -2,7 +2,7 @@
COMMENT = userland power management interface
-V = v1.90.0
+V = v1.90.2
DISTNAME = upower-${V}
PKGNAME = upower-${V:S/v//}
Index: distinfo
===================================================================
RCS file: /cvs/ports/sysutils/upower/distinfo,v
retrieving revision 1.23
diff -u -r1.23 distinfo
--- distinfo 10 Aug 2022 13:34:03 -0000 1.23
+++ distinfo 27 Sep 2023 06:38:34 -0000
@@ -1,2 +1,2 @@
-SHA256 (upower-v1.90.0.tar.gz) = y2Ao8JWCRCLFnZizyZA+LtoqlvxhPxGCTwtjed5++i4=
-SIZE (upower-v1.90.0.tar.gz) = 170168
+SHA256 (upower-v1.90.2.tar.gz) = XE5zZkjwyJ0jaPu+Hm/AWYoVZcS0NbreHWXokCWft1k=
+SIZE (upower-v1.90.2.tar.gz) = 180731
Index: patches/patch-src_openbsd_up-backend_c
===================================================================
RCS file: patches/patch-src_openbsd_up-backend_c
diff -N patches/patch-src_openbsd_up-backend_c
--- patches/patch-src_openbsd_up-backend_c 10 Aug 2022 13:34:03 -0000
1.24
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,159 +0,0 @@
-https://gitlab.freedesktop.org/upower/upower/-/issues/201
-
-Index: src/openbsd/up-backend.c
---- src/openbsd/up-backend.c.orig
-+++ src/openbsd/up-backend.c
-@@ -33,6 +33,7 @@ static void up_backend_init (UpBackend
*backend);
- static void up_backend_finalize (GObject *object);
-
- static gboolean up_backend_apm_get_power_info(struct apm_power_info*);
-+static gpointer up_backend_apm_event_thread(gpointer object);
- UpDeviceState up_backend_apm_get_battery_state_value(u_char battery_state);
- static void up_backend_update_acpibat_state(UpDevice*, struct sensordev);
- static void up_backend_update_lid_status(UpDaemon*);
-@@ -127,10 +128,63 @@ up_apm_device_get_online (UpDevice *device, gboolean *
- gboolean
- up_backend_coldplug (UpBackend *backend, UpDaemon *daemon)
- {
-- backend->priv->daemon = g_object_ref (daemon);
-+ GError *err = NULL;
-+ UpDeviceClass *device_class;
-+ gint64 current_time;
-
-+ backend->priv = up_backend_get_instance_private (backend);
-+ backend->priv->daemon = g_object_ref (daemon);
-+ backend->priv->is_laptop = up_native_is_laptop();
-+ g_debug("is_laptop:%d",backend->priv->is_laptop);
- if (backend->priv->is_laptop)
- {
-+ UpApmNative *acnative = NULL;
-+ UpApmNative *battnative = NULL;
-+
-+ acnative = up_apm_native_new("/ac");
-+ battnative = up_apm_native_new("/batt");
-+
-+ backend->priv->ac = UP_DEVICE(up_device_new
(backend->priv->daemon, G_OBJECT(acnative)));
-+ backend->priv->battery = UP_DEVICE(up_device_new
(backend->priv->daemon, G_OBJECT(battnative)));
-+
-+ g_object_unref (acnative);
-+ g_object_unref (battnative);
-+
-+ device_class = UP_DEVICE_GET_CLASS (backend->priv->battery);
-+ device_class->get_on_battery = up_apm_device_get_on_battery;
-+ device_class->get_online = up_apm_device_get_online;
-+ device_class->refresh = up_apm_device_refresh;
-+ device_class = UP_DEVICE_GET_CLASS (backend->priv->ac);
-+ device_class->get_on_battery = up_apm_device_get_on_battery;
-+ device_class->get_online = up_apm_device_get_online;
-+ device_class->refresh = up_apm_device_refresh;
-+ /* creates thread */
-+ if((backend->priv->apm_thread = (GThread*)
g_thread_try_new("apm-poller",(GThreadFunc)up_backend_apm_event_thread, (void*)
backend, &err)) == NULL)
-+ {
-+ g_warning("Thread create failed: %s", err->message);
-+ g_error_free (err);
-+ }
-+
-+ /* setup dummy */
-+ current_time = g_get_real_time () / G_USEC_PER_SEC;
-+ g_object_set (backend->priv->battery,
-+ "type", UP_DEVICE_KIND_BATTERY,
-+ "power-supply", TRUE,
-+ "is-present", TRUE,
-+ "is-rechargeable", TRUE,
-+ "has-history", TRUE,
-+ "state", UP_DEVICE_STATE_UNKNOWN,
-+ "percentage", 0.0f,
-+ "time-to-empty", (gint64) 0,
-+ "update-time", (guint64) current_time,
-+ (void*) NULL);
-+ g_object_set (backend->priv->ac,
-+ "type", UP_DEVICE_KIND_LINE_POWER,
-+ "online", TRUE,
-+ "power-supply", TRUE,
-+ "update-time", (guint64) current_time,
-+ (void*) NULL);
-+
- up_backend_update_lid_status(daemon);
- if (!g_initable_init (G_INITABLE (backend->priv->ac), NULL,
NULL))
- g_warning ("failed to coldplug ac");
-@@ -142,7 +196,6 @@ up_backend_coldplug (UpBackend *backend, UpDaemon *dae
- else
- g_signal_emit (backend, signals[SIGNAL_DEVICE_ADDED],
0, backend->priv->battery);
- }
--
- return TRUE;
- }
-
-@@ -259,7 +312,7 @@ up_backend_update_battery_state(UpDevice* device)
- gdouble percentage;
- gboolean ret, is_present;
- struct sensordev sdev;
-- UpDeviceState cur_state, new_state;
-+ UpDeviceState cur_state, new_state = UP_DEVICE_STATE_UNKNOWN;
- gint64 cur_time_to_empty, new_time_to_empty;
- struct apm_power_info a;
-
-@@ -597,63 +650,7 @@ up_backend_class_init (UpBackendClass *klass)
- static void
- up_backend_init (UpBackend *backend)
- {
-- GError *err = NULL;
-- UpDeviceClass *device_class;
-- gint64 current_time;
--
- backend->priv = up_backend_get_instance_private (backend);
-- backend->priv->is_laptop = up_native_is_laptop();
-- g_debug("is_laptop:%d",backend->priv->is_laptop);
-- if (backend->priv->is_laptop)
-- {
-- UpApmNative *acnative = NULL;
-- UpApmNative *battnative = NULL;
--
-- acnative = up_apm_native_new("/ac");
-- battnative = up_apm_native_new("/batt");
--
-- backend->priv->ac = UP_DEVICE(up_device_new
(backend->priv->daemon, G_OBJECT(acnative)));
-- backend->priv->battery = UP_DEVICE(up_device_new
(backend->priv->daemon, G_OBJECT(battnative)));
--
-- g_object_unref (acnative);
-- g_object_unref (battnative);
--
-- device_class = UP_DEVICE_GET_CLASS (backend->priv->battery);
-- device_class->get_on_battery = up_apm_device_get_on_battery;
-- device_class->get_online = up_apm_device_get_online;
-- device_class->refresh = up_apm_device_refresh;
-- device_class = UP_DEVICE_GET_CLASS (backend->priv->ac);
-- device_class->get_on_battery = up_apm_device_get_on_battery;
-- device_class->get_online = up_apm_device_get_online;
-- device_class->refresh = up_apm_device_refresh;
-- /* creates thread */
-- if((backend->priv->apm_thread = (GThread*)
g_thread_try_new("apm-poller",(GThreadFunc)up_backend_apm_event_thread, (void*)
backend, &err)) == NULL)
-- {
-- g_warning("Thread create failed: %s", err->message);
-- g_error_free (err);
-- }
--
-- /* setup dummy */
-- current_time = g_get_real_time () / G_USEC_PER_SEC;
-- g_object_set (backend->priv->battery,
-- "type", UP_DEVICE_KIND_BATTERY,
-- "power-supply", TRUE,
-- "is-present", TRUE,
-- "is-rechargeable", TRUE,
-- "has-history", TRUE,
-- "state", UP_DEVICE_STATE_UNKNOWN,
-- "percentage", 0.0f,
-- "time-to-empty", (gint64) 0,
-- "update-time", (guint64) current_time,
-- (void*) NULL);
-- g_object_set (backend->priv->ac,
-- "type", UP_DEVICE_KIND_LINE_POWER,
-- "online", TRUE,
-- "power-supply", TRUE,
-- "update-time", (guint64) current_time,
-- (void*) NULL);
-- }
--
- backend->priv->config = up_config_new ();
- backend->priv->seat_manager_proxy = g_dbus_proxy_new_for_bus_sync
(G_BUS_TYPE_SYSTEM,
- 0,
Index: patches/patch-src_up-device-battery_c
===================================================================
RCS file: patches/patch-src_up-device-battery_c
diff -N patches/patch-src_up-device-battery_c
--- patches/patch-src_up-device-battery_c 10 Aug 2022 13:34:03 -0000
1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-https://gitlab.freedesktop.org/upower/upower/-/merge_requests/164
-
-Index: src/up-device-battery.c
---- src/up-device-battery.c.orig
-+++ src/up-device-battery.c
-@@ -19,6 +19,7 @@
- */
-
- #include <string.h>
-+#include <math.h>
-
- #include "up-constants.h"
- #include "up-config.h"
-@@ -125,7 +126,7 @@ up_device_battery_estimate_power (UpDeviceBattery *sel
- continue;
-
- /* Stop searching if the new reference is further away from the
long timeout. */
-- if (abs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - abs (td)) >
abs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td))
-+ if (llabs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - llabs (td))
> llabs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td))
- break;
-
- ref_td = td;
-@@ -155,7 +156,7 @@ up_device_battery_estimate_power (UpDeviceBattery *sel
- */
- if (cur->state == UP_DEVICE_STATE_UNKNOWN) {
- /* Consider a rate of 0.5W as "no change", otherwise set
CHARGING/DISCHARGING */
-- if (abs(energy_rate) < 0.5)
-+ if (fabs(energy_rate) < 0.5)
- return;
- else if (energy_rate < 0.0)
- cur->state = UP_DEVICE_STATE_DISCHARGING;