Commit Graph

28 Commits

Author SHA1 Message Date
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
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
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
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
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
f1d4e0fb63 mmcli: prefix all NMEA traces in order to get a pretty print 2012-03-29 09:18:04 +02:00
Aleksander Morgado
2021ba80fd cli: setup to work with SMS objects 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
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
Aleksander Morgado
82693cf523 cli: enable printing modem info 2012-03-15 14:14:33 +01:00
Aleksander Morgado
6a3e91ee83 cli: use the new libmm-glib API fixes 2012-03-15 14:14:33 +01:00
Aleksander Morgado
1257ecd136 cli: start to port Modem actions to use the new libmm-glib 2012-03-15 14:14:26 +01:00