[OpenWrt-Devel] [PATCH uqmi] Add command for listing device capabilities

Felix Fietkau nbd at openwrt.org
Thu Jan 8 09:38:05 EST 2015


On 2015-01-08 14:55, Sławomir Demeszko wrote:
> Signed-off-by: Sławomir Demeszko <s.demeszko at wireless-instruments.com>
> ---
>  commands-dms.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  commands-dms.h |  2 ++
>  2 files changed, 55 insertions(+)
> 
> diff --git a/commands-dms.c b/commands-dms.c
> index a677052..fcb4b93 100644
> --- a/commands-dms.c
> +++ b/commands-dms.c
> @@ -7,6 +7,59 @@ static struct {
>  	char* puk;
>  } dms_req_data;
>  
> +static void cmd_dms_get_capabilities_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
> +{
> +	void *t, *networks;
> +	int i;
> +	struct qmi_dms_get_capabilities_response res;
> +	const char *radio_cap[] = {
> +		[QMI_DMS_RADIO_INTERFACE_CDMA20001X] = "cdma1x",
> +		[QMI_DMS_RADIO_INTERFACE_EVDO] = "cdma1xevdo",
> +		[QMI_DMS_RADIO_INTERFACE_GSM] = "gsm",
> +		[QMI_DMS_RADIO_INTERFACE_UMTS] = "umts",
> +		[QMI_DMS_RADIO_INTERFACE_LTE] = "lte",
> +	};
> +	const char *service_cap[] = {
> +		[QMI_DMS_DATA_SERVICE_CAPABILITY_NONE] = "none",
> +		[QMI_DMS_DATA_SERVICE_CAPABILITY_CS] = "cs",
> +		[QMI_DMS_DATA_SERVICE_CAPABILITY_PS] = "ps",
> +		[QMI_DMS_DATA_SERVICE_CAPABILITY_SIMULTANEOUS_CS_PS] = "simultaneous_cs_ps",
> +		[QMI_DMS_DATA_SERVICE_CAPABILITY_NON_SIMULTANEOUS_CS_PS] = "non_simultaneous_cs_ps",
> +	};
> +
> +	qmi_parse_dms_get_capabilities_response(msg, &res);
> +
> +	t = blobmsg_open_table(&status, NULL);
> +
> +	blobmsg_add_u32(&status, "max_tx_channel_rate", (int32_t) res.data.info.max_tx_channel_rate);
> +	blobmsg_add_u32(&status, "max_rx_channel_rate", (int32_t) res.data.info.max_rx_channel_rate);
> +	if (res.data.info.data_service_capability >= 0 && res.data.info.data_service_capability < ARRAY_SIZE(service_cap))
> +		blobmsg_add_string(&status, "data_service", service_cap[res.data.info.data_service_capability]);
This causes the following warning on my system:

In file included from /Users/nbd/uqmi/commands.c:139:
/Users/nbd/uqmi/commands-dms.c:36:44: error: comparison of unsigned enum expression >= 0 is always true [-Werror,-Wtautological-compare]
        if (res.data.info.data_service_capability >= 0 && res.data.info.data_service_capability < ARRAY_SIZE(service_cap))
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
/Users/nbd/uqmi/commands-dms.c:46:45: error: comparison of unsigned enum expression >= 0 is always true [-Werror,-Wtautological-compare]
                if (res.data.info.radio_interface_list[i] >= 0 && res.data.info.radio_interface_list[i] < ARRAY_SIZE(radio_cap))
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~

- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list