uqmi: add dms_get_operating_mode

Daniel Golle daniel at makrotopia.org
Tue Nov 30 16:57:19 PST 2021


Hi Henrik,

On Wed, Dec 01, 2021 at 01:46:01AM +0100, Henrik Ginstmark wrote:
> Hi
> 
> Is it possible to add dms_get_operating_mode command?

Doesn't seem much of a stretch, so why not ;)

> Then it would be possible to verify if the modem is in flight mode or not.
> 
> Or how can I contribute to uqmi?

Generally, follow this guideline
https://openwrt.org/submitting-patches

When sending a patch for a sub-project like uqmi, please make sure to
prefix the message subject to clearly indicate the patch has to be
applied on uqmi.git and not on openwrt.git (just like you did)

What is missing here is mostly a patch description, and your
Signed-off-by: ... 


Cheers


Daniel

> 
> 
> BR
> Henrik Ginstmark
> 
> ---
> commands-dms.c
> 
> @@ -375,6 +375,38 @@ qmi_set_dms_reset_request(msg);
> return QMI_CMD_REQUEST;
> }
> 
> +static void
> +cmd_dms_get_operating_mode_cb(struct qmi_dev *qmi, struct qmi_request
> *req, struct qmi_msg *msg)
> +{
> + struct qmi_dms_get_operating_mode_response res;
> +
> + const char *modes[] = {
> + [QMI_DMS_OPERATING_MODE_ONLINE] = "online",
> + [QMI_DMS_OPERATING_MODE_LOW_POWER] = "low_power",
> + [QMI_DMS_OPERATING_MODE_FACTORY_TEST] = "factory_test",
> + [QMI_DMS_OPERATING_MODE_OFFLINE] = "offline",
> + [QMI_DMS_OPERATING_MODE_RESET] = "reset",
> + [QMI_DMS_OPERATING_MODE_SHUTTING_DOWN] = "shutting_down",
> + [QMI_DMS_OPERATING_MODE_PERSISTENT_LOW_POWER] = "persistent_low_power",
> + [QMI_DMS_OPERATING_MODE_MODE_ONLY_LOW_POWER] = "mode_only_low_power",
> + };
> + int s = 0;
> +
> + qmi_parse_dms_get_operating_mode_response(msg, &res);
> + if (res.set.mode &&
> +    res.data.mode < ARRAY_SIZE(modes))
> + s = res.data.mode;
> +
> + blobmsg_add_string(&status, NULL, modes[s]);
> +}
> +
> +static enum qmi_cmd_result
> +cmd_dms_get_operating_mode_prepare(struct qmi_dev *qmi, struct
> qmi_request *req, struct qmi_msg *msg, char *arg)
> +{
> + qmi_set_dms_get_operating_mode_request(msg);
> + return QMI_CMD_REQUEST;
> +}
> +
> #define cmd_dms_set_operating_mode_cb no_cb
> static enum qmi_cmd_result
> cmd_dms_set_operating_mode_prepare(struct qmi_dev *qmi, struct
> qmi_request *req, struct qmi_msg *msg, char *arg)
> 
> 
> ---
> commands-dms.h
> 
> @@ -37,6 +37,7 @@
>         __uqmi_command(dms_get_imsi, get-imsi, no, QMI_SERVICE_DMS), \
>         __uqmi_command(dms_get_imei, get-imei, no, QMI_SERVICE_DMS), \
>         __uqmi_command(dms_get_msisdn, get-msisdn, no, QMI_SERVICE_DMS), \
> +       __uqmi_command(dms_get_operating_mode,
> get-device-operating-mode, no, QMI_SERVICE_DMS), \
>         __uqmi_command(dms_set_operating_mode,
> set-device-operating-mode, required, QMI_SERVICE_DMS), \
>         __uqmi_command(dms_reset, reset-dms, no, QMI_SERVICE_DMS), \
>         __uqmi_command(dms_set_fcc_authentication, fcc-auth, no,
> QMI_SERVICE_DMS) \
> @@ -67,6 +58,7 @@
>                 "  --get-imei:                       Get International
> Mobile Equipment ID\n" \
>                 "  --get-msisdn:                     Get the MSISDN
> (telephone number)\n" \
>                 "  --reset-dms:                      Reset the DMS service\n" \
> +               "  --get-device-operating-mode       Get the device
> operating mode\n" \
>                 "  --set-device-operating-mode <m>   Set the device
> operating mode\n" \
>                 "                                    (modes: online,
> low_power, factory_test, offline\n" \
>                 "
> reset,shutting_down, persistent_low_power,\n" \



More information about the openwrt-devel mailing list