From 048a2307ee975549624796bde2aaad274fb568ee Mon Sep 17 00:00:00 2001 From: Mathieu Trudel-Lapierre Date: Fri, 23 May 2014 09:34:12 -0400 Subject: [PATCH 1/6] UrfArbitrator: allow the arbitrator to continue if /dev/rfkill is unavailable. Signed-off-by: Mathieu Trudel-Lapierre --- src/urf-arbitrator.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/urf-arbitrator.c b/src/urf-arbitrator.c index ac9b958..5747f65 100644 --- a/src/urf-arbitrator.c +++ b/src/urf-arbitrator.c @@ -564,6 +564,11 @@ urf_arbitrator_startup (UrfArbitrator *arbitrator, if (errno == EACCES) g_warning ("Could not open RFKILL control device, please verify your installation"); return FALSE; + } else { + /* Disable rfkill input */ + ioctl(fd, RFKILL_IOCTL_NOINPUT); + + priv->fd = fd; } /* Set initial flight mode state from persistence */ @@ -571,11 +576,6 @@ urf_arbitrator_startup (UrfArbitrator *arbitrator, urf_arbitrator_set_flight_mode (arbitrator, urf_config_get_persist_state (config, RFKILL_TYPE_ALL)); - /* Disable rfkill input */ - ioctl(fd, RFKILL_IOCTL_NOINPUT); - - priv->fd = fd; - while (1) { ssize_t len; From 39f75c8887c4e9b68020f0edfaddad27d5a21dc9 Mon Sep 17 00:00:00 2001 From: Alfonso Sanchez-Beato Date: Fri, 23 May 2014 09:38:37 -0400 Subject: [PATCH 2/6] UrfDeviceOfono: Online the modem if Powered when initially retrieving properties Signed-off-by: Mathieu Trudel-Lapierre --- src/urf-device-ofono.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/urf-device-ofono.c b/src/urf-device-ofono.c index eb67684..c52ac60 100644 --- a/src/urf-device-ofono.c +++ b/src/urf-device-ofono.c @@ -304,6 +304,11 @@ get_properties_cb (GObject *source_object, g_variant_iter_init (&iter, properties); while (g_variant_iter_next (&iter, "{sv}", &key, &variant)) { + if (g_strcmp0 ("Powered", key) == 0 && + g_variant_get_boolean (variant) == TRUE) { + set_soft (URF_DEVICE (modem), priv->soft); + } + g_hash_table_insert (priv->properties, g_strdup (key), g_variant_ref (variant)); g_variant_unref (variant); From db61308bbc361a4ea8c32fda7509a17d9fec3ac3 Mon Sep 17 00:00:00 2001 From: Mathieu Trudel-Lapierre Date: Tue, 27 May 2014 08:58:55 +0200 Subject: [PATCH 3/6] UrfArbitrator: really don't fail if /dev/rfkill isn't available. Signed-off-by: Mathieu Trudel-Lapierre --- src/urf-arbitrator.c | 62 ++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/urf-arbitrator.c b/src/urf-arbitrator.c index 5747f65..4d45c89 100644 --- a/src/urf-arbitrator.c +++ b/src/urf-arbitrator.c @@ -563,50 +563,50 @@ urf_arbitrator_startup (UrfArbitrator *arbitrator, if (fd < 0) { if (errno == EACCES) g_warning ("Could not open RFKILL control device, please verify your installation"); - return FALSE; } else { /* Disable rfkill input */ ioctl(fd, RFKILL_IOCTL_NOINPUT); priv->fd = fd; - } - /* Set initial flight mode state from persistence */ - if (priv->persist) - urf_arbitrator_set_flight_mode (arbitrator, - urf_config_get_persist_state (config, RFKILL_TYPE_ALL)); - - while (1) { - ssize_t len; + while (1) { + ssize_t len; - len = read(fd, &event, sizeof(event)); - if (len < 0) { - if (errno == EAGAIN) + len = read(fd, &event, sizeof(event)); + if (len < 0) { + if (errno == EAGAIN) + break; + g_debug ("Reading of RFKILL events failed"); break; - g_debug ("Reading of RFKILL events failed"); - break; - } + } - if (len != RFKILL_EVENT_SIZE_V1) { - g_warning("Wrong size of RFKILL event\n"); - continue; - } + if (len != RFKILL_EVENT_SIZE_V1) { + g_warning("Wrong size of RFKILL event\n"); + continue; + } - if (event.op != RFKILL_OP_ADD) - continue; - if (event.type >= NUM_RFKILL_TYPES) - continue; + if (event.op != RFKILL_OP_ADD) + continue; + if (event.type >= NUM_RFKILL_TYPES) + continue; - add_killswitch (arbitrator, event.idx, event.type, event.soft, event.hard); + add_killswitch (arbitrator, event.idx, event.type, event.soft, event.hard); + } + + /* Setup monitoring */ + priv->channel = g_io_channel_unix_new (priv->fd); + g_io_channel_set_encoding (priv->channel, NULL, NULL); + priv->watch_id = g_io_add_watch (priv->channel, + G_IO_IN | G_IO_HUP | G_IO_ERR, + (GIOFunc) event_cb, + arbitrator); } - /* Setup monitoring */ - priv->channel = g_io_channel_unix_new (priv->fd); - g_io_channel_set_encoding (priv->channel, NULL, NULL); - priv->watch_id = g_io_add_watch (priv->channel, - G_IO_IN | G_IO_HUP | G_IO_ERR, - (GIOFunc) event_cb, - arbitrator); + /* Set initial flight mode state from persistence */ + if (priv->persist) + urf_arbitrator_set_flight_mode (arbitrator, + urf_config_get_persist_state (config, RFKILL_TYPE_ALL)); + if (priv->persist) { /* Set all the devices that had saved state to what was saved */ From 809eba238e521da94265e32d45f0f549f8d4daa2 Mon Sep 17 00:00:00 2001 From: Mathieu Trudel-Lapierre Date: Tue, 27 May 2014 09:52:37 +0200 Subject: [PATCH 4/6] profiles: add a QEMU profile where key_control is disabled by default QEMU devices don't necessarily have obvious key control devices available from udev; avoid failing to start urfkill there just because the input controls don't start. Signed-off-by: Mathieu Trudel-Lapierre --- profile/10-qemu-settings.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 profile/10-qemu-settings.xml diff --git a/profile/10-qemu-settings.xml b/profile/10-qemu-settings.xml new file mode 100644 index 0000000..3294c0d --- /dev/null +++ b/profile/10-qemu-settings.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + From 8898022d1dd86ced1f47d283f94711ac4084698f Mon Sep 17 00:00:00 2001 From: Mathieu Trudel-Lapierre Date: Tue, 27 May 2014 08:58:55 +0200 Subject: [PATCH 5/6] UrfArbitrator: really don't fail if /dev/rfkill isn't available. Signed-off-by: Mathieu Trudel-Lapierre --- src/urf-arbitrator.c | 62 ++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/urf-arbitrator.c b/src/urf-arbitrator.c index 5747f65..4d45c89 100644 --- a/src/urf-arbitrator.c +++ b/src/urf-arbitrator.c @@ -563,50 +563,50 @@ urf_arbitrator_startup (UrfArbitrator *arbitrator, if (fd < 0) { if (errno == EACCES) g_warning ("Could not open RFKILL control device, please verify your installation"); - return FALSE; } else { /* Disable rfkill input */ ioctl(fd, RFKILL_IOCTL_NOINPUT); priv->fd = fd; - } - /* Set initial flight mode state from persistence */ - if (priv->persist) - urf_arbitrator_set_flight_mode (arbitrator, - urf_config_get_persist_state (config, RFKILL_TYPE_ALL)); - - while (1) { - ssize_t len; + while (1) { + ssize_t len; - len = read(fd, &event, sizeof(event)); - if (len < 0) { - if (errno == EAGAIN) + len = read(fd, &event, sizeof(event)); + if (len < 0) { + if (errno == EAGAIN) + break; + g_debug ("Reading of RFKILL events failed"); break; - g_debug ("Reading of RFKILL events failed"); - break; - } + } - if (len != RFKILL_EVENT_SIZE_V1) { - g_warning("Wrong size of RFKILL event\n"); - continue; - } + if (len != RFKILL_EVENT_SIZE_V1) { + g_warning("Wrong size of RFKILL event\n"); + continue; + } - if (event.op != RFKILL_OP_ADD) - continue; - if (event.type >= NUM_RFKILL_TYPES) - continue; + if (event.op != RFKILL_OP_ADD) + continue; + if (event.type >= NUM_RFKILL_TYPES) + continue; - add_killswitch (arbitrator, event.idx, event.type, event.soft, event.hard); + add_killswitch (arbitrator, event.idx, event.type, event.soft, event.hard); + } + + /* Setup monitoring */ + priv->channel = g_io_channel_unix_new (priv->fd); + g_io_channel_set_encoding (priv->channel, NULL, NULL); + priv->watch_id = g_io_add_watch (priv->channel, + G_IO_IN | G_IO_HUP | G_IO_ERR, + (GIOFunc) event_cb, + arbitrator); } - /* Setup monitoring */ - priv->channel = g_io_channel_unix_new (priv->fd); - g_io_channel_set_encoding (priv->channel, NULL, NULL); - priv->watch_id = g_io_add_watch (priv->channel, - G_IO_IN | G_IO_HUP | G_IO_ERR, - (GIOFunc) event_cb, - arbitrator); + /* Set initial flight mode state from persistence */ + if (priv->persist) + urf_arbitrator_set_flight_mode (arbitrator, + urf_config_get_persist_state (config, RFKILL_TYPE_ALL)); + if (priv->persist) { /* Set all the devices that had saved state to what was saved */ From 695f155043e4678ca614b9f86cab7b1b7aa6712a Mon Sep 17 00:00:00 2001 From: Mathieu Trudel-Lapierre Date: Tue, 27 May 2014 09:52:37 +0200 Subject: [PATCH 6/6] profiles: add a QEMU profile where key_control is disabled by default QEMU devices don't necessarily have obvious key control devices available from udev; avoid failing to start urfkill there just because the input controls don't start. Signed-off-by: Mathieu Trudel-Lapierre --- profile/10-qemu-settings.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 profile/10-qemu-settings.xml diff --git a/profile/10-qemu-settings.xml b/profile/10-qemu-settings.xml new file mode 100644 index 0000000..3294c0d --- /dev/null +++ b/profile/10-qemu-settings.xml @@ -0,0 +1,11 @@ + + + + + + + + + + +