Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libgusb for openSUSE:Factory checked in at 2022-05-10 15:11:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libgusb (Old) and /work/SRC/openSUSE:Factory/.libgusb.new.1538 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libgusb" Tue May 10 15:11:23 2022 rev:22 rq:975740 version:0.3.10 Changes: -------- --- /work/SRC/openSUSE:Factory/libgusb/libgusb.changes 2021-12-23 17:53:40.683716461 +0100 +++ /work/SRC/openSUSE:Factory/.libgusb.new.1538/libgusb.changes 2022-05-10 15:11:30.171537703 +0200 @@ -1,0 +2,7 @@ +Mon May 9 07:58:08 UTC 2022 - Paolo Stivanin <[email protected]> + +- Update to version 0.3.10: + + New Features: + - Add API to change the hotplug poll interval. + +------------------------------------------------------------------- Old: ---- libgusb-0.3.9.tar.xz New: ---- libgusb-0.3.10.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libgusb.spec ++++++ --- /var/tmp/diff_new_pack.9OfF0c/_old 2022-05-10 15:11:32.019540033 +0200 +++ /var/tmp/diff_new_pack.9OfF0c/_new 2022-05-10 15:11:32.023540037 +0200 @@ -1,7 +1,7 @@ # # spec file for package libgusb # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: libgusb -Version: 0.3.9 +Version: 0.3.10 Release: 0 Summary: GObject-based library for libusb1 License: LGPL-2.1-or-later ++++++ libgusb-0.3.9.tar.xz -> libgusb-0.3.10.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgusb-0.3.9/NEWS new/libgusb-0.3.10/NEWS --- old/libgusb-0.3.9/NEWS 2021-12-07 11:37:59.372745000 +0100 +++ new/libgusb-0.3.10/NEWS 2022-01-10 10:57:29.576743000 +0100 @@ -1,3 +1,10 @@ +Version 0.3.10 +~~~~~~~~~~~~~~ +Released: 2021-01-10 + +New Features: + - Add API to change the hotplug poll interval (Richard Hughes) + Version 0.3.9 ~~~~~~~~~~~~~ Released: 2021-12-07 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgusb-0.3.9/RELEASE.md new/libgusb-0.3.10/RELEASE.md --- old/libgusb-0.3.9/RELEASE.md 2021-12-07 11:37:59.372745000 +0100 +++ new/libgusb-0.3.10/RELEASE.md 2022-01-10 10:57:29.576743000 +0100 @@ -3,10 +3,10 @@ Write `NEWS` entries for GUsb in the same format as usual. - git shortlog 0.3.8.. | grep -i -v trivial | grep -v Merge > NEWS.new + git shortlog 0.3.9.. | grep -i -v trivial | grep -v Merge > NEWS.new ================================================= - Version 0.3.9 - ~~~~~~~~~~~~~ + Version 0.3.10 + ~~~~~~~~~~~~~~ Released: 2021-xx-xx Notes: @@ -19,7 +19,7 @@ Update library version if new ABI or API in `meson.build`, commit, and build tarball: # MAKE SURE THIS IS CORRECT - export release_ver="0.3.9" + export release_ver="0.3.10" git commit -a -m "Release version ${release_ver}" git tag -s -f -m "Release ${release_ver}" "${release_ver}" @@ -41,7 +41,7 @@ Send an email to [email protected] ================================================= - GUsb 0.3.9 released! + GUsb 0.3.10 released! GUsb is a GObject wrapper for libusb1 that makes it easy to do asynchronous control, bulk and interrupt transfers with proper diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgusb-0.3.9/gusb/gusb-context.c new/libgusb-0.3.10/gusb/gusb-context.c --- old/libgusb-0.3.9/gusb/gusb-context.c 2021-12-07 11:37:59.374745100 +0100 +++ new/libgusb-0.3.10/gusb/gusb-context.c 2022-01-10 10:57:29.578743000 +0100 @@ -35,6 +35,8 @@ LAST_SIGNAL }; +#define G_USB_CONTEXT_HOTPLUG_POLL_INTERVAL_DEFAULT 1000 /* ms */ + /** * GUsbContextPrivate: * @@ -50,6 +52,7 @@ gboolean done_enumerate; volatile gint thread_event_run; guint hotplug_poll_id; + guint hotplug_poll_interval; int debug_level; GUsbContextFlags flags; libusb_context *ctx; @@ -282,10 +285,8 @@ if (priv->done_enumerate) device = g_usb_context_find_by_bus_address (context, bus, address, NULL); - if (device != NULL) { - g_debug ("%i:%i already exists", bus, address); + if (device != NULL) goto out; - } /* add the device */ device = _g_usb_device_new (context, dev, &error); @@ -509,6 +510,70 @@ } } +static void +g_usb_context_ensure_rescan_timeout (GUsbContext *context) +{ + GUsbContextPrivate *priv = context->priv; + + if (priv->hotplug_poll_id > 0) { + g_source_remove (priv->hotplug_poll_id); + priv->hotplug_poll_id = 0; + } + if (priv->hotplug_poll_interval > 0) { + priv->hotplug_poll_id = g_timeout_add (priv->hotplug_poll_interval, + g_usb_context_rescan_cb, + context); + } +} + +/** + * g_usb_context_get_hotplug_poll_interval: + * @context: a #GUsbContext + * + * Gets the poll interval for platforms like Windows that do not support `LIBUSB_CAP_HAS_HOTPLUG`. + * + * Return value: (transfer none): the interval in ms + * + * Since: 0.3.10 + **/ +guint +g_usb_context_get_hotplug_poll_interval (GUsbContext *context) +{ + GUsbContextPrivate *priv = context->priv; + g_return_val_if_fail (G_USB_IS_CONTEXT (context), G_MAXUINT); + return priv->hotplug_poll_id; +} + +/** + * g_usb_context_set_hotplug_poll_interval: + * @context: a #GUsbContext + * @hotplug_poll_interval: the interval in ms + * + * Sets the poll interval for platforms like Windows that do not support `LIBUSB_CAP_HAS_HOTPLUG`. + * This defaults to 1000ms and can be changed before or after g_usb_context_enumerate() has been + * called. + * + * Since: 0.3.10 + **/ +void +g_usb_context_set_hotplug_poll_interval (GUsbContext *context, + guint hotplug_poll_interval) +{ + GUsbContextPrivate *priv = context->priv; + + g_return_if_fail (G_USB_IS_CONTEXT (context)); + + /* same */ + if (priv->hotplug_poll_interval == hotplug_poll_interval) + return; + + priv->hotplug_poll_interval = hotplug_poll_interval; + + /* if already running then change the existing timeout */ + if (priv->hotplug_poll_id > 0) + g_usb_context_ensure_rescan_timeout (context); +} + /** * g_usb_context_enumerate: * @context: a #GUsbContext @@ -532,9 +597,7 @@ g_usb_context_rescan (context); if (!libusb_has_capability (LIBUSB_CAP_HAS_HOTPLUG)) { g_debug ("platform does not do hotplug, using polling"); - priv->hotplug_poll_id = g_timeout_add_seconds (1, - g_usb_context_rescan_cb, - context); + g_usb_context_ensure_rescan_timeout (context); } priv->done_enumerate = TRUE; @@ -601,6 +664,7 @@ priv = context->priv = g_usb_context_get_instance_private (context); priv->flags = G_USB_CONTEXT_FLAGS_NONE; + priv->hotplug_poll_interval = G_USB_CONTEXT_HOTPLUG_POLL_INTERVAL_DEFAULT; priv->devices = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref); priv->dict_usb_ids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); priv->dict_replug = g_hash_table_new_full (g_str_hash, g_str_equal, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgusb-0.3.9/gusb/gusb-context.h new/libgusb-0.3.10/gusb/gusb-context.h --- old/libgusb-0.3.9/gusb/gusb-context.h 2021-12-07 11:37:59.374745100 +0100 +++ new/libgusb-0.3.10/gusb/gusb-context.h 2022-01-10 10:57:29.578743000 +0100 @@ -76,6 +76,9 @@ GMainContext *g_usb_context_get_main_context (GUsbContext *context); void g_usb_context_set_main_context (GUsbContext *context, GMainContext *main_ctx); +guint g_usb_context_get_hotplug_poll_interval(GUsbContext *context); +void g_usb_context_set_hotplug_poll_interval(GUsbContext *context, + guint hotplug_poll_interval); void g_usb_context_enumerate (GUsbContext *context); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgusb-0.3.9/gusb/libgusb.ver new/libgusb-0.3.10/gusb/libgusb.ver --- old/libgusb-0.3.9/gusb/libgusb.ver 2021-12-07 11:37:59.376745000 +0100 +++ new/libgusb-0.3.10/gusb/libgusb.ver 2022-01-10 10:57:29.580742800 +0100 @@ -159,3 +159,10 @@ g_usb_device_get_string_descriptor_bytes_full; local: *; } LIBGUSB_0.3.6; + +LIBGUSB_0.3.10 { + global: + g_usb_context_get_hotplug_poll_interval; + g_usb_context_set_hotplug_poll_interval; + local: *; +} LIBGUSB_0.3.8; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgusb-0.3.9/meson.build new/libgusb-0.3.10/meson.build --- old/libgusb-0.3.9/meson.build 2021-12-07 11:37:59.376745000 +0100 +++ new/libgusb-0.3.10/meson.build 2022-01-10 10:57:29.580742800 +0100 @@ -1,5 +1,5 @@ project('libgusb', 'c', - version : '0.3.9', + version : '0.3.10', license : 'LGPL-2.1+', meson_version : '>=0.46.0', default_options : ['c_std=c99']
