Commit Graph

249 Commits

Author SHA1 Message Date
Aleksander Morgado
09c5ac061b mmcli,modem: new --inhibit action on the modem object
Modem device inhibition is really a manager action for which we
provide the full modem device 'uid'.

This new operation allows to perform device inhibition using the modem
object as reference, which is more handy than first looking at the
device 'uid' and then running the manager action.

    $ sudo mmcli -m 0 --inhibit
    successfully inhibited device with uid '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-12/1-12.2'
    type Ctrl+C to abort this program and remove the inhibition
    ^C cancelling the operation...
    successfully uninhibited device with uid '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-12/1-12.2'
2019-01-03 21:05:58 +01:00
Aleksander Morgado
2212d3e054 api,manager: new InhibitDevice() method
This new method allows users of the ModemManager API to take full
control of a given device.

Unlike other operations in the API, the inhibition is maintained as
long as the caller exists in the bus, or until the same caller
uninhibits the device.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/98
2019-01-03 21:05:58 +01:00
Aleksander Morgado
87712c27f5 api,firmware: MMModemFirmwareUpdateMethod as flags, not enum
Devices may require/support more than one update method, so instead of
reporting the method as a single enum value, use a set of flags
instead.
2019-01-03 18:53:52 +00:00
Aleksander Morgado
f35d64a899 api,firmware: expose firmware version 2019-01-03 18:53:52 +00:00
Aleksander Morgado
67b3b830c8 api,firmware: expose device ids 2019-01-03 18:53:52 +00:00
Aleksander Morgado
dcd49dee88 mmcli,firmware: avoid empty output if firmware status unsupported 2019-01-03 18:53:52 +00:00
Aleksander Morgado
8e342cf120 api,firmware: new UpdateSettings property 2019-01-03 18:53:52 +00:00
Aleksander Morgado
55c3026643 api: deprecate 'number' in bearer properties
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/99
2019-01-03 16:42:18 +00:00
Aleksander Morgado
88e4c0492d cli,modem: output should include all 3GPP EPS fields always
Even if some fields wouldn't apply to some modem, we're always
including all in the output so that clients can assume the fields are
always given.

Fix adding the 3GPP EPS related fields unconditionally.
2018-12-07 16:20:53 +00:00
Aleksander Morgado
4cb6751daf api,modem-3gpp: new 'SetInitialEpsBearerSettings' method
This method allows users to modify the settings used during the
initial LTE attach procedure.
2018-12-07 16:20:53 +00:00
Aleksander Morgado
8281b5048b api,modem-3gpp: new 'InitialEpsBearerSettings' property
This property shows the settings stored in the device to be used
during the initial LTE attach procedure.
2018-12-07 16:20:53 +00:00
Aleksander Morgado
9c3ac2fb60 api,modem-3gpp: new 'InitialEpsBearer' property
This property contains the DBus path of a Bearer object of type
MM_BEARER_TYPE_DEFAULT_ATTACH, which is automatically exposed by the
modem when registered in the LTE network.

Unlike standard bearer objects created by the user, this bearer won't
allow any connection/disconnection request, as its status is bound to
the LTE registration exclusively.

The bearer settings exposed by the object include the APN details that
have been used during the initial packet network attach, which may be
defined by modem settings (e.g. if previously configured in the
firmware which APN to use for the given SIM card operator) or by the
network itself (e.g. if none configured, or if a network override is
required as when roaming).

The bearer object will be created as soon as the LTE attach status
details are known, and only while the modem is enabled. The
implementation allows modems to update the LTE attach status details
during runtime, so the bearer object with the settings may be
recreated during runtime as well.
2018-12-07 16:20:53 +00:00
Aleksander Morgado
dc154cf005 api,bearer: new 'BearerType' property
Until now we have only allowed to use and setup 'default bearers' (in
4G) or 'primary contexts' (in 2G/3G).

We can define a couple of additional bearer types, though:

* The 'dedicated bearers' (in 4G) or 'secondary contexts' (in 2G/3G),
  which are associated to a specific default/primary one, but which
  provide specific QoS settings configured via traffic flow templates.

* The 'initial default EPS bearer', which is a special case of default
  bearer in LTE, which is automatically created and connected when the
  modem is registered in the LTE network.

This commit introduces a new 'MMBearerType' enumeration that will be
associated to each bearer through a 'BearerType' property in the
org.freedesktop.ModemManager1.Bearer interface, showing what kind of
bearer/context this is.

By default, right now, all bearer objects created are 'default'
bearers.
2018-12-07 16:20:53 +00:00
Aleksander Morgado
c7af14cc80 api,manager: new 'Version' property
This string shows the runtime version of the ModemManager daemon.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/94
2018-12-04 17:26:59 +00:00
Ben Chan
03fdb33e1c cli,output: include string.h for strlen()
This patch fixes the following compiler warning:

