summaryrefslogtreecommitdiffstats
path: root/binding/gdbus/ofono_manager.c
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-06-03 15:02:42 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-06-03 15:03:09 -0700
commit19d20dfc03fc1f430c15ec2b4db45e9ec26a9937 (patch)
tree012b17635374732fab48c6987526f79d6d4154e1 /binding/gdbus/ofono_manager.c
parent4d31aa48b0c43612532d1e4dd965291554d3b399 (diff)
binding: telephony: remove indents in ofono_manager_set_default_modem()
Reduce indents in ofono_manager_set_default_modem() function to make it more concise. Bug-AGL: SPEC-2481 Change-Id: I8aabd42c024792afbd95abd0938d1d487afcb318 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/gdbus/ofono_manager.c')
-rw-r--r--binding/gdbus/ofono_manager.c86
1 files changed, 42 insertions, 44 deletions
diff --git a/binding/gdbus/ofono_manager.c b/binding/gdbus/ofono_manager.c
index 98d8c5b..8db5df3 100644
--- a/binding/gdbus/ofono_manager.c
+++ b/binding/gdbus/ofono_manager.c
@@ -48,56 +48,54 @@ int ofono_manager_set_default_modem(const char *address)
const gchar *name = NULL, *type = NULL, *serial = NULL;
gboolean powered = FALSE, online = FALSE;
GVariantIter *iter, *iter2 = NULL;
- int ret = 0;
/* Fetch all visible modems */
org_ofono_manager_call_get_modems_sync(manager, &out_arg, NULL, &error);
- if (error == NULL) {
- g_variant_get(out_arg, "a(oa{sv})", &iter);
- /* Iterate over each modem */
- while ((next = g_variant_iter_next_value(iter))) {
- g_variant_get(next, "(oa{sv})", &path, &iter2);
- while (g_variant_iter_loop(iter2, "{sv}", &key, &value)) {
- if (!strcmp(key, "Name"))
- name = g_variant_get_string(value, NULL);
- else if (!strcmp(key, "Online"))
- online = g_variant_get_boolean(value);
- else if (!strcmp(key, "Powered"))
- powered = g_variant_get_boolean(value);
- else if (!strcmp(key, "Serial"))
- serial = g_variant_get_string(value, NULL);
- else if (!strcmp(key, "Type"))
- type = g_variant_get_string(value, NULL);
- }
-
- /* If not a HFP modem then continue */
- if (g_strcmp0(type, "hfp"))
- continue;
-
- /* If address is NULL then use the first modem as default,
- * and if not then continue if doesn't match address.
- */
- if (address && g_strcmp0(address, serial))
- continue;
-
- /* If powered, and online then set as default */
- if (powered && online) {
- default_modem.address = serial;
- default_modem.path = path;
- default_modem.name = name;
- default_modem.type = type;
- default_modem.powered = powered;
- default_modem.online = online;
- default_modem.valid = TRUE;
- AFB_NOTICE("New modem: %s (%s)", name, serial);
- break;
- }
+ if (error != NULL)
+ return -1;
+
+ g_variant_get(out_arg, "a(oa{sv})", &iter);
+ /* Iterate over each modem */
+ while ((next = g_variant_iter_next_value(iter))) {
+ g_variant_get(next, "(oa{sv})", &path, &iter2);
+ while (g_variant_iter_loop(iter2, "{sv}", &key, &value)) {
+ if (!strcmp(key, "Name"))
+ name = g_variant_get_string(value, NULL);
+ else if (!strcmp(key, "Online"))
+ online = g_variant_get_boolean(value);
+ else if (!strcmp(key, "Powered"))
+ powered = g_variant_get_boolean(value);
+ else if (!strcmp(key, "Serial"))
+ serial = g_variant_get_string(value, NULL);
+ else if (!strcmp(key, "Type"))
+ type = g_variant_get_string(value, NULL);
+ }
+
+ /* If not a HFP modem then continue */
+ if (g_strcmp0(type, "hfp"))
+ continue;
+
+ /* If address is NULL then use the first modem as default,
+ * and if not then continue if doesn't match address.
+ */
+ if (address && g_strcmp0(address, serial))
+ continue;
+
+ /* If powered, and online then set as default */
+ if (powered && online) {
+ default_modem.address = serial;
+ default_modem.path = path;
+ default_modem.name = name;
+ default_modem.type = type;
+ default_modem.powered = powered;
+ default_modem.online = online;
+ default_modem.valid = TRUE;
+ AFB_NOTICE("New modem: %s (%s)", name, serial);
+ break;
}
- } else {
- ret = -1;
}
- return ret;
+ return 0;
}
int ofono_manager_init()
upport layer This yocto layer adds support for using DRM leases to partition display controller output resources between multiple processes. This layer adds a drm-lease-manager deamon (with systemd configuration) and a client library for receiving DRM leases from the daemon. For more details the DRM lease manager and client see the repository at (https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/drm-lease-manager.git) ## Setup Enable the `agl-drm-lease` AGL feature when setting up your build environment with aglsetup.sh. This will add the `drm-lease-manager` package to the image, and will add DRM lease support to the following packages: * weston * kmscube `kmscube` is not included in the image by default. To add the package to the image, add the following to your local.conf ``` IMAGE_INSTALL:append = " kmscube" ``` ## Starting the DRM lease manager The drm-lease-manager must be the only process to directly open the DRM device. Shut down any running window systems (eg. weston or agl-compositor) and run: ``` # systemctl start drm-lease-manager ``` This will create 1 lease for each output connection on the platform. The name of each lease will be in the form of `card0-<output name>` (eg. `card0-LVDS-1` or `card0-HDMI-A-1`) ## Running weston weston can be started on any available DRM lease by running with the `--drm-lease=<lease name>` option. Eg: ``` # weston --drm-lease=card0-HDMI-A-1 ``` ## Running kmscube sample With the `drm-lease-manager` running `kmscube` can display on any available lease by running with the `-L -D<lease name>` options. Eg: ``` # kmscube -L -Dcard0-HDMI-A-1 ``` Multiple kmscube instances (one per DRM lease) can be started at the same time. ## Tested targets This layer has been tested on the Renesas R-Car Gen3 platform. Other platforms supporting the Linux DRM API may work as well.