Skip to content
Permalink
Browse files

[ffmemless] Add check for device existence to plugin loading

Ngfd fails to run in SDK as there is no ffmemless device, and
a sink failing init will stop whole ngfd from working. Added
a check to plugin load for the device existance, so we don't
even load the plugin if we can't run it.

Signed-off-by: Kalle Jokiniemi <kalle.jokiniemi@jollamobile.com>
  • Loading branch information
Kalle Jokiniemi committed Oct 16, 2013
1 parent 8290f99 commit 727ebf17903df0519a8ce6bd7da980a1f007aba5
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/plugins/ffmemless/plugin.c
@@ -659,6 +659,7 @@ N_PLUGIN_LOAD(plugin)
{
const NProplist *props = n_plugin_get_params(plugin);
const gchar *system_settings_file;
int device_fd;

N_DEBUG (LOG_CAT "plugin load");

@@ -673,6 +674,14 @@ N_PLUGIN_LOAD(plugin)
.stop = ffm_sink_stop
};

/* Checking if there is a device, no point in loading plugin if not..*/
device_fd = ffmemless_evdev_file_search();
if (device_fd < 0) {
N_DEBUG (LOG_CAT "No force feedback device, stopping plugin");
return FALSE;
}
ffmemless_evdev_file_close(device_fd);

ffm.ngfd_props = props;
system_settings_file = g_getenv(n_proplist_get_string(props,
FFM_SYSTEM_CONFIG_KEY));

0 comments on commit 727ebf1

Please sign in to comment.