core: use hardware IDs as part of DeviceIdentifier

Pass the device's hardware IDs through modem creation and use them
when calculating the device's identifier.  Add a bunch of testcases
for real hardware to ensure we don't break the device ID in the
future unless we really want to.
This commit is contained in:
Dan Williams
2010-10-22 11:06:48 -05:00
parent 328d2369a9
commit 7ae8ffe21b
60 changed files with 716 additions and 94 deletions
+5 -1
View File
@@ -39,7 +39,9 @@ mm_modem_anydata_cdma_new (const char *device,
const char *driver,
const char *plugin,
gboolean evdo_rev0,
gboolean evdo_revA)
gboolean evdo_revA,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -52,6 +54,8 @@ mm_modem_anydata_cdma_new (const char *device,
MM_GENERIC_CDMA_EVDO_REV0, evdo_rev0,
MM_GENERIC_CDMA_EVDO_REVA, evdo_revA,
MM_GENERIC_CDMA_REGISTRATION_TRY_CSS, FALSE,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -40,6 +40,8 @@ MMModem *mm_modem_anydata_cdma_new (const char *device,
const char *driver,
const char *plugin,
gboolean evdo_rev0,
gboolean evdo_revA);
gboolean evdo_revA,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_ANYDATA_CDMA_H */
+5 -1
View File
@@ -36,7 +36,9 @@ G_DEFINE_TYPE_EXTENDED (MMModemGobiGsm, mm_modem_gobi_gsm, MM_TYPE_GENERIC_GSM,
MMModem *
mm_modem_gobi_gsm_new (const char *device,
const char *driver,
const char *plugin)
const char *plugin,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -46,6 +48,8 @@ mm_modem_gobi_gsm_new (const char *device,
MM_MODEM_MASTER_DEVICE, device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -38,6 +38,8 @@ GType mm_modem_gobi_gsm_get_type (void);
MMModem *mm_modem_gobi_gsm_new (const char *device,
const char *driver,
const char *plugin_name);
const char *plugin_name,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_GOBI_GSM_H */
+5 -1
View File
@@ -74,7 +74,9 @@ typedef struct {
MMModem *
mm_modem_hso_new (const char *device,
const char *driver,
const char *plugin)
const char *plugin,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -85,6 +87,8 @@ mm_modem_hso_new (const char *device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_MODEM_IP_METHOD, MM_MODEM_IP_METHOD_STATIC,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -38,7 +38,9 @@ GType mm_modem_hso_get_type (void);
MMModem *mm_modem_hso_new (const char *device,
const char *driver,
const char *plugin);
const char *plugin,
guint32 vendor,
guint32 product);
void mm_hso_modem_authenticate (MMModemHso *self,
const char *username,
+5 -1
View File
@@ -39,7 +39,9 @@ mm_modem_huawei_cdma_new (const char *device,
const char *driver,
const char *plugin,
gboolean evdo_rev0,
gboolean evdo_revA)
gboolean evdo_revA,
guint32 vendor,
guint32 product)
{
gboolean try_css = TRUE;
@@ -61,6 +63,8 @@ mm_modem_huawei_cdma_new (const char *device,
MM_GENERIC_CDMA_EVDO_REV0, evdo_rev0,
MM_GENERIC_CDMA_EVDO_REVA, evdo_revA,
MM_GENERIC_CDMA_REGISTRATION_TRY_CSS, try_css,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -40,6 +40,8 @@ MMModem *mm_modem_huawei_cdma_new (const char *device,
const char *driver,
const char *plugin,
gboolean evdo_rev0,
gboolean evdo_revA);
gboolean evdo_revA,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_HUAWEI_CDMA_H */
+5 -1
View File
@@ -50,7 +50,9 @@ typedef struct {
MMModem *
mm_modem_huawei_gsm_new (const char *device,
const char *driver,
const char *plugin)
const char *plugin,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -60,6 +62,8 @@ mm_modem_huawei_gsm_new (const char *device,
MM_MODEM_MASTER_DEVICE, device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -38,6 +38,8 @@ GType mm_modem_huawei_gsm_get_type (void);
MMModem *mm_modem_huawei_gsm_new (const char *device,
const char *driver,
const char *plugin);
const char *plugin,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_HUAWEI_GSM_H */
+5 -1
View File
@@ -30,7 +30,9 @@ G_DEFINE_TYPE (MMModemLongcheerGsm, mm_modem_longcheer_gsm, MM_TYPE_GENERIC_GSM)
MMModem *
mm_modem_longcheer_gsm_new (const char *device,
const char *driver,
const char *plugin)
const char *plugin,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -40,6 +42,8 @@ mm_modem_longcheer_gsm_new (const char *device,
MM_MODEM_MASTER_DEVICE, device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -38,6 +38,8 @@ GType mm_modem_longcheer_gsm_get_type (void);
MMModem *mm_modem_longcheer_gsm_new (const char *device,
const char *driver,
const char *plugin);
const char *plugin,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_LONGCHEER_H */
+5 -1
View File
@@ -82,7 +82,9 @@ mbm_modem_authenticate (MMModemMbm *self,
MMModem *
mm_modem_mbm_new (const char *device,
const char *driver,
const char *plugin)
const char *plugin,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -93,6 +95,8 @@ mm_modem_mbm_new (const char *device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_MODEM_IP_METHOD, MM_MODEM_IP_METHOD_DHCP,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -43,6 +43,8 @@ GType mm_modem_mbm_get_type (void);
MMModem *mm_modem_mbm_new (const char *device,
const char *driver,
const char *plugin_name);
const char *plugin_name,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_MBM_H */
+5 -1
View File
@@ -35,7 +35,9 @@ G_DEFINE_TYPE_EXTENDED (MMModemMotoCGsm, mm_modem_moto_c_gsm, MM_TYPE_GENERIC_GS
MMModem *
mm_modem_moto_c_gsm_new (const char *device,
const char *driver,
const char *plugin)
const char *plugin,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -45,6 +47,8 @@ mm_modem_moto_c_gsm_new (const char *device,
MM_MODEM_MASTER_DEVICE, device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -38,6 +38,8 @@ GType mm_modem_moto_c_gsm_get_type (void);
MMModem *mm_modem_moto_c_gsm_new (const char *device,
const char *driver,
const char *plugin_name);
const char *plugin_name,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_MOTO_C_GSM_H */
+5 -1
View File
@@ -30,7 +30,9 @@ G_DEFINE_TYPE_EXTENDED (MMModemNokia, mm_modem_nokia, MM_TYPE_GENERIC_GSM, 0,
MMModem *
mm_modem_nokia_new (const char *device,
const char *driver,
const char *plugin)
const char *plugin,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -40,6 +42,8 @@ mm_modem_nokia_new (const char *device,
MM_MODEM_MASTER_DEVICE, device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -38,6 +38,8 @@ GType mm_modem_nokia_get_type (void);
MMModem *mm_modem_nokia_new (const char *data,
const char *driver,
const char *plugin);
const char *plugin,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_NOKIA_H */
+3 -1
View File
@@ -37,7 +37,9 @@ mm_modem_novatel_cdma_new (const char *device,
const char *driver,
const char *plugin,
gboolean evdo_rev0,
gboolean evdo_revA)
gboolean evdo_revA,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
+3 -1
View File
@@ -40,6 +40,8 @@ MMModem *mm_modem_novatel_cdma_new (const char *device,
const char *driver,
const char *plugin,
gboolean evdo_rev0,
gboolean evdo_revA);
gboolean evdo_revA,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_NOVATEL_CDMA_H */
+5 -1
View File
@@ -33,7 +33,9 @@ G_DEFINE_TYPE_EXTENDED (MMModemNovatelGsm, mm_modem_novatel_gsm, MM_TYPE_GENERIC
MMModem *
mm_modem_novatel_gsm_new (const char *device,
const char *driver,
const char *plugin)
const char *plugin,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -43,6 +45,8 @@ mm_modem_novatel_gsm_new (const char *device,
MM_MODEM_MASTER_DEVICE, device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -38,6 +38,8 @@ GType mm_modem_novatel_gsm_get_type (void);
MMModem *mm_modem_novatel_gsm_new (const char *device,
const char *driver,
const char *plugin_name);
const char *plugin_name,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_NOVATEL_GSM_H */
+5 -1
View File
@@ -36,7 +36,9 @@ typedef struct {
MMModem *
mm_modem_option_new (const char *device,
const char *driver,
const char *plugin)
const char *plugin,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -46,6 +48,8 @@ mm_modem_option_new (const char *device,
MM_MODEM_MASTER_DEVICE, device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -38,6 +38,8 @@ GType mm_modem_option_get_type (void);
MMModem *mm_modem_option_new (const char *device,
const char *driver,
const char *plugin_name);
const char *plugin_name,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_OPTION_H */
+5 -1
View File
@@ -51,7 +51,9 @@ mm_modem_sierra_cdma_new (const char *device,
const char *driver,
const char *plugin,
gboolean evdo_rev0,
gboolean evdo_revA)
gboolean evdo_revA,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -63,6 +65,8 @@ mm_modem_sierra_cdma_new (const char *device,
MM_MODEM_PLUGIN, plugin,
MM_GENERIC_CDMA_EVDO_REV0, evdo_rev0,
MM_GENERIC_CDMA_EVDO_REVA, evdo_revA,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -40,6 +40,8 @@ MMModem *mm_modem_sierra_cdma_new (const char *device,
const char *driver,
const char *plugin,
gboolean evdo_rev0,
gboolean evdo_revA);
gboolean evdo_revA,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_SIERRA_CDMA_H */
+5 -1
View File
@@ -38,7 +38,9 @@ typedef struct {
MMModem *
mm_modem_sierra_gsm_new (const char *device,
const char *driver,
const char *plugin)
const char *plugin,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -48,6 +50,8 @@ mm_modem_sierra_gsm_new (const char *device,
MM_MODEM_MASTER_DEVICE, device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -38,6 +38,8 @@ GType mm_modem_sierra_gsm_get_type (void);
MMModem *mm_modem_sierra_gsm_new (const char *device,
const char *driver,
const char *plugin_name);
const char *plugin_name,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_SIERRA_GSM_H */
+5 -1
View File
@@ -34,7 +34,9 @@ G_DEFINE_TYPE_EXTENDED (MMModemSimtechGsm, mm_modem_simtech_gsm, MM_TYPE_GENERIC
MMModem *
mm_modem_simtech_gsm_new (const char *device,
const char *driver,
const char *plugin)
const char *plugin,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -44,6 +46,8 @@ mm_modem_simtech_gsm_new (const char *device,
MM_MODEM_MASTER_DEVICE, device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -38,6 +38,8 @@ GType mm_modem_simtech_gsm_get_type (void);
MMModem *mm_modem_simtech_gsm_new (const char *device,
const char *driver,
const char *plugin);
const char *plugin,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_SIMTECH_H */
+5 -1
View File
@@ -31,7 +31,9 @@ G_DEFINE_TYPE (MMModemX22xGsm, mm_modem_x22x_gsm, MM_TYPE_GENERIC_GSM)
MMModem *
mm_modem_x22x_gsm_new (const char *device,
const char *driver,
const char *plugin)
const char *plugin,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -41,6 +43,8 @@ mm_modem_x22x_gsm_new (const char *device,
MM_MODEM_MASTER_DEVICE, device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -38,6 +38,8 @@ GType mm_modem_x22x_gsm_get_type (void);
MMModem *mm_modem_x22x_gsm_new (const char *device,
const char *driver,
const char *plugin);
const char *plugin,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_X22X_H */
+5 -1
View File
@@ -41,7 +41,9 @@ typedef struct {
MMModem *
mm_modem_zte_new (const char *device,
const char *driver,
const char *plugin)
const char *plugin,
guint32 vendor,
guint32 product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -51,6 +53,8 @@ mm_modem_zte_new (const char *device,
MM_MODEM_MASTER_DEVICE, device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_MODEM_HW_VID, vendor,
MM_MODEM_HW_PID, product,
NULL));
}
+3 -1
View File
@@ -38,6 +38,8 @@ GType mm_modem_zte_get_type (void);
MMModem *mm_modem_zte_new (const char *device,
const char *driver,
const char *plugin);
const char *plugin,
guint32 vendor,
guint32 product);
#endif /* MM_MODEM_ZTE_H */
+9 -1
View File
@@ -110,6 +110,7 @@ grab_port (MMPluginBase *base,
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path;
guint32 caps;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -129,6 +130,11 @@ grab_port (MMPluginBase *base,
return NULL;
}
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;
}
sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
if (caps & CAP_CDMA) {
@@ -136,7 +142,9 @@ grab_port (MMPluginBase *base,
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);
}
if (modem) {
+12 -2
View File
@@ -112,6 +112,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);
@@ -133,6 +134,11 @@ grab_port (MMPluginBase *base,
}
}
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) {
@@ -141,11 +147,15 @@ grab_port (MMPluginBase *base,
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)));
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
}
if (modem) {
+12 -2
View File
@@ -106,6 +106,7 @@ grab_port (MMPluginBase *base,
MMModem *modem = NULL;
const char *name, *subsys, *sysfs_path;
guint32 caps;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -113,19 +114,28 @@ grab_port (MMPluginBase *base,
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
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_modem_gobi_gsm_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)));
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
} else 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);
}
if (modem) {
+9 -1
View File
@@ -105,6 +105,7 @@ grab_port (MMPluginBase *base,
const char *name, *subsys, *sysfs_path;
char *devfile;
guint32 caps;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -112,6 +113,11 @@ grab_port (MMPluginBase *base,
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
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;
}
devfile = g_strdup (g_udev_device_get_device_file (port));
if (!devfile) {
if (!strcmp (subsys, "net")) {
@@ -139,7 +145,9 @@ grab_port (MMPluginBase *base,
if (!existing) {
modem = mm_modem_hso_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)));
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
if (modem) {
if (!mm_modem_grab_port (modem, subsys, name, MM_PORT_TYPE_UNKNOWN, NULL, error)) {
g_object_unref (modem);
+9 -5
View File
@@ -268,7 +268,7 @@ grab_port (MMPluginBase *base,
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path;
guint32 caps;
guint16 product = 0;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -282,7 +282,7 @@ grab_port (MMPluginBase *base,
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
if (!mm_plugin_base_get_device_ids (base, subsys, name, NULL, &product)) {
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;
}
@@ -292,14 +292,18 @@ grab_port (MMPluginBase *base,
if (!existing) {
if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
modem = mm_modem_huawei_gsm_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)));
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
} else if (caps & CAP_CDMA) {
modem = mm_modem_huawei_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);
}
if (modem) {
+12 -2
View File
@@ -114,6 +114,7 @@ grab_port (MMPluginBase *base,
const char *name, *subsys, *sysfs_path;
guint32 caps;
MMPortType ptype = MM_PORT_TYPE_UNKNOWN;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -138,19 +139,28 @@ grab_port (MMPluginBase *base,
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
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_modem_longcheer_gsm_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)));
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
} else 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);
}
if (modem) {
+9 -1
View File
@@ -132,6 +132,7 @@ grab_port (MMPluginBase *base,
MMModem *modem = NULL;
const char *name, *subsys, *sysfs_path;
guint32 caps;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -143,11 +144,18 @@ grab_port (MMPluginBase *base,
if (!(caps & MM_PLUGIN_BASE_PORT_CAP_GSM) && strcmp (subsys, "net"))
return NULL;
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;
}
sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
modem = mm_modem_mbm_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)));
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
if (modem) {
if (!mm_modem_grab_port (modem, subsys, name, MM_PORT_TYPE_UNKNOWN, NULL, error)) {
g_object_unref (modem);
+9 -1
View File
@@ -105,6 +105,7 @@ grab_port (MMPluginBase *base,
GUdevDevice *port = NULL;
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -118,11 +119,18 @@ grab_port (MMPluginBase *base,
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
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;
}
sysfs_path = mm_plugin_base_supports_task_get_physdev_path (task);
if (!existing) {
modem = mm_modem_moto_c_gsm_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)));
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
if (modem) {
if (!mm_modem_grab_port (modem, subsys, name, MM_PORT_TYPE_UNKNOWN, NULL, error)) {
+12 -2
View File
@@ -109,6 +109,7 @@ grab_port (MMPluginBase *base,
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path;
guint32 caps;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -122,19 +123,28 @@ grab_port (MMPluginBase *base,
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
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_modem_nokia_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)));
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
} else 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);
}
if (modem) {
+12 -2
View File
@@ -115,6 +115,7 @@ grab_port (MMPluginBase *base,
MMModem *modem = NULL;
const char *name, *subsys, *devfile, *sysfs_path;
guint32 caps;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -128,19 +129,28 @@ grab_port (MMPluginBase *base,
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
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_modem_novatel_gsm_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)));
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
} else if (caps & CAP_CDMA) {
modem = mm_modem_novatel_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);
}
if (modem) {
+9 -1
View File
@@ -107,6 +107,7 @@ grab_port (MMPluginBase *base,
guint32 caps;
int usbif;
MMPortType ptype = MM_PORT_TYPE_SECONDARY;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -129,13 +130,20 @@ grab_port (MMPluginBase *base,
if (usbif == 0)
ptype = MM_PORT_TYPE_PRIMARY;
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_modem_option_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)));
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
}
if (modem) {
+12 -2
View File
@@ -128,6 +128,7 @@ grab_port (MMPluginBase *base,
const char *name, *subsys, *devfile, *sysfs_path;
guint32 caps;
MMPortType ptype = MM_PORT_TYPE_UNKNOWN;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -145,19 +146,28 @@ grab_port (MMPluginBase *base,
if (g_object_get_data (G_OBJECT (task), TAG_SIERRA_SECONDARY_PORT))
ptype = MM_PORT_TYPE_SECONDARY;
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) || (ptype != MM_PORT_TYPE_UNKNOWN)) {
modem = mm_modem_sierra_gsm_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)));
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
} else if (caps & CAP_CDMA) {
modem = mm_modem_sierra_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);
}
if (modem) {
+12 -2
View File
@@ -114,6 +114,7 @@ grab_port (MMPluginBase *base,
const char *name, *subsys, *sysfs_path;
guint32 caps;
MMPortType ptype = MM_PORT_TYPE_UNKNOWN;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -138,19 +139,28 @@ grab_port (MMPluginBase *base,
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
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_modem_simtech_gsm_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)));
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
} else 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);
}
if (modem) {
+9 -1
View File
@@ -115,6 +115,7 @@ grab_port (MMPluginBase *base,
const char *name, *subsys, *sysfs_path;
guint32 caps;
MMPortType ptype = MM_PORT_TYPE_UNKNOWN;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -139,13 +140,20 @@ grab_port (MMPluginBase *base,
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
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_modem_x22x_gsm_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)));
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
}
if (modem) {
+12 -2
View File
@@ -121,6 +121,7 @@ grab_port (MMPluginBase *base,
const char *name, *subsys, *sysfs_path;
guint32 caps;
MMPortType ptype = MM_PORT_TYPE_UNKNOWN;
guint16 vendor = 0, product = 0;
port = mm_plugin_base_supports_task_get_port (task);
g_assert (port);
@@ -134,19 +135,28 @@ grab_port (MMPluginBase *base,
subsys = g_udev_device_get_subsystem (port);
name = g_udev_device_get_name (port);
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_modem_zte_new (sysfs_path,
mm_plugin_base_supports_task_get_driver (task),
mm_plugin_get_name (MM_PLUGIN (base)));
mm_plugin_get_name (MM_PLUGIN (base)),
vendor,
product);
} else 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);
}
if (modem) {