[PATCH 02/10] kernel-device: new generic kernel device object, with a udev backend
Dan Williams
dcbw at redhat.com
Fri Aug 19 19:42:57 UTC 2016
On Sat, 2016-08-06 at 15:03 +0200, Aleksander Morgado wrote:
> Instead of relying constantly on GUdevDevice objects reported by
> GUdev, we now
> use a new generic object (MMKernelDevice) for which we provide an
> initial GUdev
> based backend.
>
> This will help make udev monitoring support optional during
> compilation.
> ---
> plugins/Makefile.am | 1 +
> plugins/cinterion/mm-plugin-cinterion.c | 4 +-
> plugins/dell/mm-plugin-dell.c | 8 +-
> plugins/haier/mm-plugin-haier.c | 4 +-
> plugins/huawei/mm-plugin-huawei.c | 20 +-
> plugins/longcheer/mm-plugin-longcheer.c | 6 +-
> plugins/mbm/mm-plugin-mbm.c | 4 +-
> plugins/mtk/mm-plugin-mtk.c | 6 +-
> plugins/nokia/mm-plugin-nokia-icera.c | 6 +-
> plugins/option/mm-plugin-hso.c | 6 +-
> plugins/option/mm-plugin-option.c | 4 +-
> plugins/simtech/mm-plugin-simtech.c | 8 +-
> plugins/telit/mm-common-telit.c | 24 +-
> plugins/x22x/mm-plugin-x22x.c | 6 +-
> plugins/zte/mm-plugin-zte.c | 8 +-
> src/Makefile.am | 15 +
> src/kerneldevice/mm-kernel-device-udev.c | 614
> +++++++++++++++++++++++++++++++
> src/kerneldevice/mm-kernel-device-udev.h | 48 +++
> src/kerneldevice/mm-kernel-device.c | 179 +++++++++
> src/kerneldevice/mm-kernel-device.h | 89 +++++
> src/mm-base-manager.c | 231 +++---------
> src/mm-device.c | 341 ++++-------------
> src/mm-device.h | 96 +++--
> src/mm-plugin-manager.c | 38 +-
> src/mm-plugin.c | 78 ++--
> src/mm-plugin.h | 10 +-
> src/mm-port-probe.c | 205 +++++------
> src/mm-port-probe.h | 20 +-
> 28 files changed, 1336 insertions(+), 743 deletions(-)
> create mode 100644 src/kerneldevice/mm-kernel-device-udev.c
> create mode 100644 src/kerneldevice/mm-kernel-device-udev.h
> create mode 100644 src/kerneldevice/mm-kernel-device.c
> create mode 100644 src/kerneldevice/mm-kernel-device.h
>
> diff --git a/plugins/Makefile.am b/plugins/Makefile.am
> index 31d222a..435d0ed 100644
> --- a/plugins/Makefile.am
> +++ b/plugins/Makefile.am
> @@ -12,6 +12,7 @@ AM_CFLAGS = \
> -I$(top_srcdir) \
> -I$(top_srcdir)/src \
> -I$(top_builddir)/src \
> + -I$(top_srcdir)/src/kerneldevice \
> -I$(top_srcdir)/include \
> -I$(top_builddir)/include \
> -I$(top_srcdir)/libmm-glib \
> diff --git a/plugins/cinterion/mm-plugin-cinterion.c
> b/plugins/cinterion/mm-plugin-cinterion.c
> index d65ad53..4492cda 100644
> --- a/plugins/cinterion/mm-plugin-cinterion.c
> +++ b/plugins/cinterion/mm-plugin-cinterion.c
> @@ -176,8 +176,8 @@ grab_port (MMPlugin *self,
> mm_port_probe_get_port_subsys (probe),
> mm_port_probe_get_port_name (probe));
> pflags = MM_PORT_SERIAL_AT_FLAG_PPP;
> - } else if (g_udev_device_get_property_as_boolean
> (mm_port_probe_peek_port (probe),
> - "ID_MM_CINTERI
> ON_PORT_TYPE_GPS")) {
> + } else if (mm_kernel_device_get_property_as_boolean
> (mm_port_probe_peek_port (probe),
> + "ID_MM_CINT
> ERION_PORT_TYPE_GPS")) {
> mm_dbg ("(%s/%s)' Port flagged as GPS",
> mm_port_probe_get_port_subsys (probe),
> mm_port_probe_get_port_name (probe));
> diff --git a/plugins/dell/mm-plugin-dell.c b/plugins/dell/mm-plugin-
> dell.c
> index c40f40d..290faa8 100644
> --- a/plugins/dell/mm-plugin-dell.c
> +++ b/plugins/dell/mm-plugin-dell.c
> @@ -324,9 +324,9 @@ dell_custom_init (MMPortProbe *probe,
> gpointer user_data)
> {
> CustomInitContext *ctx;
> - GUdevDevice *udevDevice;
> + MMKernelDevice *port_device;
>
> - udevDevice = mm_port_probe_peek_port (probe);
> + port_device = mm_port_probe_peek_port (probe);
>
> ctx = g_slice_new0 (CustomInitContext);
> ctx->result = g_simple_async_result_new (G_OBJECT (probe),
> @@ -342,7 +342,7 @@ dell_custom_init (MMPortProbe *probe,
>
> /* Dell-branded Telit modems always answer to +GMI
> * Avoid +CGMI and ATI sending for minimizing port probing time
> */
> - if (g_udev_device_get_property_as_boolean (udevDevice,
> "ID_MM_TELIT_PORTS_TAGGED")) {
> + if (mm_kernel_device_get_property_as_boolean (port_device,
> "ID_MM_TELIT_PORTS_TAGGED")) {
> ctx->cgmi_retries = 0;
> ctx->ati_retries = 0;
> }
> @@ -420,7 +420,7 @@ create_modem (MMPlugin *self,
>
> if (port_probe_list_has_manufacturer_port (probes,
> DELL_MANUFACTURER_TELIT)) {
> mm_dbg ("Telit-powered Dell-branded modem found...");
> - return MM_BASE_MODEM (mm_broadband_modem_telit_new
> (sysfs_path,
> + return MM_BASE_MODEM (mm_broadband_modem_telit_new (uid,
> drivers,
> mm_plugi
> n_get_name (self),
This last hunk belongs in patch #1 (sysfs->uid). Rest looks fine.
Dan
More information about the ModemManager-devel
mailing list