All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] phonesim: Support for querying SIM unlock retry count.
@ 2014-04-22 12:47 jussi.pakkanen
  2014-04-22 18:14 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: jussi.pakkanen @ 2014-04-22 12:47 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3779 bytes --]

Hi

Here's a patch for ofono-phonesim. It adds the command AT+CPINR that returns
the amount of PIN unlock attempts remaining. It also tracks the value properly
according to state changes. The output format is (roughly) as specified in ETSI
TS 127 007 v11.8.0.

---
 src/default.xml | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/default.xml b/src/default.xml
index 2868587..e0cafbb 100644
--- a/src/default.xml
+++ b/src/default.xml
@@ -232,6 +232,9 @@
     <!-- Value of the PIN that is required -->
     <set name="PINVALUE" value="2468"/>
 
+    <!-- How many times can PIN unlocking be attempted -->
+    <set name="PINRETRYCOUNT" value="3"/>
+
     <!-- pin protection status -->
     <set name="SC" value="0"/>
 
@@ -2280,6 +2283,19 @@
 </chat>
 
 <chat>
+    <!-- Do we support CPINR? -->
+    <command>AT+CPINR=?</command>
+    <response>OK\n</response>
+</chat>
+
+<chat>
+    <!-- How many pin unlock attempts remain -->
+    <command>AT+CPINR</command>
+    <response>+CPINR: SIM PIN,${PINRETRYCOUNT},3\nOK\n</response>
+</chat>
+
+
+<chat>
     <!-- Check for which PIN is required -->
     <command>AT+CPIN?</command>
     <response delay="2000">+CPIN: ${PINNAME}\n\nOK</response>
@@ -2290,6 +2306,7 @@
     <command>AT+CPIN="${PINVALUE}"</command>
     <response>+CPIN: READY\n\nOK</response>
     <set name="PINNAME" value="READY"/>
+    <set name="PINRETRYCOUNT" value="3"/>
 </chat>
 
 <chat>
@@ -2305,6 +2322,7 @@
     <response>+CPIN: READY\n\nOK</response>
     <set name="PINVALUE" value="${*}"/>
     <set name="PINNAME" value="READY"/>
+    <set name="PINRETRYCOUNT" value="3"/>
 </chat>
 
 <chat>
@@ -2320,6 +2338,7 @@
     <command>AT+CPIN="*","*"</command>
     <response>+CPIN: SIM PUK\n\nERROR</response>
     <set name="PINNAME" value="SIM PUK"/>
+    <set name="PINRETRYCOUNT" value="0"/>
 </chat>
 
 <chat>
@@ -2327,6 +2346,7 @@
     <command>AT+CPIN=*</command>
     <response>+CPIN: SIM PIN\n\nERROR</response>
     <set name="PINNAME" value="SIM PIN"/>
+    <set name="PINRETRYCOUNT" value="2"/>
     <switch name="pinretry1"/>
 </chat>
 
@@ -2337,6 +2357,7 @@
         <command>AT+CPIN="${PINVALUE}"</command>
         <response>+CPIN: READY\n\nOK</response>
         <set name="PINNAME" value="READY"/>
+        <set name="PINRETRYCOUNT" value="3"/>
         <switch name="default"/>
     </chat>
 
@@ -2346,6 +2367,7 @@
         <response>+CPIN: READY\n\nOK</response>
         <set name="PINVALUE" value="${*}"/>
         <set name="PINNAME" value="READY"/>
+        <set name="PINRETRYCOUNT" value="3"/>
         <switch name="default"/>
     </chat>
 
@@ -2354,6 +2376,7 @@
         <command>AT+CPIN=*</command>
         <response>+CPIN: SIM PIN\n\nERROR</response>
         <set name="PINNAME" value="SIM PIN"/>
+        <set name="PINRETRYCOUNT" value="1"/>
         <switch name="pinretry2"/>
     </chat>
 
@@ -2366,6 +2389,7 @@
         <command>AT+CPIN="${PINVALUE}"</command>
         <response>+CPIN: READY\n\nOK</response>
         <set name="PINNAME" value="READY"/>
+        <set name="PINRETRYCOUNT" value="3"/>
         <switch name="default"/>
     </chat>
 
@@ -2375,6 +2399,7 @@
         <response>+CPIN: READY\n\nOK</response>
         <set name="PINVALUE" value="${*}"/>
         <set name="PINNAME" value="READY"/>
+        <set name="PINRETRYCOUNT" value="3"/>
         <switch name="default"/>
     </chat>
 
@@ -2383,6 +2408,7 @@
         <command>AT+CPIN=*</command>
         <response>+CPIN: SIM PUK\n\nERROR</response>
         <set name="PINNAME" value="SIM PUK"/>
+        <set name="PINRETRYCOUNT" value="0"/>
     </chat>
 
 </state>
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-22 18:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-22 12:47 [PATCH v3] phonesim: Support for querying SIM unlock retry count jussi.pakkanen
2014-04-22 18:14 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.