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
This commit is contained in:
Aleksander Morgado
2016-09-28 18:49:08 +02:00
parent aa4577dfb9
commit c4a584416a
19 changed files with 1437 additions and 73 deletions

View File

@@ -72,6 +72,7 @@
<chapter>
<title>The Manager object</title>
<xi:include href="xml/mm-manager.xml"/>
<xi:include href="xml/mm-kernel-event-properties.xml"/>
</chapter>
<chapter>

View File

@@ -20,6 +20,9 @@ mm_manager_scan_devices_sync
mm_manager_set_logging
mm_manager_set_logging_finish
mm_manager_set_logging_sync
mm_manager_report_kernel_event
mm_manager_report_kernel_event_finish
mm_manager_report_kernel_event_sync
<SUBSECTION Standard>
MMManagerClass
MMManagerPrivate
@@ -32,6 +35,37 @@ MM_TYPE_MANAGER
mm_manager_get_type
</SECTION>
<SECTION>
<FILE>mm-kernel-event-properties</FILE>
<TITLE>MMKernelEventProperties</TITLE>
MMKernelEventProperties
<SUBSECTION Methods>
mm_kernel_event_properties_new
mm_kernel_event_properties_get_action
mm_kernel_event_properties_set_action
mm_kernel_event_properties_get_name
mm_kernel_event_properties_set_name
mm_kernel_event_properties_get_subsystem
mm_kernel_event_properties_set_subsystem
mm_kernel_event_properties_get_uid
mm_kernel_event_properties_set_uid
<SUBSECTION Private>
mm_kernel_event_properties_new_from_string
mm_kernel_event_properties_new_from_dictionary
mm_kernel_event_properties_dup
mm_kernel_event_properties_get_dictionary
<SUBSECTION Standard>
MMKernelEventPropertiesClass
MMKernelEventPropertiesPrivate
MM_KERNEL_EVENT_PROPERTIES
MM_KERNEL_EVENT_PROPERTIES_CLASS
MM_KERNEL_EVENT_PROPERTIES_GET_CLASS
MM_IS_KERNEL_EVENT_PROPERTIES
MM_IS_KERNEL_EVENT_PROPERTIES_CLASS
MM_TYPE_KERNEL_EVENT_PROPERTIES
mm_kernel_event_properties_get_type
</SECTION>
<SECTION>
<FILE>mm-object</FILE>
<TITLE>MMObject</TITLE>
@@ -1555,10 +1589,14 @@ mm_gdbus_org_freedesktop_modem_manager1_call_scan_devices_sync
mm_gdbus_org_freedesktop_modem_manager1_call_set_logging
mm_gdbus_org_freedesktop_modem_manager1_call_set_logging_finish
mm_gdbus_org_freedesktop_modem_manager1_call_set_logging_sync
mm_gdbus_org_freedesktop_modem_manager1_call_report_kernel_event
mm_gdbus_org_freedesktop_modem_manager1_call_report_kernel_event_finish
mm_gdbus_org_freedesktop_modem_manager1_call_report_kernel_event_sync
<SUBSECTION Private>
mm_gdbus_org_freedesktop_modem_manager1_override_properties
mm_gdbus_org_freedesktop_modem_manager1_complete_scan_devices
mm_gdbus_org_freedesktop_modem_manager1_complete_set_logging
mm_gdbus_org_freedesktop_modem_manager1_complete_report_kernel_event
mm_gdbus_org_freedesktop_modem_manager1_interface_info
<SUBSECTION Standard>
MM_GDBUS_IS_ORG_FREEDESKTOP_MODEM_MANAGER1