Skip to content

Commit

Permalink
[ffmemless] Add check for device existence to plugin loading
Browse files Browse the repository at this point in the history
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 727ebf1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/plugins/ffmemless/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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));
Expand Down

0 comments on commit 727ebf1

Please sign in to comment.