base-modem: add subsystem vendor ID property

Subsystem vendor ID can be used for identifying PCI modems,
so expose the property.
This commit is contained in:
Daniele Palmas
2022-05-04 11:49:03 +02:00
parent ff5840c3c7
commit 654c5f5014
46 changed files with 96 additions and 13 deletions

View File

@@ -55,6 +55,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -42,6 +42,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -40,6 +40,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -114,6 +114,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -373,6 +373,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -40,6 +40,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -49,6 +49,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -50,6 +50,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -54,6 +54,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -44,6 +44,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -35,6 +35,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -624,6 +624,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -38,6 +38,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -41,6 +41,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -37,6 +37,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -187,6 +187,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -44,6 +44,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -38,6 +38,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -38,6 +38,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -46,6 +46,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -47,6 +47,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -38,6 +38,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -50,6 +50,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -115,6 +115,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -38,6 +38,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -80,6 +80,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -45,6 +45,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -45,6 +45,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -39,6 +39,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -40,6 +40,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -49,6 +49,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -42,6 +42,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -49,6 +49,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -43,6 +43,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -40,6 +40,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -37,6 +37,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -39,6 +39,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -44,6 +44,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -189,6 +189,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -65,6 +65,7 @@ create_modem (MMPlugin *self,
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error)
{

View File

@@ -57,6 +57,7 @@ enum {
PROP_PLUGIN,
PROP_VENDOR_ID,
PROP_PRODUCT_ID,
PROP_SUBSYSTEM_VENDOR_ID,
PROP_CONNECTION,
PROP_REPROBE,
PROP_DATA_NET_SUPPORTED,
@@ -89,6 +90,7 @@ struct _MMBaseModemPrivate {
guint vendor_id;
guint product_id;
guint subsystem_vendor_id;
gboolean hotplugged;
gboolean valid;
@@ -1671,6 +1673,14 @@ mm_base_modem_get_product_id (MMBaseModem *self)
return self->priv->product_id;
}
guint
mm_base_modem_get_subsystem_vendor_id (MMBaseModem *self)
{
g_return_val_if_fail (MM_IS_BASE_MODEM (self), 0);
return self->priv->subsystem_vendor_id;
}
/*****************************************************************************/
static gboolean
@@ -1832,6 +1842,9 @@ set_property (GObject *object,
case PROP_PRODUCT_ID:
self->priv->product_id = g_value_get_uint (value);
break;
case PROP_SUBSYSTEM_VENDOR_ID:
self->priv->subsystem_vendor_id = g_value_get_uint (value);
break;
case PROP_CONNECTION:
g_clear_object (&self->priv->connection);
self->priv->connection = g_value_dup_object (value);
@@ -1881,6 +1894,9 @@ get_property (GObject *object,
case PROP_PRODUCT_ID:
g_value_set_uint (value, self->priv->product_id);
break;
case PROP_SUBSYSTEM_VENDOR_ID:
g_value_set_uint (value, self->priv->subsystem_vendor_id);
break;
case PROP_CONNECTION:
g_value_set_object (value, self->priv->connection);
break;
@@ -2034,6 +2050,14 @@ mm_base_modem_class_init (MMBaseModemClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_PRODUCT_ID, properties[PROP_PRODUCT_ID]);
properties[PROP_SUBSYSTEM_VENDOR_ID] =
g_param_spec_uint (MM_BASE_MODEM_SUBSYSTEM_VENDOR_ID,
"Hardware subsystem vendor ID",
"Hardware subsystem vendor ID. Available for pci devices.",
0, G_MAXUINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_SUBSYSTEM_VENDOR_ID, properties[PROP_SUBSYSTEM_VENDOR_ID]);
properties[PROP_CONNECTION] =
g_param_spec_object (MM_BASE_MODEM_CONNECTION,
"Connection",

View File

@@ -55,17 +55,18 @@ typedef struct _MMBaseModem MMBaseModem;
typedef struct _MMBaseModemClass MMBaseModemClass;
typedef struct _MMBaseModemPrivate MMBaseModemPrivate;
#define MM_BASE_MODEM_CONNECTION "base-modem-connection"
#define MM_BASE_MODEM_MAX_TIMEOUTS "base-modem-max-timeouts"
#define MM_BASE_MODEM_VALID "base-modem-valid"
#define MM_BASE_MODEM_DEVICE "base-modem-device"
#define MM_BASE_MODEM_DRIVERS "base-modem-drivers"
#define MM_BASE_MODEM_PLUGIN "base-modem-plugin"
#define MM_BASE_MODEM_VENDOR_ID "base-modem-vendor-id"
#define MM_BASE_MODEM_PRODUCT_ID "base-modem-product-id"
#define MM_BASE_MODEM_REPROBE "base-modem-reprobe"
#define MM_BASE_MODEM_DATA_NET_SUPPORTED "base-modem-data-net-supported"
#define MM_BASE_MODEM_DATA_TTY_SUPPORTED "base-modem-data-tty-supported"
#define MM_BASE_MODEM_CONNECTION "base-modem-connection"
#define MM_BASE_MODEM_MAX_TIMEOUTS "base-modem-max-timeouts"
#define MM_BASE_MODEM_VALID "base-modem-valid"
#define MM_BASE_MODEM_DEVICE "base-modem-device"
#define MM_BASE_MODEM_DRIVERS "base-modem-drivers"
#define MM_BASE_MODEM_PLUGIN "base-modem-plugin"
#define MM_BASE_MODEM_VENDOR_ID "base-modem-vendor-id"
#define MM_BASE_MODEM_PRODUCT_ID "base-modem-product-id"
#define MM_BASE_MODEM_SUBSYSTEM_VENDOR_ID "base-modem-subsystem-vendor-id"
#define MM_BASE_MODEM_REPROBE "base-modem-reprobe"
#define MM_BASE_MODEM_DATA_NET_SUPPORTED "base-modem-data-net-supported"
#define MM_BASE_MODEM_DATA_TTY_SUPPORTED "base-modem-data-tty-supported"
#define MM_BASE_MODEM_SIGNAL_LINK_PORT_GRABBED "base-modem-link-port-grabbed"
#define MM_BASE_MODEM_SIGNAL_LINK_PORT_RELEASED "base-modem-link-port-released"
@@ -207,8 +208,9 @@ const gchar *mm_base_modem_get_device (MMBaseModem *self);
const gchar **mm_base_modem_get_drivers (MMBaseModem *self);
const gchar *mm_base_modem_get_plugin (MMBaseModem *self);
guint mm_base_modem_get_vendor_id (MMBaseModem *self);
guint mm_base_modem_get_product_id (MMBaseModem *self);
guint mm_base_modem_get_vendor_id (MMBaseModem *self);
guint mm_base_modem_get_product_id (MMBaseModem *self);
guint mm_base_modem_get_subsystem_vendor_id (MMBaseModem *self);
GCancellable *mm_base_modem_peek_cancellable (MMBaseModem *self);
GCancellable *mm_base_modem_get_cancellable (MMBaseModem *self);

View File

@@ -66,6 +66,8 @@ struct _MMDevicePrivate {
/* If USB, device vid/pid */
guint16 vendor;
guint16 product;
/* Subsystem vendor ID for PCI devices */
guint16 subsystem_vendor;
/* Kernel drivers managing this device */
gchar **drivers;
@@ -241,6 +243,9 @@ mm_device_grab_port (MMDevice *self,
self->priv->product = mm_kernel_device_get_physdev_pid (kernel_port);
}
if (!self->priv->subsystem_vendor)
self->priv->subsystem_vendor = mm_kernel_device_get_physdev_subsystem_vid (kernel_port);
/* Add new port driver */
add_port_driver (self, kernel_port);
@@ -363,6 +368,9 @@ export_modem (MMDevice *self)
mm_obj_dbg (self, " vid:pid: 0x%04X:0x%04X",
(mm_base_modem_get_vendor_id (self->priv->modem) & 0xFFFF),
(mm_base_modem_get_product_id (self->priv->modem) & 0xFFFF));
if (mm_base_modem_get_subsystem_vendor_id (self->priv->modem))
mm_obj_dbg (self, " subsystem vid: 0x%04X",
(mm_base_modem_get_subsystem_vendor_id (self->priv->modem) & 0xFFFF));
if (self->priv->virtual)
mm_obj_dbg (self, " virtual");
@@ -515,6 +523,12 @@ mm_device_get_product (MMDevice *self)
return self->priv->product;
}
guint16
mm_device_get_subsystem_vendor (MMDevice *self)
{
return self->priv->subsystem_vendor;
}
void
mm_device_set_plugin (MMDevice *self,
GObject *plugin)

View File

@@ -99,6 +99,7 @@ const gchar *mm_device_get_uid (MMDevice *self);
const gchar **mm_device_get_drivers (MMDevice *self);
guint16 mm_device_get_vendor (MMDevice *self);
guint16 mm_device_get_product (MMDevice *self);
guint16 mm_device_get_subsystem_vendor (MMDevice *self);
void mm_device_set_plugin (MMDevice *self,
GObject *plugin);
GObject *mm_device_peek_plugin (MMDevice *self);

View File

@@ -924,6 +924,7 @@ mm_plugin_create_modem (MMPlugin *self,
drivers,
mm_device_get_vendor (device),
mm_device_get_product (device),
mm_device_get_subsystem_vendor (device),
port_probes,
error);
if (!modem)

View File

@@ -111,6 +111,7 @@ struct _MMPluginClass {
const gchar **drivers,
guint16 vendor,
guint16 product,
guint16 subsystem_vendor,
GList *probes,
GError **error);