[PATCH] uim: add --uim-get-sim-state
Arjun AK
arjunak234 at gmail.com
Tue Jun 1 07:41:11 PDT 2021
On 24/05/21 11:21 am, Arjun wrote:
> Hi,
> I believe I've made the required changes. Can this be merged in now?
>
> -
> Arjun
>
> On May 8, 2021 12:02:57 AM UTC, Arjun AK <arjunak234 at gmail.com> wrote:
>> From: Arjun <arjunak234 at gmail.com>
>>
>> This command will show whether a SIM card has been inserted and whether
>> a pin is required.
>>
>> Signed-off-by: Arjun <arjunak234 at gmail.com>
>> ---
>> commands-uim.c | 26 ++++++++++++++++++++++++++
>> commands-uim.h | 4 +++-
>> 2 files changed, 29 insertions(+), 1 deletion(-)
>>
>> diff --git a/commands-uim.c b/commands-uim.c
>> index 859da68..03166a2 100644
>> --- a/commands-uim.c
>> +++ b/commands-uim.c
>> @@ -54,3 +54,29 @@ cmd_uim_verify_pin2_prepare(struct qmi_dev *qmi,
>> struct qmi_request *req, struct
>> qmi_set_uim_verify_pin_request(msg, &data);
>> return QMI_CMD_REQUEST;
>> }
>> +
>> +
>> +static void cmd_uim_get_sim_state_cb(struct qmi_dev *qmi, struct
>> qmi_request *req, struct qmi_msg *msg)
>> +{
>> + struct qmi_uim_get_card_status_response res;
>> + qmi_parse_uim_get_card_status_response(msg, &res);
>> +
>> + void * const array = blobmsg_open_array(&status, "sim_cards");
>> + if (res.data.card_status.cards_n > 0){
>> + void * const table = blobmsg_open_table(&status, NULL);
>> +
>> + for (int i = 0; i < res.data.card_status.cards_n;i++){
>> + blobmsg_add_u32(&status, "state",
>> res.data.card_status.cards[i].card_state);
>> + blobmsg_add_u32(&status, "upin_state",
>> res.data.card_status.cards[i].upin_state);
>> + }
>> + blobmsg_close_table(&status, table);
>> + }
>> + blobmsg_close_array(&status, array);
>> +}
>> +
>> +static enum qmi_cmd_result
>> +cmd_uim_get_sim_state_prepare(struct qmi_dev *qmi, struct qmi_request
>> *req, struct qmi_msg *msg, char *arg)
>> +{
>> + qmi_set_uim_get_card_status_request(msg);
>> + return QMI_CMD_REQUEST;
>> +}
>> diff --git a/commands-uim.h b/commands-uim.h
>> index 86ebae4..02a49b1 100644
>> --- a/commands-uim.h
>> +++ b/commands-uim.h
>> @@ -21,10 +21,12 @@
>>
>> #define __uqmi_uim_commands \
>> __uqmi_command(uim_verify_pin1, uim-verify-pin1, required,
>> QMI_SERVICE_UIM), \
>> - __uqmi_command(uim_verify_pin2, uim-verify-pin2, required,
>> QMI_SERVICE_UIM) \
>> + __uqmi_command(uim_verify_pin2, uim-verify-pin2, required,
>> QMI_SERVICE_UIM), \
>> + __uqmi_command(uim_get_sim_state, uim-get-sim-state, no,
>> QMI_SERVICE_UIM) \
>>
>>
>> #define uim_helptext \
>> " --uim-verify-pin1 <pin>: Verify PIN1 (new devices)\n" \
>> " --uim-verify-pin2 <pin>: Verify PIN2 (new devices)\n" \
>> + " --uim-get-sim-state: Get current SIM state\n" \
>>
Can someone merge this in ?
-
Arjun
More information about the openwrt-devel
mailing list