Hi Arjun, On Sat, May 08, 2021 at 05:32:57AM +0530, Arjun AK wrote: > From: Arjun <[email protected]> > > This command will show whether a SIM card has been inserted and whether > a pin is required. > > Signed-off-by: Arjun <[email protected]>
Please follow our contribution guideline and use a full real name to sign off your patch. https://openwrt.org/submitting-patches#submission_guidelines Apart from that and two very minor style/white-space issues the patch looks good. > --- > 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){ Please use tabs for intentation and add a space before the curly bracket. > + void * const table = blobmsg_open_table(&status, NULL); > + > + for (int i = 0; i < res.data.card_status.cards_n;i++){ Should be: 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" \ > > -- > 2.20.1 > > > _______________________________________________ > openwrt-devel mailing list > [email protected] > https://lists.openwrt.org/mailman/listinfo/openwrt-devel _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
