aboutsummaryrefslogtreecommitdiff
path: root/plugins/mm-plugin-generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mm-plugin-generic.c')
-rw-r--r--plugins/mm-plugin-generic.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/plugins/mm-plugin-generic.c b/plugins/mm-plugin-generic.c
index cdf2c66..a27704b 100644
--- a/plugins/mm-plugin-generic.c
+++ b/plugins/mm-plugin-generic.c
@@ -10,7 +10,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
- * Copyright (C) 2008 - 2009 Dan Williams <dcbw@redhat.com>
+ * Copyright (C) 2008 - 2010 Dan Williams <dcbw@redhat.com>
*/
#include <string.h>
@@ -31,6 +31,7 @@
#include "mm-generic-cdma.h"
#include "mm-errors.h"
#include "mm-serial-parsers.h"
+#include "mm-log.h"
G_DEFINE_TYPE (MMPluginGeneric, mm_plugin_generic, MM_TYPE_PLUGIN_BASE)
@@ -112,6 +113,7 @@ grab_port (MMPluginBase *base,
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path, *driver;
guint32 caps;
+ guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -126,26 +128,35 @@ grab_port (MMPluginBase *base,
g_set_error (error, 0, 0, "Could not get port's sysfs file.");
return NULL;
} else {
- g_message ("%s: (%s/%s) WARNING: missing udev 'device' file",
- mm_plugin_get_name (MM_PLUGIN (base)),
- subsys,
- name);
+ mm_warn ("%s: (%s/%s) WARNING: missing udev 'device' file",
+ mm_plugin_get_name (MM_PLUGIN (base)),
+ subsys,
+ name);
}
}
+ if (!mm_plugin_base_get_device_ids (base, subsys, name, &vendor, &product)) {
+ g_set_error (error, 0, 0, "Could not get modem product ID.");
+ return NULL;
+ }
+
caps = mm_plugin_base_supports_task_get_probed_capabilities (task);
sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
- if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
- modem = mm_generic_gsm_new (sysfs_path,
- mm_plugin_base_supports_task_get_driver (task),
- mm_plugin_get_name (MM_PLUGIN (base)));
- } else if (caps & CAP_CDMA) {
+ if (caps & CAP_CDMA) {
modem = mm_generic_cdma_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)),
!!(caps & MM_PLUGIN_BASE_PORT_CAP_IS856),
- !!(caps & MM_PLUGIN_BASE_PORT_CAP_IS856_A));
+ !!(caps & MM_PLUGIN_BASE_PORT_CAP_IS856_A),
+ vendor,
+ product);
+ } else if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
+ modem = mm_generic_gsm_new (sysfs_path,
+ mm_plugin_base_supports_task_get_driver (task),
+ mm_plugin_get_name (MM_PLUGIN (base)),
+ vendor,
+ product);
}
if (modem) {