From e7f623e09adc7858dbc1adb72d212a27bc9b2066 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Wed, 2 Oct 2013 17:57:30 +0200 Subject: [PATCH] plugin: handle ENOSYS as not-supported Allow plugins to return -ENOSYS during registration and handle it as "not-supported" error. It makes the error messages slightly more useful in case kernel-support is missing for a particular subsystem. --- src/plugin.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/plugin.c b/src/plugin.c index 51c98bc90..085e7a526 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -195,9 +195,16 @@ gboolean plugin_init(const char *enable, const char *disable) start: for (list = plugins; list; list = list->next) { struct bluetooth_plugin *plugin = list->data; - - if (plugin->desc->init() < 0) { - error("Failed to init %s plugin", plugin->desc->name); + int err; + + err = plugin->desc->init(); + if (err < 0) { + if (err == -ENOSYS) + warn("System does not support %s plugin", + plugin->desc->name); + else + error("Failed to init %s plugin", + plugin->desc->name); continue; } -- 2.11.0