aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/mm-modem-anydata-cdma.c6
-rw-r--r--plugins/mm-modem-anydata-cdma.h4
-rw-r--r--plugins/mm-modem-gobi-gsm.c6
-rw-r--r--plugins/mm-modem-gobi-gsm.h4
-rw-r--r--plugins/mm-modem-hso.c6
-rw-r--r--plugins/mm-modem-hso.h4
-rw-r--r--plugins/mm-modem-huawei-cdma.c6
-rw-r--r--plugins/mm-modem-huawei-cdma.h4
-rw-r--r--plugins/mm-modem-huawei-gsm.c6
-rw-r--r--plugins/mm-modem-huawei-gsm.h4
-rw-r--r--plugins/mm-modem-longcheer-gsm.c6
-rw-r--r--plugins/mm-modem-longcheer-gsm.h4
-rw-r--r--plugins/mm-modem-mbm.c6
-rw-r--r--plugins/mm-modem-mbm.h4
-rw-r--r--plugins/mm-modem-moto-c-gsm.c6
-rw-r--r--plugins/mm-modem-moto-c-gsm.h4
-rw-r--r--plugins/mm-modem-nokia.c6
-rw-r--r--plugins/mm-modem-nokia.h4
-rw-r--r--plugins/mm-modem-novatel-cdma.c4
-rw-r--r--plugins/mm-modem-novatel-cdma.h4
-rw-r--r--plugins/mm-modem-novatel-gsm.c6
-rw-r--r--plugins/mm-modem-novatel-gsm.h4
-rw-r--r--plugins/mm-modem-option.c6
-rw-r--r--plugins/mm-modem-option.h4
-rw-r--r--plugins/mm-modem-sierra-cdma.c6
-rw-r--r--plugins/mm-modem-sierra-cdma.h4
-rw-r--r--plugins/mm-modem-sierra-gsm.c6
-rw-r--r--plugins/mm-modem-sierra-gsm.h4
-rw-r--r--plugins/mm-modem-simtech-gsm.c6
-rw-r--r--plugins/mm-modem-simtech-gsm.h4
-rw-r--r--plugins/mm-modem-x22x-gsm.c6
-rw-r--r--plugins/mm-modem-x22x-gsm.h4
-rw-r--r--plugins/mm-modem-zte.c6
-rw-r--r--plugins/mm-modem-zte.h4
-rw-r--r--plugins/mm-plugin-anydata.c10
-rw-r--r--plugins/mm-plugin-generic.c14
-rw-r--r--plugins/mm-plugin-gobi.c14
-rw-r--r--plugins/mm-plugin-hso.c10
-rw-r--r--plugins/mm-plugin-huawei.c14
-rw-r--r--plugins/mm-plugin-longcheer.c14
-rw-r--r--plugins/mm-plugin-mbm.c10
-rw-r--r--plugins/mm-plugin-moto-c.c10
-rw-r--r--plugins/mm-plugin-nokia.c14
-rw-r--r--plugins/mm-plugin-novatel.c14
-rw-r--r--plugins/mm-plugin-option.c10
-rw-r--r--plugins/mm-plugin-sierra.c14
-rw-r--r--plugins/mm-plugin-simtech.c14
-rw-r--r--plugins/mm-plugin-x22x.c10
-rw-r--r--plugins/mm-plugin-zte.c14
-rw-r--r--src/mm-generic-cdma.c6
-rw-r--r--src/mm-generic-cdma.h4
-rw-r--r--src/mm-generic-gsm.c6
-rw-r--r--src/mm-generic-gsm.h4
-rw-r--r--src/mm-modem-base.c57
-rw-r--r--src/mm-modem-helpers.c32
-rw-r--r--src/mm-modem-helpers.h4
-rw-r--r--src/mm-modem.c16
-rw-r--r--src/mm-modem.h8
-rw-r--r--src/mm-plugin-base.c18
-rw-r--r--src/tests/test-modem-helpers.c301
60 files changed, 716 insertions, 94 deletions
diff --git a/plugins/mm-modem-anydata-cdma.c b/plugins/mm-modem-anydata-cdma.c
index c7cca460..3bf15ed8 100644
--- a/plugins/mm-modem-anydata-cdma.c
+++ b/plugins/mm-modem-anydata-cdma.c
@@ -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));
}
diff --git a/plugins/mm-modem-anydata-cdma.h b/plugins/mm-modem-anydata-cdma.h
index d2695d5f..5a9fc4b1 100644
--- a/plugins/mm-modem-anydata-cdma.h
+++ b/plugins/mm-modem-anydata-cdma.h
@@ -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 */
diff --git a/plugins/mm-modem-gobi-gsm.c b/plugins/mm-modem-gobi-gsm.c
index 3b9e9ece..7e2fa4ca 100644
--- a/plugins/mm-modem-gobi-gsm.c
+++ b/plugins/mm-modem-gobi-gsm.c
@@ -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));
}
diff --git a/plugins/mm-modem-gobi-gsm.h b/plugins/mm-modem-gobi-gsm.h
index 4bd262fb..b1af1643 100644
--- a/plugins/mm-modem-gobi-gsm.h
+++ b/plugins/mm-modem-gobi-gsm.h
@@ -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 */
diff --git a/plugins/mm-modem-hso.c b/plugins/mm-modem-hso.c
index 1fd46333..81fe51a7 100644
--- a/plugins/mm-modem-hso.c
+++ b/plugins/mm-modem-hso.c
@@ -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));
}
diff --git a/plugins/mm-modem-hso.h b/plugins/mm-modem-hso.h
index e2d7623a..7e79886c 100644
--- a/plugins/mm-modem-hso.h
+++ b/plugins/mm-modem-hso.h
@@ -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,
diff --git a/plugins/mm-modem-huawei-cdma.c b/plugins/mm-modem-huawei-cdma.c
index 523578f1..7faa9f08 100644
--- a/plugins/mm-modem-huawei-cdma.c
+++ b/plugins/mm-modem-huawei-cdma.c
@@ -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));
}
diff --git a/plugins/mm-modem-huawei-cdma.h b/plugins/mm-modem-huawei-cdma.h
index 738f2d9e..88b425ce 100644
--- a/plugins/mm-modem-huawei-cdma.h
+++ b/plugins/mm-modem-huawei-cdma.h
@@ -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 */
diff --git a/plugins/mm-modem-huawei-gsm.c b/plugins/mm-modem-huawei-gsm.c
index 5123e7f0..545d0831 100644
--- a/plugins/mm-modem-huawei-gsm.c
+++ b/plugins/mm-modem-huawei-gsm.c
@@ -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));
}
diff --git a/plugins/mm-modem-huawei-gsm.h b/plugins/mm-modem-huawei-gsm.h
index 9c2ec34b..05f1f291 100644
--- a/plugins/mm-modem-huawei-gsm.h
+++ b/plugins/mm-modem-huawei-gsm.h
@@ -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 */
diff --git a/plugins/mm-modem-longcheer-gsm.c b/plugins/mm-modem-longcheer-gsm.c
index 62980f76..33763e27 100644
--- a/plugins/mm-modem-longcheer-gsm.c
+++ b/plugins/mm-modem-longcheer-gsm.c
@@ -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));
}
diff --git a/plugins/mm-modem-longcheer-gsm.h b/plugins/mm-modem-longcheer-gsm.h
index 5383c52d..e9abfbe4 100644
--- a/plugins/mm-modem-longcheer-gsm.h
+++ b/plugins/mm-modem-longcheer-gsm.h
@@ -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 */
diff --git a/plugins/mm-modem-mbm.c b/plugins/mm-modem-mbm.c
index 7f6bc9c8..9002ddcf 100644
--- a/plugins/mm-modem-mbm.c
+++ b/plugins/mm-modem-mbm.c
@@ -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));
}
diff --git a/plugins/mm-modem-mbm.h b/plugins/mm-modem-mbm.h
index db0f6272..bb1c2ff5 100644
--- a/plugins/mm-modem-mbm.h
+++ b/plugins/mm-modem-mbm.h
@@ -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 */
diff --git a/plugins/mm-modem-moto-c-gsm.c b/plugins/mm-modem-moto-c-gsm.c
index 5910ff29..cd7b4ed0 100644
--- a/plugins/mm-modem-moto-c-gsm.c
+++ b/plugins/mm-modem-moto-c-gsm.c
@@ -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));
}
diff --git a/plugins/mm-modem-moto-c-gsm.h b/plugins/mm-modem-moto-c-gsm.h
index eb1dad12..a8ddd6df 100644
--- a/plugins/mm-modem-moto-c-gsm.h
+++ b/plugins/mm-modem-moto-c-gsm.h
@@ -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 */
diff --git a/plugins/mm-modem-nokia.c b/plugins/mm-modem-nokia.c
index 3cbea00b..56b8c919 100644
--- a/plugins/mm-modem-nokia.c
+++ b/plugins/mm-modem-nokia.c
@@ -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));
}
diff --git a/plugins/mm-modem-nokia.h b/plugins/mm-modem-nokia.h
index 0e24619f..0873d2de 100644
--- a/plugins/mm-modem-nokia.h
+++ b/plugins/mm-modem-nokia.h
@@ -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 */
diff --git a/plugins/mm-modem-novatel-cdma.c b/plugins/mm-modem-novatel-cdma.c
index b7da80ac..6b8c4aa9 100644
--- a/plugins/mm-modem-novatel-cdma.c
+++ b/plugins/mm-modem-novatel-cdma.c
@@ -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);
diff --git a/plugins/mm-modem-novatel-cdma.h b/plugins/mm-modem-novatel-cdma.h
index 4d38d8ed..c2319efb 100644
--- a/plugins/mm-modem-novatel-cdma.h
+++ b/plugins/mm-modem-novatel-cdma.h
@@ -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 */
diff --git a/plugins/mm-modem-novatel-gsm.c b/plugins/mm-modem-novatel-gsm.c
index 584156fc..64a81bd5 100644
--- a/plugins/mm-modem-novatel-gsm.c
+++ b/plugins/mm-modem-novatel-gsm.c
@@ -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));
}
diff --git a/plugins/mm-modem-novatel-gsm.h b/plugins/mm-modem-novatel-gsm.h
index c2e11387..12b0060d 100644
--- a/plugins/mm-modem-novatel-gsm.h
+++ b/plugins/mm-modem-novatel-gsm.h
@@ -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 */
diff --git a/plugins/mm-modem-option.c b/plugins/mm-modem-option.c
index ac04b0bd..b15e7045 100644
--- a/plugins/mm-modem-option.c
+++ b/plugins/mm-modem-option.c
@@ -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));
}
diff --git a/plugins/mm-modem-option.h b/plugins/mm-modem-option.h
index 4e88607e..3af9b1e9 100644
--- a/plugins/mm-modem-option.h
+++ b/plugins/mm-modem-option.h
@@ -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 */
diff --git a/plugins/mm-modem-sierra-cdma.c b/plugins/mm-modem-sierra-cdma.c
index fc62bf6b..1168c834 100644
--- a/plugins/mm-modem-sierra-cdma.c
+++ b/plugins/mm-modem-sierra-cdma.c
@@ -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));
}
diff --git a/plugins/mm-modem-sierra-cdma.h b/plugins/mm-modem-sierra-cdma.h
index 9111b739..a33b1bc1 100644
--- a/plugins/mm-modem-sierra-cdma.h
+++ b/plugins/mm-modem-sierra-cdma.h
@@ -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 */
diff --git a/plugins/mm-modem-sierra-gsm.c b/plugins/mm-modem-sierra-gsm.c
index bf5df313..c86c1c5e 100644
--- a/plugins/mm-modem-sierra-gsm.c
+++ b/plugins/mm-modem-sierra-gsm.c
@@ -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));
}
diff --git a/plugins/mm-modem-sierra-gsm.h b/plugins/mm-modem-sierra-gsm.h
index dd84b307..8f2391d9 100644
--- a/plugins/mm-modem-sierra-gsm.h
+++ b/plugins/mm-modem-sierra-gsm.h
@@ -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 */
diff --git a/plugins/mm-modem-simtech-gsm.c b/plugins/mm-modem-simtech-gsm.c
index 07820b3c..4a626947 100644
--- a/plugins/mm-modem-simtech-gsm.c
+++ b/plugins/mm-modem-simtech-gsm.c
@@ -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));
}
diff --git a/plugins/mm-modem-simtech-gsm.h b/plugins/mm-modem-simtech-gsm.h
index 0ba3c431..85e421c3 100644
--- a/plugins/mm-modem-simtech-gsm.h
+++ b/plugins/mm-modem-simtech-gsm.h
@@ -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 */
diff --git a/plugins/mm-modem-x22x-gsm.c b/plugins/mm-modem-x22x-gsm.c
index 8356b49d..ff232971 100644
--- a/plugins/mm-modem-x22x-gsm.c
+++ b/plugins/mm-modem-x22x-gsm.c
@@ -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));
}
diff --git a/plugins/mm-modem-x22x-gsm.h b/plugins/mm-modem-x22x-gsm.h
index 8922afbf..61cc14d6 100644
--- a/plugins/mm-modem-x22x-gsm.h
+++ b/plugins/mm-modem-x22x-gsm.h
@@ -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 */
diff --git a/plugins/mm-modem-zte.c b/plugins/mm-modem-zte.c
index ba8a1db6..558260ec 100644
--- a/plugins/mm-modem-zte.c
+++ b/plugins/mm-modem-zte.c
@@ -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));
}
diff --git a/plugins/mm-modem-zte.h b/plugins/mm-modem-zte.h
index 112bae00..f2f068b8 100644
--- a/plugins/mm-modem-zte.h
+++ b/plugins/mm-modem-zte.h
@@ -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 */
diff --git a/plugins/mm-plugin-anydata.c b/plugins/mm-plugin-anydata.c
index 94f4f105..76df6734 100644
--- a/plugins/mm-plugin-anydata.c
+++ b/plugins/mm-plugin-anydata.c
@@ -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) {
diff --git a/plugins/mm-plugin-generic.c b/plugins/mm-plugin-generic.c
index d6847fd7..9704ae84 100644
--- a/plugins/mm-plugin-generic.c
+++ b/plugins/mm-plugin-generic.c
@@ -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) {
diff --git a/plugins/mm-plugin-gobi.c b/plugins/mm-plugin-gobi.c
index fbe38783..36771d12 100644
--- a/plugins/mm-plugin-gobi.c
+++ b/plugins/mm-plugin-gobi.c
@@ -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) {
diff --git a/plugins/mm-plugin-hso.c b/plugins/mm-plugin-hso.c
index dc0a8fcb..7b719322 100644
--- a/plugins/mm-plugin-hso.c
+++ b/plugins/mm-plugin-hso.c
@@ -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);
diff --git a/plugins/mm-plugin-huawei.c b/plugins/mm-plugin-huawei.c
index eb141bfd..090bb0d5 100644
--- a/plugins/mm-plugin-huawei.c
+++ b/plugins/mm-plugin-huawei.c
@@ -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) {
diff --git a/plugins/mm-plugin-longcheer.c b/plugins/mm-plugin-longcheer.c
index dbbe186f..e63ff4e9 100644
--- a/plugins/mm-plugin-longcheer.c
+++ b/plugins/mm-plugin-longcheer.c
@@ -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) {
diff --git a/plugins/mm-plugin-mbm.c b/plugins/mm-plugin-mbm.c
index 5554d84f..dd64cc66 100644
--- a/plugins/mm-plugin-mbm.c
+++ b/plugins/mm-plugin-mbm.c
@@ -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);
diff --git a/plugins/mm-plugin-moto-c.c b/plugins/mm-plugin-moto-c.c
index d798af4c..21b737e2 100644
--- a/plugins/mm-plugin-moto-c.c
+++ b/plugins/mm-plugin-moto-c.c
@@ -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)) {
diff --git a/plugins/mm-plugin-nokia.c b/plugins/mm-plugin-nokia.c
index 2d0d6aff..938f8c57 100644
--- a/plugins/mm-plugin-nokia.c
+++ b/plugins/mm-plugin-nokia.c
@@ -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) {
diff --git a/plugins/mm-plugin-novatel.c b/plugins/mm-plugin-novatel.c
index a968836a..53844566 100644
--- a/plugins/mm-plugin-novatel.c
+++ b/plugins/mm-plugin-novatel.c
@@ -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) {
diff --git a/plugins/mm-plugin-option.c b/plugins/mm-plugin-option.c
index 101f9bd4..ab2bd3d5 100644
--- a/plugins/mm-plugin-option.c
+++ b/plugins/mm-plugin-option.c
@@ -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) {
diff --git a/plugins/mm-plugin-sierra.c b/plugins/mm-plugin-sierra.c
index 8ace6532..51ab9025 100644
--- a/plugins/mm-plugin-sierra.c
+++ b/plugins/mm-plugin-sierra.c
@@ -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) {
diff --git a/plugins/mm-plugin-simtech.c b/plugins/mm-plugin-simtech.c
index 3c448738..611d2d20 100644
--- a/plugins/mm-plugin-simtech.c
+++ b/plugins/mm-plugin-simtech.c
@@ -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) {
diff --git a/plugins/mm-plugin-x22x.c b/plugins/mm-plugin-x22x.c
index ecad48ed..5a8253fe 100644
--- a/plugins/mm-plugin-x22x.c
+++ b/plugins/mm-plugin-x22x.c
@@ -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) {
diff --git a/plugins/mm-plugin-zte.c b/plugins/mm-plugin-zte.c
index e943bbfe..97bbcc36 100644
--- a/plugins/mm-plugin-zte.c
+++ b/plugins/mm-plugin-zte.c
@@ -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) {
diff --git a/src/mm-generic-cdma.c b/src/mm-generic-cdma.c
index 4dd1f0ef..f3e99d1a 100644
--- a/src/mm-generic-cdma.c
+++ b/src/mm-generic-cdma.c
@@ -95,7 +95,9 @@ mm_generic_cdma_new (const char *device,
const char *driver,
const char *plugin,
gboolean evdo_rev0,
- gboolean evdo_revA)
+ gboolean evdo_revA,
+ guint vendor,
+ guint product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -107,6 +109,8 @@ mm_generic_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));
}
diff --git a/src/mm-generic-cdma.h b/src/mm-generic-cdma.h
index 6828f7be..350c58ed 100644
--- a/src/mm-generic-cdma.h
+++ b/src/mm-generic-cdma.h
@@ -88,7 +88,9 @@ MMModem *mm_generic_cdma_new (const char *device,
const char *driver,
const char *plugin,
gboolean evdo_rev0,
- gboolean evdo_revA);
+ gboolean evdo_revA,
+ guint vendor,
+ guint product);
/* Private, for subclasses */
diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c
index dbbd189a..b7b8e84b 100644
--- a/src/mm-generic-gsm.c
+++ b/src/mm-generic-gsm.c
@@ -158,7 +158,9 @@ static void update_lac_ci (MMGenericGsm *self, gulong lac, gulong ci, guint idx)
MMModem *
mm_generic_gsm_new (const char *device,
const char *driver,
- const char *plugin)
+ const char *plugin,
+ guint vendor,
+ guint product)
{
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
@@ -168,6 +170,8 @@ mm_generic_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));
}
diff --git a/src/mm-generic-gsm.h b/src/mm-generic-gsm.h
index e967f045..be75ceed 100644
--- a/src/mm-generic-gsm.h
+++ b/src/mm-generic-gsm.h
@@ -134,7 +134,9 @@ GType mm_generic_gsm_get_type (void);
MMModem *mm_generic_gsm_new (const char *device,
const char *driver,
- const char *plugin);
+ const char *plugin,
+ guint vendor,
+ guint product);
/* Private, for subclasses */
diff --git a/src/mm-modem-base.c b/src/mm-modem-base.c
index b7bdb6ea..adb19467 100644
--- a/src/mm-modem-base.c
+++ b/src/mm-modem-base.c
@@ -51,6 +51,8 @@ typedef struct {
gboolean valid;
MMModemState state;
+ guint vid;
+ guint pid;
char *manf;
char *model;
char *revision;
@@ -435,8 +437,8 @@ card_info_cache_invoke (MMCallbackInfo *info)
/* Build up the device identifier */
g_free (priv->device_ident);
- priv->device_ident = mm_create_device_identifier (NULL,
- NULL,
+ priv->device_ident = mm_create_device_identifier (priv->vid,
+ priv->pid,
priv->ati,
priv->ati1,
priv->gsn,
@@ -454,41 +456,44 @@ info_item_done (MMCallbackInfo *info,
GString *response,
GError *error,
const char *tag,
+ const char *tag2,
const char *desc)
{
const char *p = response->str;
if (!error) {
if (tag)
- p = mm_strip_tag (response->str, tag);
+ p = mm_strip_tag (p, tag);
+ if (tag2)
+ p = mm_strip_tag (p, tag2);
mm_callback_info_set_data (info, desc, strlen (p) ? g_strdup (p) : NULL, g_free);
}
mm_callback_info_chain_complete_one (info);
}
-#define GET_INFO_RESP_FN(func_name, tag, desc) \
+#define GET_INFO_RESP_FN(func_name, tag, tag2, desc) \
static void \
func_name (MMAtSerialPort *port, \
GString *response, \
GError *error, \
gpointer user_data) \
{ \
- info_item_done ((MMCallbackInfo *) user_data, response, error, tag , desc ); \
+ info_item_done ((MMCallbackInfo *) user_data, response, error, tag, tag2, desc ); \
}
-GET_INFO_RESP_FN(get_revision_done, "+GMR:", "card-info-revision")
-GET_INFO_RESP_FN(get_model_done, "+GMM:", "card-info-model")
-GET_INFO_RESP_FN(get_manf_done, "+GMI:", "card-info-manf")
+GET_INFO_RESP_FN(get_revision_done, "+GMR:", "AT+GMR", "card-info-revision")
+GET_INFO_RESP_FN(get_model_done, "+GMM:", "AT+GMM", "card-info-model")
+GET_INFO_RESP_FN(get_manf_done, "+GMI:", "AT+GMI", "card-info-manf")
-GET_INFO_RESP_FN(get_c_revision_done, "+CGMR:", "card-info-c-revision")
-GET_INFO_RESP_FN(get_c_model_done, "+CGMM:", "card-info-c-model")
-GET_INFO_RESP_FN(get_c_manf_done, "+CGMI:", "card-info-c-manf")
+GET_INFO_RESP_FN(get_c_revision_done, "+CGMR:", "AT+CGMR", "card-info-c-revision")
+GET_INFO_RESP_FN(get_c_model_done, "+CGMM:", "AT+CGMM", "card-info-c-model")
+GET_INFO_RESP_FN(get_c_manf_done, "+CGMI:", "AT+CGMI", "card-info-c-manf")
-GET_INFO_RESP_FN(get_ati_done, NULL, "card-info-ati")
-GET_INFO_RESP_FN(get_ati1_done, NULL, "card-info-ati1")
-GET_INFO_RESP_FN(get_gsn_done, "+GSN:", "card-info-gsn")
-GET_INFO_RESP_FN(get_cgsn_done, "+CGSN:", "card-info-c-gsn")
+GET_INFO_RESP_FN(get_ati_done, NULL, "ATI", "card-info-ati")
+GET_INFO_RESP_FN(get_ati1_done, NULL, "ATI1", "card-info-ati1")
+GET_INFO_RESP_FN(get_gsn_done, "+GSN:", "AT+GSN", "card-info-gsn")
+GET_INFO_RESP_FN(get_cgsn_done, "+CGSN:", "AT+CGSN", "card-info-c-gsn")
void
mm_modem_base_get_card_info (MMModemBase *self,
@@ -672,6 +677,14 @@ set_property (GObject *object, guint prop_id,
case MM_MODEM_PROP_UNLOCK_REQUIRED:
case MM_MODEM_PROP_UNLOCK_RETRIES:
break;
+ case MM_MODEM_PROP_HW_VID:
+ /* Construct only */
+ priv->vid = g_value_get_uint (value);
+ break;
+ case MM_MODEM_PROP_HW_PID:
+ /* Construct only */
+ priv->pid = g_value_get_uint (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -724,6 +737,12 @@ get_property (GObject *object, guint prop_id,
case MM_MODEM_PROP_UNLOCK_RETRIES:
g_value_set_uint (value, priv->unlock_retries);
break;
+ case MM_MODEM_PROP_HW_VID:
+ g_value_set_uint (value, priv->vid);
+ break;
+ case MM_MODEM_PROP_HW_PID:
+ g_value_set_uint (value, priv->pid);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -819,6 +838,14 @@ mm_modem_base_class_init (MMModemBaseClass *klass)
MM_MODEM_PROP_UNLOCK_RETRIES,
MM_MODEM_UNLOCK_RETRIES);
+ g_object_class_override_property (object_class,
+ MM_MODEM_PROP_HW_VID,
+ MM_MODEM_HW_VID);
+
+ g_object_class_override_property (object_class,
+ MM_MODEM_PROP_HW_PID,
+ MM_MODEM_HW_PID);
+
mm_properties_changed_signal_new (object_class);
}
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index 11950da1..af53dbee 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -15,6 +15,7 @@
*/
#include <config.h>
+#include <stdio.h>
#include <ctype.h>
#include <glib.h>
#include <string.h>
@@ -807,8 +808,8 @@ mm_gsm_string_to_access_tech (const char *string)
/*************************************************************************/
char *
-mm_create_device_identifier (const char *vid,
- const char *pid,
+mm_create_device_identifier (guint vid,
+ guint pid,
const char *ati,
const char *ati1,
const char *gsn,
@@ -817,9 +818,10 @@ mm_create_device_identifier (const char *vid,
const char *manf,
gboolean debug)
{
- GString *devid;
+ GString *devid, *dbg = NULL;
GChecksum *sum;
- char *p, *ret = NULL, *j = NULL, *dbg = NULL;
+ char *p, *ret = NULL;
+ char str_vid[10], str_pid[10];
/* Build up the device identifier */
devid = g_string_sized_new (50);
@@ -844,15 +846,29 @@ mm_create_device_identifier (const char *vid,
p = devid->str;
if (debug)
- j = dbg = g_malloc0 (strlen (devid->str) + 1);
+ dbg = g_string_sized_new (strlen (devid->str) + 17);
sum = g_checksum_new (G_CHECKSUM_SHA1);
+
+ if (vid) {
+ snprintf (str_vid, sizeof (str_vid) - 1, "%08x", vid);
+ g_checksum_update (sum, (const guchar *) &str_vid[0], strlen (str_vid));
+ if (dbg)
+ g_string_append_printf (dbg, "%08x", vid);
+ }
+ if (vid) {
+ snprintf (str_pid, sizeof (str_pid) - 1, "%08x", pid);
+ g_checksum_update (sum, (const guchar *) &str_pid[0], strlen (str_pid));
+ if (dbg)
+ g_string_append_printf (dbg, "%08x", pid);
+ }
+
while (*p) {
/* Strip spaces and linebreaks */
if (!isblank (*p) && !isspace (*p) && isascii (*p)) {
g_checksum_update (sum, (const guchar *) p, 1);
if (dbg)
- *j++ = *p;
+ g_string_append_c (dbg, *p);
}
p++;
}
@@ -860,9 +876,9 @@ mm_create_device_identifier (const char *vid,
g_checksum_free (sum);
if (dbg) {
- g_debug ("Device ID source '%s'", dbg);
+ g_debug ("Device ID source '%s'", dbg->str);
g_debug ("Device ID '%s'", ret);
- g_free (dbg);
+ g_string_free (dbg, TRUE);
}
return ret;
diff --git a/src/mm-modem-helpers.h b/src/mm-modem-helpers.h
index 03f6dec2..3843e7ad 100644
--- a/src/mm-modem-helpers.h
+++ b/src/mm-modem-helpers.h
@@ -59,8 +59,8 @@ gboolean mm_gsm_parse_cscs_support_response (const char *reply,
MMModemGsmAccessTech mm_gsm_string_to_access_tech (const char *string);
-char *mm_create_device_identifier (const char *vid,
- const char *pid,
+char *mm_create_device_identifier (guint vid,
+ guint pid,
const char *ati,
const char *ati1,
const char *gsn,
diff --git a/src/mm-modem.c b/src/mm-modem.c
index 30605a28..56b65478 100644
--- a/src/mm-modem.c
+++ b/src/mm-modem.c
@@ -893,6 +893,22 @@ mm_modem_init (gpointer g_iface)
0, G_MAXUINT32, 0,
G_PARAM_READABLE));
+ g_object_interface_install_property
+ (g_iface,
+ g_param_spec_uint (MM_MODEM_HW_VID,
+ "Hardware vendor ID",
+ "Hardware vendor ID",
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_interface_install_property
+ (g_iface,
+ g_param_spec_uint (MM_MODEM_HW_PID,
+ "Hardware product ID",
+ "Hardware product ID",
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
/* Signals */
g_signal_new ("state-changed",
iface_type,
diff --git a/src/mm-modem.h b/src/mm-modem.h
index bff7e359..1faf3838 100644
--- a/src/mm-modem.h
+++ b/src/mm-modem.h
@@ -11,7 +11,7 @@
* GNU General Public License for more details:
*
* Copyright (C) 2008 - 2009 Novell, Inc.
- * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009 - 2010 Red Hat, Inc.
*/
#ifndef MM_MODEM_H
@@ -65,6 +65,8 @@ typedef enum {
#define MM_MODEM_VALID "valid" /* not exported */
#define MM_MODEM_PLUGIN "plugin" /* not exported */
#define MM_MODEM_STATE "state" /* not exported */
+#define MM_MODEM_HW_VID "hw-vid" /* not exported */
+#define MM_MODEM_HW_PID "hw-pid" /* not exported */
#define MM_MODEM_TYPE_UNKNOWN 0
#define MM_MODEM_TYPE_GSM 1
@@ -89,7 +91,9 @@ typedef enum {
MM_MODEM_PROP_EQUIPMENT_IDENTIFIER,
MM_MODEM_PROP_UNLOCK_REQUIRED,
MM_MODEM_PROP_UNLOCK_RETRIES,
- MM_MODEM_PROP_DEVICE_IDENTIFIER
+ MM_MODEM_PROP_DEVICE_IDENTIFIER,
+ MM_MODEM_PROP_HW_VID, /* Not exported */
+ MM_MODEM_PROP_HW_PID /* Not exported */
} MMModemProp;
typedef struct _MMModem MMModem;
diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c
index 80d0f904..b34ec50a 100644
--- a/src/mm-plugin-base.c
+++ b/src/mm-plugin-base.c
@@ -890,8 +890,8 @@ mm_plugin_base_get_device_ids (MMPluginBase *self,
guint16 *product)
{
MMPluginBasePrivate *priv;
- GUdevDevice *device = NULL;
- const char *vid, *pid;
+ GUdevDevice *device = NULL, *parent = NULL;
+ const char *vid, *pid, *parent_subsys;
gboolean success = FALSE;
g_return_val_if_fail (self != NULL, FALSE);
@@ -909,6 +909,18 @@ mm_plugin_base_get_device_ids (MMPluginBase *self,
if (!device)
goto out;
+ /* Bluetooth devices report the VID/PID of the BT adapter here, which
+ * isn't really what we want. Just return null IDs instead.
+ */
+ parent = g_udev_device_get_parent (device);
+ if (parent) {
+ parent_subsys = g_udev_device_get_subsystem (parent);
+ if (parent_subsys && !strcmp (parent_subsys, "bluetooth")) {
+ success = TRUE;
+ goto out;
+ }
+ }
+
vid = g_udev_device_get_property (device, "ID_VENDOR_ID");
if (!vid || (strlen (vid) != 4))
goto out;
@@ -934,6 +946,8 @@ mm_plugin_base_get_device_ids (MMPluginBase *self,
out:
if (device)
g_object_unref (device);
+ if (parent)
+ g_object_unref (parent);
return success;
}
diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c
index 5981353c..725eed67 100644
--- a/src/tests/test-modem-helpers.c
+++ b/src/tests/test-modem-helpers.c
@@ -782,6 +782,301 @@ test_cscs_blackberry_support_response (void *f, gpointer d)
g_assert (charsets == MM_MODEM_CHARSET_IRA);
}
+typedef struct {
+ char *devid;
+ char *desc;
+ guint vid;
+ guint pid;
+ const char *ati;
+ const char *ati1;
+ const char *gsn;
+ const char *revision;
+ const char *model;
+ const char *manf;
+} DevidItem;
+
+static DevidItem devids[] = {
+ { "36e7a8e78637fd380b2664507ea5de8fc317d05b",
+ "Huawei E1550",
+ 0x12d1, 0x1001,
+ "\nManufacturer: huawei\n"
+ "Model: E1550\n"
+ "Revision: 11.608.09.01.21\n"
+ "IMEI: 235012412595195\n"
+ "+GCAP: +CGSM,+FCLASS,+DS\n",
+ NULL,
+ "\n235012412595195\n",
+ "\n11.608.09.01.21\n",
+ "\nE1550\n",
+ "\nhuawei\n"
+ },
+ { "33b0fc4a06af5448df656ce12925979acf1cb600",
+ "Huawei EC121",
+ 0x12d1, 0x1411,
+ "\nManufacturer: HUAWEI INCORPORATED\n"
+ "Model: EC121\n"
+ "Revision: 11.100.17.00.114\n"
+ "ESN: +GSN:12de4fa6\n"
+ "+CIS707-A, +MS, +ES, +DS, +FCLASS\n",
+ NULL,
+ "\n12de4fa6\n",
+ "\n11.100.17.00.114\n",
+ "\nEC121\n",
+ "\nHUAWEI INCORPORATED\n"
+ },
+ { "d17f016a402354eaa1e24855f4308fafca9cadb1",
+ "Sierra USBConnect Mercury",
+ 0x1199, 0x6880,
+ "\nManufacturer: Sierra Wireless, Inc.\n"
+ "Model: C885\n"
+ "Revision: J1_0_1_26AP C:/WS/FW/J1_0_1_26AP/MSM7200A/SRC/AMSS 2009/01/30 07:58:06\n"
+ "IMEI: 987866969112306\n"
+ "IMEI SV: 6\n"
+ "FSN: D603478104511\n"
+ "3GPP Release 6\n"
+ "+GCAP: +CGSM,+DS,+ES\n",
+ NULL,
+ "\n987866969112306\n",
+ "\nJ1_0_1_26AP C:/WS/FW/J1_0_1_26AP/MSM7200A/SRC/AMSS 2009/01/30 07:58:06\n",
+ "\nC885\n",
+ "\nSierra Wireless, Inc.\n"
+ },
+ { "345e9eaad7624393aca85cde9bd859edf462414c",
+ "ZTE MF627",
+ 0x19d2, 0x0031,
+ "\nManufacturer: ZTE INCORPORATED\n"
+ "Model: MF627\n"
+ "Revision: BD_3GHAP673A4V1.0.0B02\n"
+ "IMEI: 023589923858188\n"
+ "+GCAP: +CGSM,+FCLASS,+DS\n",
+ NULL,
+ "\n023589923858188\n",
+ "\nBD_3GHAP673A4V1.0.0B02\n",
+ "\nMF627\n",
+ "\nZTE INCORPORATED\n"
+ },
+ { "69fa133a668b6f4dbf39b73500fd153ec240c73f",
+ "Sony-Ericsson MD300",
+ 0x0fce, 0xd0cf,
+ "\nMD300\n",
+ "\nR3A018\n",
+ "\n349583712939483\n",
+ "\nR3A018\n",
+ "\nMD300\n",
+ "\nSony Ericsson\n"
+ },
+ { "3dad89ed7d774938c38188cf29cf1c211e9d360b",
+ "Option iCON 7.2",
+ 0x0af0, 0x6901,
+ "\nManufacturer: Option N.V.\n"
+ "Model: GTM378\n"
+ "Revision: 2.5.21Hd (Date: Jun 17 2008, Time: 12:30:47)\n",
+ NULL,
+ "\n129512359199159,SE393939TS\n",
+ "\n2.5.21Hd (Date: Jun 17 2008, Time: 12:30:47)\n",
+ "\nGTM378\n",
+ "\nOption N.V.\n"
+ },
+ { "b0acccb956c9eaf2076e03697e74bf998dc44179",
+ "ZTE MF622",
+ 0x19d2, 0x0001,
+ NULL,
+ NULL,
+ "\n235251122555115\n",
+ "\n3UKP671M3V1.0.0B08 3UKP671M3V1.0.0B08 1 [Jan 07 2008 16:00:00]\n",
+ "\nMF622\n",
+ "\nZTE INCORPORATED\n"
+ },
+ { "29a5b258f1dc6f50c66a1a9a1ecdde97560799ab",
+ "Option 452",
+ 0x0af0, 0x7901,
+ "\nManufacturer: Option N.V.\n"
+ "Model: GlobeTrotter HSUPA Modem\n"
+ "Revision: 2.12.0.0Hd (Date: Oct 29 2009, Time: 09:56:48)\n",
+ "\nManufacturer: Option N.V.\n"
+ "Model: GlobeTrotter HSUPA Modem\n"
+ "Revision: 2.12.0.0Hd (Date: Oct 29 2009, Time: 09:56:48)\n",
+ "\n000125491259519,PH2155R3TR\n",
+ "\n2.12.0.0Hd (Date: Oct 29 2009, Time: 09:56:48)\n",
+ "\nGlobeTrotter HSUPA Modem\n",
+ "\nOption N.V.\n"
+ },
+ { "c756c67e960e693d5d221e381ea170b60bb9288f",
+ "Novatel XU870",
+ 0x413c, 0x8118,
+ "\nManufacturer: Novatel Wireless Incorporated\n"
+ "Model: DELL XU870 ExpressCard\n"
+ "Revision: 9.5.05.01-02 [2006-10-20 17:19:09]\n"
+ "IMEI: 012051505051501\n"
+ "+GCAP: +CGSM,+DS\n",
+ "\nManufacturer: Novatel Wireless Incorporated\n"
+ "Model: DELL XU870 ExpressCard\n"
+ "Revision: 9.5.05.01-02 [2006-10-20 17:19:09]\n"
+ "IMEI: 012051505051501\n"
+ "+GCAP: +CGSM,+DS\n",
+ "\n012051505051501\n",
+ "\n9.5.05.01-02 [2006-10-20 17:19:09]\n",
+ "\nDELL XU870 ExpressCard\n",
+ "\nNovatel Wireless Incorporated\n"
+ },
+ { "4162ba918ab54b7776bccc3830e6c6b7a6738244",
+ "Zoom 4596",
+ 0x1c9e, 0x9603,
+ "\nManufacturer: Manufacturer\n"
+ "Model: HSPA USB MODEM\n"
+ "Revision: LQA0021.1.1_M573A\n"
+ "IMEI: 239664699635121\n"
+ "+GCAP: +CGSM,+FCLASS,+DS\n",
+ "\nManufacturer: Manufacturer\n"
+ "Model: HSPA USB MODEM\n"
+ "Revision: LQA0021.1.1_M573A\n"
+ "IMEI: 239664699635121\n"
+ "+GCAP: +CGSM,+FCLASS,+DS\n",
+ "\n239664699635121\n",
+ "\nLQA0021.1.1_M573A\n",
+ "\nHSPA USB MODEM\n",
+ "\nManufacturer\n"
+ },
+ { "6d3a2fccd3588943a8962fd1e0d3ba752c706660",
+ "C-MOTECH CDX-650",
+ 0x16d8, 0x6512,
+ "\nManufacturer: C-MOTECH Co., Ltd.\r\r\n"
+ "Model: CDX-650 \r\r\n"
+ "Revision: CDX65UAC03\r\r\n"
+ "Esn: 3B0C4B98\r\r\n"
+ "+GCAP: +CIS707A, +MS, +ES, +DS, +FCLASS\r\n",
+ "\nManufacturer: C-MOTECH Co., Ltd.\r\r\n"
+ "Model: CDX-650 \r\r\n"
+ "Revision: CDX65UAC03\r\r\n"
+ "Esn: 3B0C4B98\r\r\n"
+ "+GCAP: +CIS707A, +MS, +ES, +DS, +FCLASS\r\n",
+ "\n0x3B0C4B98\n",
+ "\nCDX65UAC03 1 [Oct 17 2007 13:30:00]\n",
+ "\nModel CDX-650 \n",
+ "\nC-MOTECH Co., Ltd.\n"
+ },
+ { "cf50da63e6d48beb1d1c3b41d70ef6fa534c3e13",
+ "BUSlink SCWi275u",
+ 0x22b8, 0x3802,
+ "\n144\n",
+ "\n000\n",
+ NULL,
+ "\n\"ADE_05_00_06032300I\"\n",
+ "\n\"GSM900\",\"GSM1800\",\"GSM1900\",\"GSM850\",\"MODEL=I250-000\"\n",
+ "\n\"Motorola CE, Copyright 2000\"\n"
+ },
+ { "2aff568f2b60f3d6f3f6cac708ed5dce77b12b96",
+ "Motorola ROKR E2",
+ 0x22b8, 0x3802,
+ NULL,
+ NULL,
+ "\n\"626936926396996\"\n",
+ "\n\"R564_G_12.00.47P\"\n",
+ "\n\"E2\"\n",
+ "\n\"Motorola\"\n"
+ },
+ { "a7136c6067a43f055ca093cee75cb98ce6c9658e",
+ "Sony-Ericsson W580i",
+ 0x0fce, 0xd089,
+ "\nSony Ericsson W580\n",
+ "\nCXC1123481\n",
+ "\n012505051512505\n",
+ "\nR8BE001 080115 1451 CXC1123481_NAM_1_LA\n",
+ "\nAAC-1052042-BV\n",
+ "\nSony Ericsson\n"
+ },
+ { "b80ee70214bdf9672f2a268ce165ecfd9def5721",
+ "Huawei E226",
+ 0x12d1, 0x1003,
+ "\nManufacturer: huawei\n"
+ "Model: E226\n"
+ "Revision: 11.310.15.00.150\n"
+ "IMEI: 232363662362362\n"
+ "+GCAP: +CGSM,+FCLASS,+DS\n",
+ "\nManufacturer: huawei\n"
+ "Model: E226\n"
+ "Revision: 11.310.15.00.150\n"
+ "IMEI: 232363662362362\n"
+ "+GCAP: +CGSM,+FCLASS,+DS\n",
+ "\n232363662362362\n",
+ "\n11.310.15.00.150\n",
+ "\nE226\n",
+ "\nhuawei\n"
+ },
+ { "d902e1f234863aa107bfc2d0faefbee5ed6901f1",
+ "LG LX265",
+ 0x1004, 0x6000,
+ "\nManufacturer: +GMI: LG Electronics Inc.\n"
+ "Model: +GMI: LG Electronics Inc.+GMM: Model:LG-LX265\n"
+ "Revision: +GMR: LX265V05, 50571\n"
+ "ESN: +GSN: 0x9235EB52\n"
+ "+GCAP: +CIS707-A, +MS, +ES, +DS, +FCLASS\n",
+ "\nManufacturer: +GMI: LG Electronics Inc.\n"
+ "Model: +GMI: LG Electronics Inc.+GMM: Model:LG-LX265\n"
+ "Revision: +GMR: LX265V05, 50571\n"
+ "ESN: +GSN: 0x9235EB52\n"
+ "+GCAP: +CIS707-A, +MS, +ES, +DS, +FCLASS\n",
+ "\n0x9235EB52\n",
+ "\nLX265V05, 50571\n",
+ "\nModel:LG-LX265\n",
+ "\nLG Electronics Inc.\n"
+ },
+ { "543c2920e450e20a46368861fdec3a3b97ba8663",
+ "Nokia 2720a BT",
+ 0x0000, 0x0000,
+ "\nNokia\n",
+ "\n012350150101501\n",
+ "\n012350150101501\n",
+ "\nV 08.62\n"
+ "24-07-09\n"
+ "RM-520\n"
+ "(c) Nokia \n",
+ "\nNokia 2720a-2b\n",
+ "\nNokia\n"
+ },
+ { "6386ffa7a39ced3c9bfd1d693b90975661e54a86",
+ "Gobi 1000",
+ 0x03f0, 0x1f1d,
+ "\nManufacturer: QUALCOMM INCORPORATED\n"
+ "Model: 88\n"
+ "Revision: D1020-SUUAASFA-4352 1 [Apr 14 2008 18:00:00]\n"
+ "IMEI: 239639269236269\n"
+ "+GCAP: +CGSM,+DS\n",
+ "\nManufacturer: QUALCOMM INCORPORATED\n"
+ "Model: 88\n"
+ "Revision: D1020-SUUAASFA-4352 1 [Apr 14 2008 18:00:00]\n"
+ "IMEI: 239639269236269\n"
+ "+GCAP: +CGSM,+DS\n",
+ "\n239639269236269\n",
+ "\nD1020-SUUAASFA-4352 1 [Apr 14 2008 18:00:00]\n",
+ "\n88\n",
+ "\nQUALCOMM INCORPORATED\n"
+ },
+ { NULL }
+};
+
+static void
+test_devid_item (void *f, gpointer d)
+{
+ DevidItem *item = (DevidItem *) d;
+ char *devid;
+
+ g_print ("%s... ", item->desc);
+ devid = mm_create_device_identifier (item->vid,
+ item->pid,
+ item->ati,
+ item->ati1,
+ item->gsn,
+ item->revision,
+ item->model,
+ item->manf,
+ FALSE);
+ g_assert (devid);
+if (strcmp (devid, item->devid))
+g_message (devid);
+ g_assert (!strcmp (devid, item->devid));
+}
+
static TestData *
test_data_new (void)
{
@@ -815,6 +1110,7 @@ int main (int argc, char **argv)
GTestSuite *suite;
TestData *data;
gint result;
+ DevidItem *item = &devids[0];
g_test_init (&argc, &argv, NULL);
@@ -879,6 +1175,11 @@ int main (int argc, char **argv)
g_test_suite_add (suite, TESTCASE (test_cscs_buslink_support_response, data));
g_test_suite_add (suite, TESTCASE (test_cscs_blackberry_support_response, data));
+ while (item->devid) {
+ g_test_suite_add (suite, TESTCASE (test_devid_item, (gconstpointer) item));
+ item++;
+ }
+
result = g_test_run ();
test_data_free (data);