kerneldevice: allow loading physdev sysfs path
This commit is contained in:
@@ -497,6 +497,14 @@ kernel_device_get_physdev_pid (MMKernelDevice *self)
|
||||
return MM_KERNEL_DEVICE_GENERIC (self)->priv->physdev_pid;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
kernel_device_get_physdev_sysfs_path (MMKernelDevice *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_KERNEL_DEVICE_GENERIC (self), 0);
|
||||
|
||||
return MM_KERNEL_DEVICE_GENERIC (self)->priv->physdev_sysfs_path;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
kernel_device_get_physdev_subsystem (MMKernelDevice *self)
|
||||
{
|
||||
@@ -1099,6 +1107,7 @@ mm_kernel_device_generic_class_init (MMKernelDeviceGenericClass *klass)
|
||||
kernel_device_class->get_physdev_uid = kernel_device_get_physdev_uid;
|
||||
kernel_device_class->get_physdev_vid = kernel_device_get_physdev_vid;
|
||||
kernel_device_class->get_physdev_pid = kernel_device_get_physdev_pid;
|
||||
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_parent_sysfs_path = kernel_device_get_parent_sysfs_path;
|
||||
|
||||
@@ -383,6 +383,21 @@ kernel_device_get_physdev_pid (MMKernelDevice *_self)
|
||||
return self->priv->product;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
kernel_device_get_physdev_sysfs_path (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_path (self->priv->physdev);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
kernel_device_get_physdev_subsystem (MMKernelDevice *_self)
|
||||
{
|
||||
@@ -894,6 +909,7 @@ mm_kernel_device_udev_class_init (MMKernelDeviceUdevClass *klass)
|
||||
kernel_device_class->get_physdev_uid = kernel_device_get_physdev_uid;
|
||||
kernel_device_class->get_physdev_vid = kernel_device_get_physdev_vid;
|
||||
kernel_device_class->get_physdev_pid = kernel_device_get_physdev_pid;
|
||||
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_parent_sysfs_path = kernel_device_get_parent_sysfs_path;
|
||||
|
||||
@@ -99,6 +99,16 @@ mm_kernel_device_get_physdev_subsystem (MMKernelDevice *self)
|
||||
NULL);
|
||||
}
|
||||
|
||||
const gchar *
|
||||
mm_kernel_device_get_physdev_sysfs_path (MMKernelDevice *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_KERNEL_DEVICE (self), NULL);
|
||||
|
||||
return (MM_KERNEL_DEVICE_GET_CLASS (self)->get_physdev_sysfs_path ?
|
||||
MM_KERNEL_DEVICE_GET_CLASS (self)->get_physdev_sysfs_path (self) :
|
||||
NULL);
|
||||
}
|
||||
|
||||
const gchar *
|
||||
mm_kernel_device_get_physdev_manufacturer (MMKernelDevice *self)
|
||||
{
|
||||
|
||||
@@ -55,6 +55,8 @@ struct _MMKernelDeviceClass {
|
||||
|
||||
guint16 (* get_physdev_pid) (MMKernelDevice *self);
|
||||
|
||||
const gchar * (* get_physdev_sysfs_path) (MMKernelDevice *self);
|
||||
|
||||
const gchar * (* get_physdev_subsystem) (MMKernelDevice *self);
|
||||
|
||||
const gchar * (* get_physdev_manufacturer) (MMKernelDevice *self);
|
||||
@@ -89,6 +91,7 @@ const gchar *mm_kernel_device_get_parent_sysfs_path (MMKernelDevice *self);
|
||||
const gchar *mm_kernel_device_get_physdev_uid (MMKernelDevice *self);
|
||||
guint16 mm_kernel_device_get_physdev_vid (MMKernelDevice *self);
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user