kerneldevice: allow loading physdev product string
This commit is contained in:
committed by
Dan Williams
parent
df8ead4808
commit
0a2060cc78
@@ -545,6 +545,14 @@ kernel_device_get_physdev_manufacturer (MMKernelDevice *self)
|
||||
return MM_KERNEL_DEVICE_GENERIC (self)->priv->physdev_manufacturer;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
kernel_device_get_physdev_product (MMKernelDevice *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_KERNEL_DEVICE_GENERIC (self), 0);
|
||||
|
||||
return MM_KERNEL_DEVICE_GENERIC (self)->priv->physdev_product;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
kernel_device_cmp (MMKernelDevice *a,
|
||||
MMKernelDevice *b)
|
||||
@@ -1081,6 +1089,7 @@ mm_kernel_device_generic_class_init (MMKernelDeviceGenericClass *klass)
|
||||
kernel_device_class->get_physdev_sysfs_path = kernel_device_get_physdev_sysfs_path;
|
||||
kernel_device_class->get_physdev_subsystem = kernel_device_get_physdev_subsystem;
|
||||
kernel_device_class->get_physdev_manufacturer = kernel_device_get_physdev_manufacturer;
|
||||
kernel_device_class->get_physdev_product = kernel_device_get_physdev_product;
|
||||
kernel_device_class->get_interface_class = kernel_device_get_interface_class;
|
||||
kernel_device_class->get_interface_subclass = kernel_device_get_interface_subclass;
|
||||
kernel_device_class->get_interface_protocol = kernel_device_get_interface_protocol;
|
||||
|
||||
@@ -439,6 +439,21 @@ kernel_device_get_physdev_manufacturer (MMKernelDevice *_self)
|
||||
return g_udev_device_get_sysfs_attr (self->priv->physdev, "manufacturer");
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
kernel_device_get_physdev_product (MMKernelDevice *_self)
|
||||
{
|
||||
MMKernelDeviceUdev *self;
|
||||
|
||||
g_return_val_if_fail (MM_IS_KERNEL_DEVICE_UDEV (_self), NULL);
|
||||
|
||||
self = MM_KERNEL_DEVICE_UDEV (_self);
|
||||
ensure_physdev (self);
|
||||
if (!self->priv->physdev)
|
||||
return NULL;
|
||||
|
||||
return g_udev_device_get_sysfs_attr (self->priv->physdev, "product");
|
||||
}
|
||||
|
||||
static gint
|
||||
kernel_device_get_interface_class (MMKernelDevice *_self)
|
||||
{
|
||||
@@ -882,6 +897,7 @@ mm_kernel_device_udev_class_init (MMKernelDeviceUdevClass *klass)
|
||||
kernel_device_class->get_physdev_sysfs_path = kernel_device_get_physdev_sysfs_path;
|
||||
kernel_device_class->get_physdev_subsystem = kernel_device_get_physdev_subsystem;
|
||||
kernel_device_class->get_physdev_manufacturer = kernel_device_get_physdev_manufacturer;
|
||||
kernel_device_class->get_physdev_product = kernel_device_get_physdev_product;
|
||||
kernel_device_class->get_interface_class = kernel_device_get_interface_class;
|
||||
kernel_device_class->get_interface_subclass = kernel_device_get_interface_subclass;
|
||||
kernel_device_class->get_interface_protocol = kernel_device_get_interface_protocol;
|
||||
|
||||
@@ -123,6 +123,16 @@ mm_kernel_device_get_physdev_manufacturer (MMKernelDevice *self)
|
||||
NULL);
|
||||
}
|
||||
|
||||
const gchar *
|
||||
mm_kernel_device_get_physdev_product (MMKernelDevice *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_KERNEL_DEVICE (self), NULL);
|
||||
|
||||
return (MM_KERNEL_DEVICE_GET_CLASS (self)->get_physdev_product ?
|
||||
MM_KERNEL_DEVICE_GET_CLASS (self)->get_physdev_product (self) :
|
||||
NULL);
|
||||
}
|
||||
|
||||
gint
|
||||
mm_kernel_device_get_interface_class (MMKernelDevice *self)
|
||||
{
|
||||
|
||||
@@ -52,6 +52,7 @@ struct _MMKernelDeviceClass {
|
||||
const gchar * (* get_physdev_sysfs_path) (MMKernelDevice *self);
|
||||
const gchar * (* get_physdev_subsystem) (MMKernelDevice *self);
|
||||
const gchar * (* get_physdev_manufacturer) (MMKernelDevice *self);
|
||||
const gchar * (* get_physdev_product) (MMKernelDevice *self);
|
||||
|
||||
gboolean (* cmp) (MMKernelDevice *a, MMKernelDevice *b);
|
||||
|
||||
@@ -86,6 +87,7 @@ guint16 mm_kernel_device_get_physdev_pid (MMKernelDevice *self);
|
||||
const gchar *mm_kernel_device_get_physdev_sysfs_path (MMKernelDevice *self);
|
||||
const gchar *mm_kernel_device_get_physdev_subsystem (MMKernelDevice *self);
|
||||
const gchar *mm_kernel_device_get_physdev_manufacturer (MMKernelDevice *self);
|
||||
const gchar *mm_kernel_device_get_physdev_product (MMKernelDevice *self);
|
||||
|
||||
gboolean mm_kernel_device_cmp (MMKernelDevice *a, MMKernelDevice *b);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user