[OpenWrt-Devel] Patch for uqmi command --adding unblock-pin

Uwe Wojak uwojak at eltec.de
Wed Oct 29 11:16:02 EDT 2014


Hallo Matti,

second try after subscribing the mailing list.

I added the commands "--unblock-pin1" and "--unblock-pin2" to uqmi.
Perhaps the patch is of common interest. The patch works with
PKG_VERSION:=2014-10-02.

Uwe Wojak

 From e797556e013f8742a82243a93dcf34dd355bd8e3 Mon Sep 17 00:00:00 2001
From: Uwe Wojak <uwojak at eltec.de>
Date: Mon, 7 Jul 2014 15:57:53 +0200
Subject: [PATCH] Added commands to unblock blocked PINs.

Added commands "--unblock-pin1" and "--unblock-pin2" and
parameters "--puk" and  "--new-pin".
---
  commands-dms.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
  commands-dms.h | 10 ++++++++++
  2 files changed, 62 insertions(+)

diff --git a/commands-dms.c b/commands-dms.c
index c40a38e..ee34fa6 100644
--- a/commands-dms.c
+++ b/commands-dms.c
@@ -75,6 +75,58 @@ cmd_dms_verify_pin2_prepare(struct qmi_dev *qmi,
struct qmi_request *req, struct
      return QMI_CMD_REQUEST;
  }

+static struct qmi_dms_uim_unblock_pin_request dms_unlock_pin_req = {
+    QMI_INIT_SEQUENCE(info,
+            .pin_id = QMI_DMS_UIM_PIN_ID_PIN
+        )
+    };
+
+#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)
+{
+    qmi_set_ptr(&dms_unlock_pin_req, info.new_pin, arg);
+    return QMI_CMD_DONE;
+}
+
+#define cmd_dms_set_puk_cb no_cb
+static enum qmi_cmd_result
+cmd_dms_set_puk_prepare(struct qmi_dev *qmi, struct qmi_request *req,
struct qmi_msg *msg, char *arg)
+{
+    qmi_set_ptr(&dms_unlock_pin_req, info.puk, arg);
+    return QMI_CMD_DONE;
+}
+
+#define cmd_dms_unblock_pin1_cb no_cb
+static enum qmi_cmd_result
+cmd_dms_unblock_pin1_prepare(struct qmi_dev *qmi, struct qmi_request
*req, struct qmi_msg *msg, char *arg)
+{
+    qmi_set_ptr(&dms_unlock_pin_req, info.pin_id, QMI_DMS_UIM_PIN_ID_PIN);
+
+    if (!dms_unlock_pin_req.data.info.puk ||
!dms_unlock_pin_req.data.info.new_pin) {
+        uqmi_add_error("Missing argument");
+        return QMI_CMD_EXIT;
+    }
+
+    qmi_set_dms_uim_unblock_pin_request(msg, &dms_unlock_pin_req);
+    return QMI_CMD_REQUEST;
+}
+
+#define cmd_dms_unblock_pin2_cb no_cb
+static enum qmi_cmd_result
+cmd_dms_unblock_pin2_prepare(struct qmi_dev *qmi, struct qmi_request
*req, struct qmi_msg *msg, char *arg)
+{
+    qmi_set_ptr(&dms_unlock_pin_req, info.pin_id, QMI_DMS_UIM_PIN_ID_PIN2);
+
+    if (!dms_unlock_pin_req.data.info.puk ||
!dms_unlock_pin_req.data.info.new_pin) {
+        uqmi_add_error("Missing argument");
+        return QMI_CMD_EXIT;
+    }
+
+    qmi_set_dms_uim_unblock_pin_request(msg, &dms_unlock_pin_req);
+    return QMI_CMD_REQUEST;
+}
+
  static void cmd_dms_get_imsi_cb(struct qmi_dev *qmi, struct
qmi_request *req, struct qmi_msg *msg)
  {
      struct qmi_dms_uim_get_imsi_response res;
diff --git a/commands-dms.h b/commands-dms.h
index 18643ca..2b9d83c 100644
--- a/commands-dms.h
+++ b/commands-dms.h
@@ -2,6 +2,10 @@
      __uqmi_command(dms_get_pin_status, get-pin-status, no,
QMI_SERVICE_DMS), \
      __uqmi_command(dms_verify_pin1, verify-pin1, required,
QMI_SERVICE_DMS), \
      __uqmi_command(dms_verify_pin2, verify-pin2, required,
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), \
+    __uqmi_command(dms_set_new_pin, new-pin, required, CMD_TYPE_OPTION), \
      __uqmi_command(dms_get_imsi, get-imsi, 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) \
@@ -10,6 +14,12 @@
          "  --get-pin-status:                 Get PIN verification
status\n" \
          "  --verify-pin1 <pin>:              Verify PIN1\n" \
          "  --verify-pin2 <pin>:              Verify PIN2\n" \
+        "  --unblock-pin1:                   Unblock PIN1\n" \
+        "    --puk <puk>:                    PUK needed to unblock\n" \
+        "    --new-pin <new pin>:            New pin\n" \
+        "  --unblock-pin2:                   Unblock PIN2\n" \
+        "    --puk <puk>:                    PUK needed to unblock\n" \
+        "    --new-pin <new pin>:            New pin\n" \
          "  --get-imsi:                       Get International Mobile
Subscriber ID\n" \
          "  --reset-dms:                      Reset the DMS service\n" \
          "  --set-device-operating-mode <m>   Set the device operating
mode\n" \
--
1.9.1


--

Uwe Wojak
Dipl.-Phys.
Senior Software Engineer

ELTEC Elektronik AG, Mainz
_________________________

Fon      +49 6131 918 310
Fax      +49 6131 918 195
Email   uwojak at eltec.de
Web     www.eltec.de



*********************************************************
ELTEC Elektronik AG
Galileo-Galilei-Straße 11
D-55129 Mainz

Vorstand: Peter Albert
Aufsichtsratsvorsitzender: Stephan Helmstädter

Registergericht: Amtsgericht Mainz
Registernummer: HRB 7038
Ust-ID: DE 149 049 790
*********************************************************
Wichtiger Hinweis:
Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt.
Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Evtl. Anhänge dieser Nachricht wurden auf Viren überprüft!
Jede Form von Vervielfältigung, Abänderung, Verbreitung oder Veröffentlichung dieser E-Mail Nachricht ist untersagt! Das Verwenden von Informationen aus dieser Nachricht für irgendwelche Zwecke ist strengstens untersagt.
Es gelten unsere Allgemeinen Geschäftsbedingungen, zu finden unter www.eltec.de.
_______________________________________________
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