diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2016-03-27 14:41:35 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2016-09-29 15:41:21 +0200 |
commit | 1f813c4e9691f22017802278ab6f5b1475185113 (patch) | |
tree | 8c354cd3053d7837bc575e6f1c793fda0c2ba3e1 /cli/mmcli-common.h | |
parent | e5fa0233bb73a8374cf35e9170c66c580255815a (diff) |
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
...
Diffstat (limited to 'cli/mmcli-common.h')
-rw-r--r-- | cli/mmcli-common.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cli/mmcli-common.h b/cli/mmcli-common.h index fec19203..f38429b7 100644 --- a/cli/mmcli-common.h +++ b/cli/mmcli-common.h @@ -35,14 +35,14 @@ MMManager *mmcli_get_manager_sync (GDBusConnection *connection); void mmcli_get_modem (GDBusConnection *connection, - const gchar *path_or_index, + const gchar *modem_str, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); MMObject *mmcli_get_modem_finish (GAsyncResult *res, MMManager **o_manager); MMObject *mmcli_get_modem_sync (GDBusConnection *connection, - const gchar *path_or_index, + const gchar *modem_str, MMManager **o_manager); void mmcli_get_bearer (GDBusConnection *connection, |