diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-03-06 12:01:56 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-03-22 09:40:10 +0100 |
commit | 00fb9e98f6003f6b167f7d12a895ec3d1402b027 (patch) | |
tree | d1fc5df50bfec704fb257bb7dc8091fe64163eb9 /src/kerneldevice/mm-kernel-device.h | |
parent | 230e732a24e0e925f535839caecc4a69d89ab89e (diff) |
kernel-device: device-specific properties in either port or physdev
There are 2 main types of udev properties: device-specific and
port-specific.
The port-specific properties are set independently per port (e.g. port
type hints set per interface number for a given vid:pid).
The device-specific properties apply to all ports in the device. Some
of these properties are currently expected in the physical device
(e.g. ID_MM_PLATFORM_DRIVER_PROBE) while some others are expected in
each port (e.g. the plugin udev tag filters).
This patch tries to simplify the logic and just assume that the device
specific tags may be given in either the physical device or the port
device, by providing separate APIs to retrieve port-specific or
device-specific (global) properties. If the same tag is given in both
the device and the port, the one in the device takes preference.
For the generic backend, these new APIs are really useless, as all
device-specific and port-specific properties are always stored in the
port object themselves (there is no 'tree' of devices in the generic
backend, no 'physdev' device).
For the udev backend, though, there really is a difference, as the
tags may be set in port or device.
https://bugs.freedesktop.org/show_bug.cgi?id=100156
Diffstat (limited to 'src/kerneldevice/mm-kernel-device.h')
-rw-r--r-- | src/kerneldevice/mm-kernel-device.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/kerneldevice/mm-kernel-device.h b/src/kerneldevice/mm-kernel-device.h index 5c1f6db0..efb64ae7 100644 --- a/src/kerneldevice/mm-kernel-device.h +++ b/src/kerneldevice/mm-kernel-device.h @@ -62,6 +62,12 @@ struct _MMKernelDeviceClass { gboolean (* get_property_as_boolean) (MMKernelDevice *self, const gchar *property); gint (* get_property_as_int) (MMKernelDevice *self, const gchar *property); guint (* get_property_as_int_hex) (MMKernelDevice *self, const gchar *property); + + gboolean (* has_global_property) (MMKernelDevice *self, const gchar *property); + const gchar * (* get_global_property) (MMKernelDevice *self, const gchar *property); + gboolean (* get_global_property_as_boolean) (MMKernelDevice *self, const gchar *property); + gint (* get_global_property_as_int) (MMKernelDevice *self, const gchar *property); + guint (* get_global_property_as_int_hex) (MMKernelDevice *self, const gchar *property); }; GType mm_kernel_device_get_type (void); @@ -82,10 +88,18 @@ guint16 mm_kernel_device_get_physdev_pid (MMKernelDevice *self); gboolean mm_kernel_device_cmp (MMKernelDevice *a, MMKernelDevice *b); +/* Standard properties are usually associated to single ports */ gboolean mm_kernel_device_has_property (MMKernelDevice *self, const gchar *property); const gchar *mm_kernel_device_get_property (MMKernelDevice *self, const gchar *property); gboolean mm_kernel_device_get_property_as_boolean (MMKernelDevice *self, const gchar *property); gint mm_kernel_device_get_property_as_int (MMKernelDevice *self, const gchar *property); guint mm_kernel_device_get_property_as_int_hex (MMKernelDevice *self, const gchar *property); +/* Global properties are usually associated to full devices */ +gboolean mm_kernel_device_has_global_property (MMKernelDevice *self, const gchar *property); +const gchar *mm_kernel_device_get_global_property (MMKernelDevice *self, const gchar *property); +gboolean mm_kernel_device_get_global_property_as_boolean (MMKernelDevice *self, const gchar *property); +gint mm_kernel_device_get_global_property_as_int (MMKernelDevice *self, const gchar *property); +guint mm_kernel_device_get_global_property_as_int_hex (MMKernelDevice *self, const gchar *property); + #endif /* MM_KERNEL_DEVICE_H */ |