aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
AgeCommit message (Collapse)Author
2023-12-01Revert "base-manager: add support to put modem in low power mode during suspend"mainAleksander Morgado
This reverts commit 23033217de26fb91734fed3b999173f151195040. This was mixed up in the wrong branch.
2023-12-01base-manager: add support to put modem in low power mode during suspendAleksander Morgado
Based on an earlier approach from Jack Song and Nero Zhang, see https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1050
2023-01-03build: new option to build plugins within the daemon binaryAleksander Morgado
Instead of creating libmm-plugin* and libmm-shared* libraries that are dlopen()-ed on runtime, allow incorporating all plugins into the daemon binary itself. This makes the startup of the daemon much faster and also avoids issues with builds that require linker namespace isolation. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/674
2022-11-07build: disable Test interface in base manager if building without testsAleksander Morgado
There is no real need for this interface if tests are not being built.
2022-11-04core,log: new 'MSG' log level between 'INFO' and 'WARN'Aleksander Morgado
We're bumping the current "INFO" level messages to the new "MSG" level, also making the new level the default. The old "INFO" level will be used to setup an intermediate level of logging which is not as verbose as "DEBUG" but still provides some capabilities to analyze the behavior of a modem.
2022-06-09suspend: add suspend/resume support with powerd on ChromeOSRukun Mao
ModemManager handles suspend and resume signals sent from powerd Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/547
2022-04-20mm-log: hiding personal info while loggingsom
During mm logging, some of the information like simIccId, Telephone numbers need to be hidden from displaying in the logs to protect some of the user information. Implemented for MBIM requiring libmbim 1.27.6, which is the development version that includes the needed API.
2021-06-16core: dump fatal initialization errors to stderrAleksander Morgado
2021-05-26base-manager: add quick suspend/resume baseDylan Van Assche
Quick suspend/resume infrastructure for synchronizing the interfaces when resuming.
2021-05-22libmm-glib: setup common helper to register DBus errorsAleksander Morgado
2021-02-23charsets: detect iconv() support in runtimeAleksander Morgado
The only purpose of this is to log what we found, nothing else, as a quick way to detect platform support for the charsets we need.
2021-02-14context: add test-no-suspend-resume cli parameterDylan Van Assche
Disables suspend/resume support at runtime. This is useful for modems which are never turned off or suspended when the host suspends.
2020-04-09log: force using the object logging APIAleksander Morgado
Unless the generic API is explicitly allowed, as in the main.c source file.
2020-04-08core: consolidate logging format in main daemon logicAleksander Morgado
2019-10-11daemon: register G_IO_ERROR_CANCELLED as "Cancelled" in DBusAleksander Morgado
We have deprecated the use of MM_CORE_ERROR_CANCELLED inside the daemon in favor of using G_IO_ERROR_CANCELLED right away, and so, we will now register G_IO_ERROR_CANCELLED as the error mapped to the "Cancelled" error in the ModemManager error domain in DBus. We therefore avoid sending unknown/unmapped errors via DBus, as in this case: $ sudo ./test.sh error: couldn't connect the modem: 'GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code19: Operation was cancelled' successfully disconnected all bearers in the modem error: couldn't connect the modem: 'GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code19: Operation was cancelled' successfully disconnected all bearers in the modem successfully disconnected all bearers in the modem error: couldn't connect the modem: 'GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code19: Operation was cancelled' successfully disconnected all bearers in the modem error: couldn't connect the modem: 'GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code19: Operation was cancelled' successfully disconnected all bearers in the modem error: couldn't connect the modem: 'GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code19: Operation was cancelled' error: couldn't connect the modem: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Cancelled: Connection attempt cancelled' successfully disconnected all bearers in the modem error: couldn't connect the modem: 'GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code19: Operation was cancelled' successfully disconnected all bearers in the modem successfully disconnected all bearers in the modem error: couldn't connect the modem: 'GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code19: Operation was cancelled' error: couldn't connect the modem: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Cancelled: Connection attempt cancelled' successfully disconnected all bearers in the modem error: couldn't connect the modem: 'GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code19: Operation was cancelled' successfully disconnected all bearers in the modem
2017-12-05filter: allow selection of filter policy on startupAleksander Morgado
Added a new '--filter-policy=[POLICY]' option in the daemon, which allows selecting between the supported filter policies. For now, only two policies are defined: * default: the default policy used by ModemManager, where it tries to probe and detect as many modem ports as possible. * whitelist-only: only devices explicitly tagged via udev (with the ID_MM_DEVICE_PROCESS tag) will be probed and used.
2017-06-22build: rename --with-suspend-resume to --with-systemd-suspend-resumeAleksander Morgado
And only define WITH_SYSTEMD_SUSPEND_RESUME when enabled. We already have other systemd specific features under the --with-systemd-* name scheme, so consolidate that, given that we don't have any other method to support suspend/resume notifications.
2017-06-21log: Add support for journal loggingTorsten Hilbrich
This logging is available if the software was build with the configure option --with-systemd-journal. It will be enabled by default if libsystemd is found. The runtime parameter --log-journal enables to output of log messages to the systemd journal. Please note that the journal priority field has the same value as the syslog level so no conversion is required here.
2017-05-29log: remove func loc info unless MM_LOG_FUNC_LOC is definedAleksander Morgado
The user can build the project passing custom CFLAGS to enable the function location information, e.g.: $ ./configure --prefix=/usr CFLAGS="-DMM_LOG_FUNC_LOC"
2017-05-29context: rework application options and help outputAleksander Morgado
Group together all options that allow configuring the logging output, and make them have the same --log-[XXX] prefix. Also rework the --help output so that all option groups are printed by default (i.e. there is no longer a --help-all option).
2017-02-03glib: remove invocations of g_type_init()Ben Chan
g_type_init() has been deprecated (and also marked with the attribute 'deprecated') since glib 2.36 as the type system is automatically initialized. Since the minimum version of glib required by ModemManager is 2.36, calling g_type_init() isn't necessarily in the ModemManager code.
2016-09-29core: allow disabling auto-scan and notifying ports one by one via APIAleksander Morgado
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
2015-02-07suspend: invalidate and remove modems on suspend, reprobe on resumeAleksander Morgado
2015-01-11core: perform clean-up when terminating due to a Unix signalJakub Sitnicki
Since commit 2d700043abc5 ("core: use g_unix_signal_add() for more reliable Unix signal handling") we no longer have to stick to signal-safe functions in the SIGTERM/SIGINT handler. Use exit() to terminate so that the clean-up functions are ran and code coverage data gets written into files.
2014-09-05core: add --version option to the ModemManager daemonAleksander Morgado
It was actually included in the man page of the daemon, but we didn't have it.
2014-07-06manager: rename 'MMManager' to 'MMBaseManager'Aleksander Morgado
Just so that we don't have same header names in src/ and /libmm-glib.
2014-05-20core: minor coding style fixesBen Chan
2014-02-13manager: as soon as we know we're going to stop, clear DBus connectionAleksander Morgado
So that the ObjectManager interface doesn't try to signal about e.g. interface removals; see: https://bugzilla.gnome.org/show_bug.cgi?id=715157.
2014-02-13context: new '--test-plugin-dir' to allow specifying where the plugins areAleksander Morgado
2014-02-13context: new '--test-enable' to enable the Test interfaceAleksander Morgado
2014-02-13context: new '--test-no-auto-scan' to avoid automatic scanning for devicesAleksander Morgado
2014-02-13context: new '--test-session' allows launching the MM daemon in the session busAleksander Morgado
2013-03-05core: don't automatically probe ports of USB<->serial adaptersAleksander Morgado
We should not automatically probe ports marked as coming from USB to serial adapters, as we're not sure that a modem is behind the adapter. Still, let the user request a manual scan and have these devices probed in that case. https://bugzilla.gnome.org/show_bug.cgi?id=647556 https://bugzilla.gnome.org/show_bug.cgi?id=691076
2013-02-12core: use g_unix_signal_add() for more reliable Unix signal handlingDan Williams
There were a few problems with MM's existing signal handling, first of which was that calling g_main_loop_quit() from a signal handler only works 50% of the time due to severe restrictions on what you can do from the handler. This caused INT or TERM to sometimes be ignored by MM. Instead, use the glib signal functions which ensure that the handler is run in the right context, where we can do anything we want.
2012-10-09core: second request to terminate does a hard exit()Aleksander Morgado
2012-10-08core: log successful shutdownAleksander Morgado
2012-10-08core: don't wait forever to get all modems disabled and removedAleksander Morgado
Just in case, put a maximum time to wait for all modems to get disabled and removed, as we don't want to wait forever.
2012-09-28core: acquire DBus name only after having created the `MMManager'Aleksander Morgado
The `MMManager' is itself also a `GDBusObjectManagerServer'. If we create this object after having fully acquired the bus name, the client application in the other side of the bus could be trying to use the ObjectManager interface before we actually exported it, which is wrong. Therefore, we need to make sure that the Manager interfaces are all exported before the name is acquired.
2012-03-16log: only include LOC and method name in debug logs if running with --debugAleksander Morgado
If the modem is started with --log-level=DEBUG, they will not be shown.
2012-03-16context: new source files to keep the daemon contextAleksander Morgado
2012-03-15core: implement the Manager1 DBus interface, based on GDBusAleksander Morgado
The MMManager object now derives from the gdbus-codegen-generated MmGdbusOrgFreedesktopModemManager1Skeleton object, and implements the handlers for the SetLogging() and ScanDevices() DBus methods. The main program is also modified to be based on GDBus.
2011-01-23core: enable timestamps with legacy --debug optionDan Williams
2011-01-23core: rework loggingDan Williams
Make it more flexible, add logging to a file, and absolute and relative timestamps.
2010-08-11core: work around dbus-glib property access bug (CVE-2010-1172) (rh #585394)Dan Williams
More info: https://bugzilla.redhat.com/show_bug.cgi?id=585394 http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-1172 dbus-glib was not properly enforcing the 'access' permissions on object properties exported using its API. There were 2 specific bugs: 1) dbus-glib did not enforce the introspection read/write property permissions, so if the GObject property definition allowed write access (which is sometimes desirable), D-Bus clients could modify that value even if the introspection said it was read-only 2) dbus-glib was not filtering out GObject properties that were not listed in the introspection XML. Thus, if the GObject defined more properties than were listed in the introspection XML (which is also often useful, and MM uses this quite a bit) those properties would also be exposed to D-Bus clients. To fix this completely, you need to: 1) get dbus-glib master when the patch is commited, OR grab the patch from https://bugzilla.redhat.com/show_bug.cgi?id=585394 and build a new dbus-glib 2) rebuild ModemManager against the new dbus-glib
2010-05-21build: print version on startup and add dist-versionDan Williams
Distributions should set dist-version at build time with the package version and revision, so for RPM-based distros you'd --with-dist-version=%{version}-%{release} which will be printed out on MM startup to help debugging.
2010-03-22core: cleanly disable modems on shutdownDan Williams
2010-03-09core: fix SIGTERM before mainloop has startedDan Williams
2009-06-18core: gracefully handle SIGTERM and SIGINT by shutting down cleanlyDan Williams
2009-06-18udev: move device probing and detection to udevDan Williams
Get rid of dependency on HAL, using libgudev instead. Fix up the plugin API to no longer use either HAL or udev defines, but let plugins use whatever mechanism they want for getting more information out of the device given the subsystem and device node name. Modems are now defined as "master" devices which "own" a one or more ports. A port could be a serial tty device or a network device or whatever. The plugin figures out whether it supports a given port or not and then assigns it to a new or existing modem. Modems now have a 'valid' property that should be set to TRUE when the modem has enough ports to operate correctly. For devices (ex. 'hso') that use a network device for data transfer, the modem would need to grab at least one TTY and the network device associated with that physical device to be 'valid'. Also move the generic modem support code to a plugin like other modem plugins, and change the I-support-this-device mechanism to return a number indicating the level of support. For example, the generic plugin would return a quite low number if the device indicates via probing that it can do GSM or CDMA, but a more specific plugin can indicate better support for the device, and thus the more specific plugin would win control.
2009-04-14Handle cases where HAL is not running/disappears/reappears.Tambet Ingo