mmcli-output.c:783:19: error: implicitly declaring library function 'strlen' with type 'unsigned long (const char *)' [-Werror,-Wimplicit-function-declaration]
            aux = strlen (section_infos[field_infos[item_l->field].section].name);
                  ^
2018-11-30 11:36:07 +01:00
Ben Chan
9389265bab cli,call: fix incorrect string conversion of MMCallStateReason enum
This patch fixes the following issue with string conversion of a MMCallStateReason enum:

mmcli-call.c:160:88: error: implicit conversion from enumeration type 'MMCallStateReason' to different enumeration type 'MMCallState' [-Werror,-Wenum-conversion]
    mmcli_output_string (MMC_F_CALL_PROPERTIES_STATE_REASON, mm_call_state_get_string (mm_call_get_state_reason (call)));
                                                             ~~~~~~~~~~~~~~~~~~~~~~~~  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-11-30 11:35:10 +01:00
Aleksander Morgado
b0fba14b1e cli: allow multiple output format types
In addition to the standard human-friendly output, we now allow a
machine-friendly key-value pair output, much easier to parse and use
by programs that look at the mmcli output.

This new key-value pair output should be treated as API from now on, so
third-party programs can assume the output is compatible from one
release to another.
2018-11-26 16:51:35 +00:00
Aleksander Morgado
cafc40245d cli,location: remove redundant --location-get-XXX actions
The --location-get action provides full location information from all
sources, which is better than per-source actions, as those were anyway
using the same API method to load location information as the global
one.
2018-11-26 16:51:35 +00:00
Aleksander Morgado
613aceabda cli,simple: remove redundant --simple-status action
The Simple.GetStatus() method is useful for simple DBus clients that
don't need all the information associated to the modem, just the most
important bits. But, in our case, the information provided by this
method is already given by the standard modem info output, so it is
totally redundant.
2018-11-26 16:51:35 +00:00
Aleksander Morgado
72674225ca api,modem: deprecate ListBearers() method
This method is completely unnecessary as we have the readable Bearers
property already in place, so let's deprecate it.

Worth noting that the mm_modem_list_bearers() async/sync methods in
libmm-glib were not really using the ListBearers() method anyway, they
are using the property directly. These methods are NOT deprecated,
because they allow us to get a list of MMBearer objects, instead of
just the list of DBus paths that we get when reading the Bearers
property directly.

We also remove --list-bearers from the mmcli operation list as we have
already the same information in the standard modem output.
2018-11-26 16:51:35 +00:00
Aleksander Morgado
73df7087fd cli,signal: fix missing separator in GSM block
Each group of items should have a separator.
2018-11-20 09:17:32 +01:00
Aleksander Morgado
b98accf660 cli,signal: fix unknown value reporting
At this point we want the values enclosed between single quotes,
e.g. so that the fields are parsed easier by scripts.

This issue will not have any practical relevance as soon as the
key-value pair output support is merged.
2018-11-20 09:15:41 +01:00
Dan Williams
627303a748 api/libmm-glib/cli: add AudioPort and AudioFormat properties to the Call object 2018-10-16 17:09:21 +00:00
Aleksander Morgado
1ac79ccdfd cli,modem: print PCO as 'n/a' if not available 2018-10-06 14:57:58 +02:00
Aleksander Morgado
24454b2775 cli,bearer: normalize n/a reporting
Use always small letters.
2018-10-06 14:52:18 +02:00
Ulrich Ölmann
4d16eec5fb mmcli,location: fix doubled variable declaration
Remove the redundant declaration of which slipped into the code in commit
091bf4dbd8 ("api: support location assistance data").

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
2018-09-21 15:15:54 +02:00
Aleksander Morgado
8ef6d397c7 cli,signal: add generic fields in its own group
This is just to consolidate the output w.r.t. similar fields in
e.g. the Messaging or Location interfaces.
2018-09-21 15:02:07 +02:00
Aleksander Morgado
bc407a38d6 mmcli,location: print LAC/TAC/CID in hex
All these values are usually specified in hex, not in dec.
2018-09-12 17:15:13 +00:00
Aleksander Morgado
6e84f3d459 iface-modem-location: validate SUPL server address
Devices will expect SUPL server given as either IP:PORT or FQDN:PORT,
so just avoid saying we require a 'URL' because it's not true.

We will use a new helper method to parse and validate user-provided
SUPL server address.
2018-09-12 17:14:36 +00:00
Aleksander Morgado
091bf4dbd8 api: support location assistance data
Sometimes SUPL-server based A-GPS is not possible, e.g. if the module
doesn't have Internet connectivity. In such cases, the modem may
support injecting additional "assistance data" that may be downloaded
from the Internet using external means (e.g. WiFi), in order to keep
having a quick time to first fix.

