Files
ModemManager/src/mm-base-manager.h
T
Aleksander Morgado c4a584416a core: allow disabling auto-scan and notifying ports one by one via API
This commit enables a new core ModemManager daemon option, so that automatic
detection of available modems is totally disabled: '--no-auto-scan'. Note that
this option also replaces the previously used '--test-no-auto-scan' option,
which was only used during tests.

Along with the new ModemManager option, a new ReportKernelEvent() method in
the API is defined, which allows notifying the daemon of which interfaces it
should be accessing, as well as the main details of each interface. The only
mandatory parameters in the new method are 'action' (add/remove), 'name' (the
name of the interface) and 'subsystem' (the subsystem of the interface).

The mmcli tool has support for using the new api method via several new options:

 * The '--report-kernel-event' option allows specifying device ports one by
   one, and is a direct mapping of the ReportKernelEvent() method:
     $ sudo mmcli --report-kernel-event="action=add,name=wwan0,subsystem=net"
     $ sudo mmcli --report-kernel-event="action=add,name=cdc-wdm0,subsystem=usbmisc"

 * The '--report-kernel-event-auto-scan' option uses udev monitoring to notify
   events automatically to the daemon. This allows to operate in a way
   equivalent to the default daemon operation (with implicit auto-scan).

Worth noting that the ReportKernelEvent() method is only usable when
'--no-auto-scan' is explicitly used in the daemon. An error will be reported if
the method is tried while standard udev monitoring is enabled (implicit if
auto scan isn't explicitly disabled in the daemon).

If mmcli is going to be used only to report 'real time' events, an optional
'--initial-kernel-events=[PATH]' may be given in the ModemManager call to
automatically process a set of port kernel events one by one on boot. The file
may e.g. contain:
  action=add,name=wwan0,subsystem=net
  action=add,name=cdc-wdm0,subsystem=usbmisc
2016-09-29 15:43:05 +02:00

68 lines
2.9 KiB
C

/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
* Copyright (C) 2008 - 2009 Novell, Inc.
* Copyright (C) 2009 - 2011 Red Hat, Inc.
* Copyright (C) 2011 Google, Inc.
*/
#ifndef MM_BASE_MANAGER_H
#define MM_BASE_MANAGER_H
#include <glib-object.h>
#include <gio/gio.h>
#include "mm-gdbus-manager.h"
#define MM_TYPE_BASE_MANAGER (mm_base_manager_get_type ())
#define MM_BASE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BASE_MANAGER, MMBaseManager))
#define MM_BASE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BASE_MANAGER, MMBaseManagerClass))
#define MM_IS_BASE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BASE_MANAGER))
#define MM_IS_BASE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), MM_TYPE_BASE_MANAGER))
#define MM_BASE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BASE_MANAGER, MMBaseManagerClass))
#define MM_BASE_MANAGER_CONNECTION "connection" /* Construct-only */
#define MM_BASE_MANAGER_AUTO_SCAN "auto-scan" /* Construct-only */
#define MM_BASE_MANAGER_ENABLE_TEST "enable-test" /* Construct-only */
#define MM_BASE_MANAGER_PLUGIN_DIR "plugin-dir" /* Construct-only */
#define MM_BASE_MANAGER_INITIAL_KERNEL_EVENTS "initial-kernel-events" /* Construct-only */
typedef struct _MMBaseManagerPrivate MMBaseManagerPrivate;
typedef struct {
MmGdbusOrgFreedesktopModemManager1Skeleton parent;
MMBaseManagerPrivate *priv;
} MMBaseManager;
typedef struct {
MmGdbusOrgFreedesktopModemManager1SkeletonClass parent;
} MMBaseManagerClass;
GType mm_base_manager_get_type (void);
MMBaseManager *mm_base_manager_new (GDBusConnection *bus,
const gchar *plugin_dir,
gboolean auto_scan,
const gchar *initial_kernel_events,
gboolean enable_test,
GError **error);
void mm_base_manager_start (MMBaseManager *manager,
gboolean manual_scan);
void mm_base_manager_shutdown (MMBaseManager *manager,
gboolean disable);
guint32 mm_base_manager_num_modems (MMBaseManager *manager);
#endif /* MM_BASE_MANAGER_H */