Commit Graph

54 Commits

Author SHA1 Message Date
Lukas Voegl
8cd1c1bdb9 api,modem: new 'Physdev' property
Signed-off-by: Lukas Voegl <lvoegl@tdt.de>
2023-09-18 10:53:12 +02:00
Frederic Martinsons
18b72a046e mmcli: don't assume that mm_object_peek_modem or mm_object_get_modem return non null
This very peculiar case can happen when an intermediate initiliazition step
of a modem fails.

The ModemManager daemon should always expose the modem interface but let not
assume that in mmcli and protect these calls.

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2020-12-21 13:00:40 +00:00
Aleksander Morgado
5041b9c99b mmcli: also lookup SIM objects in the 'SimSlots' property
If the device supports multiple SIM slots, when the user provides a
PATH or INDEX of a SIM card to use, don't look for the SIM object only
in the 'Sim' property, also look for it in the 'SimSlots' property.
2020-08-28 14:59:06 +00:00
Aleksander Morgado
1a67db047e cli: improve --help output for --modem and --sim options
Specify the full list of supported object lookup methods.
2020-04-09 05:38:07 +00:00
Aleksander Morgado
d72a9df041 cli: allow looking up for first available modem or SIM
When a system only has one single modem, it's convenient to just look
for the first available modem or SIM object, instead of needing to
provide the full path or the exact index number.

This improvement allows users to use the "any" keyword, or any of its
substrings (e.g. "an" or even "a") to match the first available object
of the requested type.

E.g.:

  $ mmcli -m a
    --------------------------------
    General  |            dbus path: /org/freedesktop/ModemManager1/Modem/0
             |            device id: 1a48f1180f1fb0166d91f7b139d027136b59ba63
    --------------------------------
    Hardware |         manufacturer: Sierra Wireless Inc.
             |                model: Sierra Wireless EM7345 4G LTE
    ...

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/196
2020-04-09 05:38:07 +00:00
Aleksander Morgado
cc99ab562b cli: consolidate logic to process user provided object lookup info
The user may specify DBus objects in several ways, e.g. with full
object paths, just with the object numeric ids, or in some other cases
with the full device UID.