We now support using this location assistance data, with the following
new API elements:

 * A new mask of supported assistance data types is provided in the
   SupportedAssistanceData property.

 * A new list of URLs from where the aassistance data may be
   downloaded is also provided in a new AssistanceDataServers
   property.

 * A new InjectAssistanceData() method is provided, to perform the
   data injection in the module once it's been downloaded to the host
   system.
2018-08-21 13:26:08 +00:00
Ben Chan
b8ab473662 cli: print 'Pco' property in Modem3gpp interface 2018-08-18 13:34:06 -07:00
Aleksander Morgado
342abd7f63 cli,signal: print unset signal values as n/a 2018-08-09 13:52:53 +00:00
Aleksander Morgado
7e6b4d7aa9 api,location: give Tracking Area Code field in 3GPP location info
The "location area code" field is given in GSM/UMTS networks
exclusively. LTE networks use the concept of "tracking area code"
instead.

This patch updates the Location interface to Provide separate fields
for LAC and TAC, instead of giving TAC values in the LAC field.
2018-08-08 21:46:28 +02:00
Aleksander Morgado
d4aaa436d9 modem-3gpp: allow loading and changing EPS UE mode of operation
The UE modes of operation for LTE are defined in 3GPP TS 24.301 (e.g.
section 4.3 in v10.3.0):
  * PS mode 1: EPS only, 'voice centric'
  * PS mode 2: EPS only, 'data centric'
  * CS/PS mode 1: EPS and non-EPS, 'voice centric'
  * CS/PS mode 2: EPS and non-EPS, 'data centric'

The mode specifies, among other things, how the UE should behave w.r.t
CS fallback depending on the capabilities reported by the network.
2018-01-20 15:41:07 +01:00
Aleksander Morgado
4f0a796ece cli: port mmcli_get_call to GTask 2017-11-03 11:55:04 +01:00
Aleksander Morgado
6f9e2003e0 cli: port mmcli_get_sim to GTask 2017-11-03 11:55:04 +01:00
Aleksander Morgado
050eb46f51 cli: port mmcli_get_sms to GTask 2017-11-03 11:55:03 +01:00
Aleksander Morgado
f94a93d66a cli: port mmcli_get_bearer to GTask 2017-11-03 11:55:03 +01:00
Aleksander Morgado
11e9b727b4 cli: port mmcli_get_modem to GTask 2017-11-03 11:55:03 +01:00
Aleksander Morgado
6bf046b6fc cli: port mmcli_get_manager to GTask 2017-11-03 11:55:03 +01:00
Aleksander Morgado
25007741c8 mmcli,sim: force sync operation for the info action 2017-10-18 23:05:18 +02:00
Ben Chan
4a5a73eb1e cli: show hardware revision property of Modem interface 2017-09-20 09:56:23 -07:00
Aleksander Morgado
b2a859a782 build: WITH_UDEV is only defined when enabled
Looks like the preprocessor doesn't choke when using #if WITH_UDEV and
it isn't defined to any value, but anyway, better explicitly say that
we're checking if it's defined or not.
2017-06-22 10:43:45 +02:00
Ben Chan
b225b7a267 cli: remove explicit GDestroyNotify cast on g_object_unref
g_object_unref is in form of  `void (*)(gpointer)`, which matches the
GDestroyNotify signature. An explicit GDestroyNotify cast on
g_object_unref is thus not needed.
2017-03-29 10:22:28 +02:00
Aleksander Morgado
5a8620d984 cli: minor indentation fix 2017-02-08 18:38:03 +01:00
Ben Chan
31655bb5a5 glib: remove invocations of g_type_init()
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.
2017-02-03 10:05:14 +01:00
Aleksander Morgado
9b3549e375 api,signal: new RSCP item 2016-10-12 13:24:08 +02:00
Aleksander Morgado
fe460b2f54 3gpp: update registration state enumeration with CSFB related states
Introduce "sms only" and "CSFB not preferred" home/roaming states to be reported
for the CS context, while already registered on LTE.

Based on 3GPP TS 27.007 v13.5.0.
2016-10-12 13:24:08 +02:00
Aleksander Morgado
58c955f5f2 core: allow building and running without udev
Instead of relying on the udev daemon and GUDev to manage the devices reported
by the kernel, we can now run ModemManager relying solely on the kernel events
reported via the new ReportKernelEvent() API. Therefore, the '--no-auto-scan'
option is implicit for the ModemManager daemon when udev is disabled in the
build.

Additionally, a new custom implementation of the kernel device object is
provided, which uses sysfs to load the properties and attributes required in
each kernel device, instead of using a GUdevDevice.

The udev rule files are kept in place, and a simple custom parser is provided
which preloads all rules in memory once and then applies them to the different
kernel objects reported via ReportKernelEvent(), e.g. to set port type hints.
A simple unit test setup is prepared to validate the udev rules during the
`check' Makefile target.
2016-09-29 15:43:05 +02:00
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