[RFC PATCH] cli: avoid requiring specific modem if only a single modem is found in the system

Florian Klink flokli at flokli.de
Thu Apr 30 08:53:33 PDT 2015


Am 30.04.2015 um 17:36 schrieb Aleksander Morgado:
> This change will allow running mmcli operations without needing to specify
> neither the index nor the path of the modem object, but only if a single modem
> is found in the system. E.g.:
> 
> Enabling the modem, when it is the only one in the system, would just be:
>    $ sudo mmcli --enable
>    successfully enabled the modem
> 
> But if multiple modems are found in the system:
>    $ sudo mmcli --enable
>    error: multiple modems found: need specific modem to run the operation
> 
> In particular, the special operation without actions that we had before to print
> the info of a given modem will now also be implicit even if no index or path is
> given:
> 
> So, when a single modem is found in the system:
>    $ sudo mmcli
>    /org/freedesktop/ModemManager1/Modem/1 (device id '51e23d10a4180fcf08a1a55e4c01dce693b17e66')
>      -------------------------
>      Hardware |   manufacturer: 'Sierra Wireless, Incorporated'
>               |          model: 'MC7304'
>               |       revision: 'SWI9X15C_05.05.16.02 r21040 carmd-fwbuild1 2014/03/17 23:49:48'
>               |      supported: 'gsm-umts
>    ...
> 
> But if multiple modems are found:
>    $ sudo mmcli
>    error: multiple modems found: need specific modem to run the operation
> ---
> 
> What does this look like?

Didn't try the patch, but I like the described behaviour.

> 
> I'm not totally sure about the special operation without explicit action requested, where we
> just showed the modem info. Should we still do that even if no modem index or path is given?

I'd be fine with that, it doesn't break anything when executed and gives
kind of a small overview about modemmanagers world.

If we really want to make the usage more consistent with nmcli, ip,
brctl etc, restructuring mmcli to use subcommands would make more sense.
But that wouldn't be something for a minor release...

--
Florian



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/modemmanager-devel/attachments/20150430/2f8d27fc/attachment.sig>


More information about the ModemManager-devel mailing list