Setup one single method to process this info for all object types, so
that it's also easier to add new lookup methods for all at the same
time.
2020-04-09 05:38:07 +00:00
Aleksander Morgado
1216e88716 cli: fix warnings with -Wswitch-default
mmcli-output.c: In function ‘output_item_free’:
  mmcli-output.c:321:5: error: switch missing default case [-Werror=switch-default]
    321 |     switch (item->type) {
        |     ^~~~~~
  mmcli-output.c: In function ‘mmcli_output_dump’:
  mmcli-output.c:1208:5: error: switch missing default case [-Werror=switch-default]
   1208 |     switch (selected_type) {
        |     ^~~~~~
  mmcli-output.c: In function ‘mmcli_output_list_dump’:
  mmcli-output.c:1231:5: error: switch missing default case [-Werror=switch-default]
   1231 |     switch (selected_type) {
        |     ^~~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
0a85254d17 cli: fix typo when looking for a specific call fails
$ sudo mmcli --call 1 --hangup
error: couldn't find sms at '/org/freedesktop/ModemManager1/Call/1': 'no modems found'

(cherry picked from commit e71a4282db94f8f18b5884fe7966b95febc18a6d)
2019-09-25 14:42:31 +02:00
Johny Mattsson
8e364b72b9 mmcli: allow use of modem UID to specify SIM operation
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/107
2019-05-06 13:31:21 +02: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
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
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
1f813c4e96 core: allow identifying devices by a user-provided 'uid'
All ports of the same modem reported by the kernel will all be associated with
a common 'uid' (unique id), which uniquely identifies the physical device. This
logic was already in place, what we do now is avoid calling it  the 'sysfs
path' of the physical device, because we may not want to use that to identify
a device.

This logic now also enables the possibility of "naming" the modems in a unique
way by setting the "ID_MM_PHYSDEV_UID" property in the "usb_device" that owns
all the ports.

E.g. a custom device has 4 modems in 4 different USB ports. The device path of
each USB device will always be the same, so the naming rules could go like this:

    $ vim /usr/lib/udev/rules.d/78-mm-naming.rules

    ACTION!="add|change|move", GOTO="mm_naming_rules_end"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.1", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-1"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.2", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-2"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.3", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-3"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.4", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-4"
    LABEL="mm_naming_rules_end"

Each of the modems found will have a unique UID retrieved from the previous list
of rules. Then, "mmcli" has also been updated to allow using the UID instead of
the modem DBus path or index, e.g.:

    $ sudo mmcli -m USB-MODEM-1
    /org/freedesktop/ModemManager1/Modem/0 (device id '988d83252c0598f670c2d69d5f41e077204a92fd')
      -------------------------
      Hardware |   manufacturer: 'ZTE CORPORATION'
               |          model: 'MF637'
               |       revision: 'BD_W7P673A3F3V1.0.0B04'
               |      supported: 'gsm-umts'
               |        current: 'gsm-umts'
               |   equipment id: '356516027657837'
      -------------------------
      System   |         device: 'USB-MODEM-1'
               |        drivers: 'option'
               |         plugin: 'ZTE'
               |   primary port: 'ttyUSB5'
               |          ports: 'ttyUSB5 (at)'
    ...

    $ sudo mmcli -m USB-MODEM-1 --enable
    ...
2016-09-29 15:41:21 +02:00
Aleksander Morgado
ee85a463cf license: mmcli is GPLv2+, not GPLv3+
mmcli is GPLv2+; that's what --version has always said and that's what the
README in ModemManager sources specifies:
  License.
  The ModemManager and mmcli binaries are both GPLv2+.
  The libmm-glib library is LGPLv2+.
2015-12-07 13:16:24 +01:00
Marco Bascetta
2ac5d620c4 libmm-glib,cli: Replaced 'list call' with 'list calls' 2015-08-02 10:39:48 +02:00
Aleksander Morgado
c0e05dbd43 cli,voice: minor coding style fixes 2015-08-02 10:39:47 +02:00
Riccardo Vangelisti
c3bec1537b mmcli: added Modem.Voice and Call support 2015-08-02 10:39:12 +02:00
Ben Chan
d4177f554b cli: consistently use spaces for indentation 2014-05-20 09:32:15 +02:00
Ben Chan
9a72f90cf7 cli: fix source tag of GSimpleAsyncResult objects 2013-12-05 13:03:29 -06:00
Aleksander Morgado
5c8f1fe0f2 mmcli: fix newline prefixing
The last line in a multi-line string was getting lost if it wasn't '\n'
terminated.
2013-05-23 18:00:03 +02:00
Aleksander Morgado
75d20c15d4 api: notify in the interface about the reason why the modem is FAILED
We currently implement 'SIM missing' and 'SIM error', which are probably the
most common ones.
2013-02-22 16:35:56 +01:00
Aleksander Morgado
84adf4e4ef cli: don't autostart the ModemManager service 2013-02-06 19:59:16 +01:00
Aleksander Morgado
2559dc5baf cli: don't abort when looking for bearers in failed modems 2012-10-22 12:46:34 +02:00
Aleksander Morgado
c250fa3797 libmm-glib: remove the `libmm-common.h' header
Both the ModemManager daemon and the mmcli will now include `libmm-glib.h' only.

We also handle two new special `_LIBMM_INSIDE_MM' and `LIBMM_INSIDE_MMCLI'
symbols, which if included before the `libmm-glib.h' library allow us to:

 * Don't include the libmm-glib high level API in the ModemManager daemon, as
   the object names would clash with those in the core.

 * Define some of the methods of helper objects to be included only if compiling
   ModemManager daemon or the mmcli.
2012-10-04 10:17:12 +02:00
Aleksander Morgado
107c78306e cli: fix showing revision when not multiline 2012-06-29 13:29:13 +02:00
Aleksander Morgado
f1d4e0fb63 mmcli: prefix all NMEA traces in order to get a pretty print 2012-03-29 09:18:04 +02:00
Aleksander Morgado
7400b14ee6 mmcli: fix looking for unexisting SMS
We need to ensure we iterate over all modems available.
2012-03-16 14:53:25 +01:00
Aleksander Morgado
6dea9964be mmcli: fix looking for unexisting bearers
We need to ensure we iterate over all modems available.
2012-03-16 14:53:25 +01:00
Aleksander Morgado
979c520381 cli: don't assume every modem exposes the Messaging interface 2012-03-16 14:53:25 +01:00
Aleksander Morgado
e257c4ac49 cli: avoid unneeded refs when synchronously looking for bearer/sms/sim 2012-03-15 14:15:01 +01:00
Aleksander Morgado
2021ba80fd cli: setup to work with SMS objects 2012-03-15 14:15:01 +01:00
Aleksander Morgado
d80d06cd6e cli: fix help, bearers and SIMs can be specified also by index 2012-03-15 14:15:01 +01:00
Aleksander Morgado
cf46336494 cli: allow specifying bearers and SIMs by index
So, these two are equivalent:
   $> mmcli -b 0
   $> mmcli -b /org/freedesktop/ModemManager1/Bearer/0

and also this two:
   $> mmcli -s 0
   $> mmcli -s /org/freedesktop/ModemManager1/SIM/0
2012-03-15 14:14:55 +01:00
Aleksander Morgado
c753649361 cli: use new enums/flags string getters/builders 2012-03-15 14:14:53 +01:00
Aleksander Morgado
c5fdd83905 cli: new helper to get the CDMA registration state string 2012-03-15 14:14:49 +01:00
Aleksander Morgado
ad95567e88 cli: print Rm protocol in bearer info 2012-03-15 14:14:47 +01:00
Aleksander Morgado
4d19a66722 cli: fix invalid write when completing async operation
Don't use the same context to pass the results to finalize().
2012-03-15 14:14:46 +01:00
Aleksander Morgado
e8aeb59293 cli: use g_list_free_full() when possible 2012-03-15 14:14:46 +01:00
Aleksander Morgado
88e8c4835b cli: implement SIM related actions 2012-03-15 14:14:36 +01:00
Aleksander Morgado
241c294918 cli: include 3GPP related stuff when printing modem info 2012-03-15 14:14:36 +01:00
Aleksander Morgado
6583bd61e1 cli: implement 3GPP related actions 2012-03-15 14:14:36 +01:00
Aleksander Morgado
16f2b7bdb8 cli: specify common options in a new group
Actions on modems from specific interfaces, like 3GPP, will also need the modem
to be specified.

The new 'Common' option group will handle all options to specify objects.
2012-03-15 14:14:36 +01:00
Aleksander Morgado
534aeb0c8a cli: always keep a MMManager around
In order to receive signals in the GDBusObjects retrieved from the
GDBusObjectManagerClient, we need to keep a reference of the client around.
2012-03-15 14:14:35 +01:00
Aleksander Morgado
c2e4d9cea7 cli: new helper to look for specific MMBearer objects 2012-03-15 14:14:34 +01:00
Aleksander Morgado
55654d5b46 cli: new helper to get name of MMBearerIpMethod 2012-03-15 14:14:34 +01:00