From patchwork Wed Dec 17 12:35:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?S=C5=82awomir_Demeszko?= X-Patchwork-Id: 422249 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 743111401DC for ; Wed, 17 Dec 2014 23:36:28 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 9EF5928A62A; Wed, 17 Dec 2014 13:34:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 061122890DA for ; Wed, 17 Dec 2014 13:33:54 +0100 (CET) X-policyd-weight: using cached result; rate:hard: -7.6 Received: from hosting.nazwa24.pl (ns1.hosting.nazwa24.pl [46.242.129.143]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Wed, 17 Dec 2014 13:33:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=wireless-instruments.com; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=5NpLeg8y692M6EENRFMlPFkNhBy+BGGUt2voMgmneGk=; b=yyu0y0SAZ8rEFArdV3/Wh8UjPoj5DNLjvK05CuEDBk8RJvT66WHo4YE1MK65lAABNqFeXlLD1QHOjSgEc46yiRDzSllKOs+2ZjA+cP7cDjEdxeA95phqTS46atqWGNv2Q/eir3lZVdT77dNTY7SYzPGoKvmeWj2tDEalB6KFREA=; Received: from afo149.internetdsl.tpnet.pl ([83.16.144.149]:58090 helo=localhost.localdomain) by hosting.nazwa24.pl with esmtpsa (UNKNOWN:AES128-SHA256:128) (Exim 4.82) (envelope-from ) id 1Y1DpO-0004M3-Eo; Wed, 17 Dec 2014 13:35:42 +0100 From: =?UTF-8?q?S=C5=82awomir=20Demeszko?= To: openwrt-devel@lists.openwrt.org Date: Wed, 17 Dec 2014 13:35:34 +0100 Message-Id: <1418819734-17352-3-git-send-email-s.demeszko@wireless-instruments.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1418819734-17352-1-git-send-email-s.demeszko@wireless-instruments.com> References: <1418819734-17352-1-git-send-email-s.demeszko@wireless-instruments.com> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hosting.nazwa24.pl X-AntiAbuse: Original Domain - lists.openwrt.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - wireless-instruments.com X-Get-Message-Sender-Via: hosting.nazwa24.pl: authenticated_id: s.demeszko@wireless-instruments.com Cc: =?UTF-8?q?S=C5=82awomir=20Demeszko?= Subject: [OpenWrt-Devel] [PATCH uqmi 3/3] Added commands to change PIN code X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Signed-off-by: SÅ‚awomir Demeszko --- commands-dms.c | 36 ++++++++++++++++++++++++++++++++++++ commands-dms.h | 8 ++++++++ 2 files changed, 44 insertions(+) diff --git a/commands-dms.c b/commands-dms.c index 76144cf..277223d 100644 --- a/commands-dms.c +++ b/commands-dms.c @@ -136,6 +136,42 @@ cmd_dms_set_pin2_protection_prepare(struct qmi_dev *qmi, struct qmi_request *req return cmd_dms_set_pin_protection_prepare(msg, arg); } +static enum qmi_cmd_result +cmd_dms_change_pin_prepare(struct qmi_msg *msg, char *arg) +{ + if (!dms_req_data.pin || !dms_req_data.new_pin) { + uqmi_add_error("Missing argument"); + return QMI_CMD_EXIT; + } + + static struct qmi_dms_uim_change_pin_request dms_change_pin_req = { + QMI_INIT_SEQUENCE(info, + .pin_id = dms_req_data.pin_id + ), + QMI_INIT_PTR(info.old_pin, dms_req_data.pin), + QMI_INIT_PTR(info.new_pin, dms_req_data.new_pin) + }; + + qmi_set_dms_uim_change_pin_request(msg, &dms_change_pin_req); + return QMI_CMD_REQUEST; +} + +#define cmd_dms_change_pin1_cb no_cb +static enum qmi_cmd_result +cmd_dms_change_pin1_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) +{ + dms_req_data.pin_id = QMI_DMS_UIM_PIN_ID_PIN; + return cmd_dms_change_pin_prepare(msg, arg); +} + +#define cmd_dms_change_pin2_cb no_cb +static enum qmi_cmd_result +cmd_dms_change_pin2_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) +{ + dms_req_data.pin_id = QMI_DMS_UIM_PIN_ID_PIN2; + return cmd_dms_change_pin_prepare(msg, arg); +} + #define cmd_dms_set_new_pin_cb no_cb static enum qmi_cmd_result cmd_dms_set_new_pin_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) diff --git a/commands-dms.h b/commands-dms.h index e214975..925aea3 100644 --- a/commands-dms.h +++ b/commands-dms.h @@ -5,6 +5,8 @@ __uqmi_command(dms_set_pin1_protection, set-pin1-protection, required, QMI_SERVICE_DMS), \ __uqmi_command(dms_set_pin2_protection, set-pin2-protection, required, QMI_SERVICE_DMS), \ __uqmi_command(dms_set_pin, pin, required, CMD_TYPE_OPTION), \ + __uqmi_command(dms_change_pin1, change-pin1, no, QMI_SERVICE_DMS), \ + __uqmi_command(dms_change_pin2, change-pin2, no, QMI_SERVICE_DMS), \ __uqmi_command(dms_unblock_pin1, unblock-pin1, no, QMI_SERVICE_DMS), \ __uqmi_command(dms_unblock_pin2, unblock-pin2, no, QMI_SERVICE_DMS), \ __uqmi_command(dms_set_puk, puk, required, CMD_TYPE_OPTION), \ @@ -23,6 +25,12 @@ " --pin : PIN1 needed to change state\n" \ " --set-pin2-protection : Set PIN2 protection state (disabled, enabled)\n" \ " --pin : PIN2 needed to change state\n" \ + " --change-pin1: Change PIN1\n" \ + " --pin : Current PIN1\n" \ + " --new-pin : New pin\n" \ + " --change-pin2: Change PIN2\n" \ + " --pin : Current PIN2\n" \ + " --new-pin : New pin\n" \ " --unblock-pin1: Unblock PIN1\n" \ " --puk : PUK needed to unblock\n" \ " --new-pin : New pin\n" \