diff options
author | Bastien Nocera <hadess@hadess.net> | 2023-02-20 13:56:10 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2023-07-03 16:10:13 +0200 |
commit | 20c5e83f12048b993cefa06822a5bd01463da45f (patch) | |
tree | 06d3f03befa37ba9f5a4c4ed6fc70ec6932801d2 | |
parent | f7142fe5677790c3e5f31e05c7249d0f63b734bd (diff) |
device: Add disconnected property
The property will be FALSE and stay FALSE for all devices, except for
the Linux ones that have a "wireless_status" attribute set to
"disconnected". This will then be used by the backend to hide the device
until the wireless device is turned on again.
-rw-r--r-- | src/up-device.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/up-device.c b/src/up-device.c index 8483c6c..3f22dad 100644 --- a/src/up-device.c +++ b/src/up-device.c @@ -45,6 +45,11 @@ typedef struct gint64 last_refresh; int poll_timeout; + + /* This is TRUE if the wireless_status property is present, and + * its value is "disconnected" + * See https://www.kernel.org/doc/html/latest/driver-api/usb/usb.html#c.usb_interface */ + gboolean disconnected; } UpDevicePrivate; static void up_device_initable_iface_init (GInitableIface *iface); @@ -60,6 +65,7 @@ enum { PROP_NATIVE, PROP_LAST_REFRESH, PROP_POLL_TIMEOUT, + PROP_DISCONNECTED, N_PROPS }; @@ -761,6 +767,10 @@ up_device_set_property (GObject *object, priv->poll_timeout = g_value_get_int (value); break; + case PROP_DISCONNECTED: + priv->disconnected = g_value_get_boolean (value); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } @@ -785,6 +795,10 @@ up_device_get_property (GObject *object, g_value_set_int64 (value, priv->last_refresh); break; + case PROP_DISCONNECTED: + g_value_set_boolean (value, priv->disconnected); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } @@ -834,6 +848,13 @@ up_device_class_init (UpDeviceClass *klass) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE); + properties[PROP_DISCONNECTED] = + g_param_spec_boolean ("disconnected", + "Disconnected", + "Whethe wireless device is disconnected", + FALSE, + G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_READABLE); + g_object_class_install_properties (object_class, N_PROPS, properties); } |