| Index: src/mm-plugin-base.c
|
| diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c
|
| index 8537b4d0cfc208144cf21ccb5df67a02fea704a9..255cdb1024ccccdc45932e8affd8825a39b66b74 100644
|
| --- a/src/mm-plugin-base.c
|
| +++ b/src/mm-plugin-base.c
|
| @@ -18,6 +18,8 @@
|
|
|
| #include <stdio.h>
|
| #include <stdlib.h>
|
| +
|
| +#include <sys/stat.h>
|
| #include <unistd.h>
|
|
|
| #include <string.h>
|
| @@ -898,6 +900,20 @@ real_find_physical_device (MMPluginBase *plugin, GUdevDevice *child)
|
| return physdev;
|
| }
|
|
|
| +static gboolean
|
| +device_file_exists(const char *name)
|
| +{
|
| + char *devfile;
|
| + struct stat s;
|
| + int result;
|
| +
|
| + devfile = g_strdup_printf ("/dev/%s", name);
|
| + result = stat (devfile, &s);
|
| + g_free (devfile);
|
| +
|
| + return (0 == result) ? TRUE : FALSE;
|
| +}
|
| +
|
| static MMPluginSupportsResult
|
| supports_port (MMPlugin *plugin,
|
| const char *subsys,
|
| @@ -930,6 +946,10 @@ supports_port (MMPlugin *plugin,
|
| for (idx = 0; virtual_port[idx]; idx++) {
|
| if (strcmp(name, virtual_port[idx]))
|
| continue;
|
| +
|
| + if (!device_file_exists(virtual_port[idx]))
|
| + continue;
|
| +
|
| task = supports_task_new (self, port, port, "virtual", callback, callback_data);
|
| g_assert (task);
|
| g_hash_table_insert (priv->tasks, g_strdup (key), g_object_ref (task));
|
|
|