简体   繁体   English

当 SIM 卡没有 PIN 时,如何使用 AT 命令更改/创建 SIM PIN?

[英]How to change/create SIM PIN using AT commands when the SIM card has no PIN?

I'm using a SIM868 module and I was using my usual SIM card with no problem, but now I have bought a new SIM card and has no pin.我用的是 SIM868 模块,我用的是我常用的 SIM 卡,没有问题,但现在我买了一张新的 SIM 卡,没有 pin。 I need to add a PIN code in order to have more security.我需要添加 PIN 码以提高安全性。

I have checked that it has no PIN enabled using this command: AT+CPIN?我检查了它没有使用以下命令启用 PIN: AT+CPIN? . .

and the answer was: +CPIN: READY .答案是: +CPIN: READY

I have searched how to change it in the SIMCOM's AT commands manual and I have found 2 options:我在 SIMCOM 的 AT 命令手册中搜索了如何更改它,我发现了 2 个选项:

  1. AT+CPIN=<pin>[,<new pin>]
  2. AT+CPWD=<fac>,<oldpwd>,<newpwd>

I have tried both of them, but in the first one I can't insert the actual PIN, because there is no actual PIN.我已经尝试了这两种方法,但在第一个中我无法插入实际的 PIN,因为没有实际的 PIN。 And in the second one I have tried different commands due, in the description of the AT command, sais "If an old password has not yet been set, oldpwd is not to enter" .在第二个中,我尝试了不同的命令,因为在 AT 命令的描述中, “如果尚未设置旧密码,则不输入oldpwd None of this ones has worked (guess that 1234 is the new PIN that I want to use)这些都不起作用(猜想 1234 是我想使用的新 PIN)

1) AT+CLCK=“SC”,"1234"
2) AT+CLCK=“SC”,,"1234" 
3) AT+CLCK=“SC”,“”,"1234" 

The answer to that 3 cases was the same: ERROR .这 3 种情况的答案是相同的: ERROR

(If someone is going to suggest that I can change or try the SIM card with a mobile phone I can't do it because this new SIM card is a miniSIM card and all my phones use nanoSIM or microSIM). (如果有人建议我可以更换或尝试使用手机的 SIM 卡,我不能这样做,因为这张新的 SIM 卡是 miniSIM 卡,我所有的手机都使用 nanoSIM 或 microSIM)。

Any suggestions?有什么建议么?

TL;DR TL;博士

In order to set the PIN code 1234 you need to provide the following comment:为了设置 PIN 码1234 ,您需要提供以下注释:

AT+CLCK="SC",1,"1234"

Explanation解释

As you correctly wrote, AT+CLCK is the correct command to enable/disable any module's facility, included "SIM PIN request".正如您所写的那样, AT+CLCK是启用/禁用任何模块功能的正确命令,包括“SIM PIN 请求”。 But your syntax is wrong.但是你的语法是错误的。

According to ETSI specification , the correct syntax is根据ETSI 规范,正确的语法是

AT+CLCK=<fac>,<mode>[,<passwd>[,<class>]]

Where:在哪里:

  • <fac> (string) is the facility to be locked/unlocked ( "SC" in case of "SIM (PIN request)" ). <fac> (字符串)是要锁定/解锁的设施( "SC"“SIM(PIN 请求)”的情况下)。
  • <mode> (integer) is the operation to be done on the facility. <mode> (整数)是要对设施进行的操作。 This parameter was missing in your attempts .您的尝试中缺少此参数
    • 0 to unlock 0解锁
    • 1 to lock 1锁定
    • 2 to query lock status 2查询锁状态
  • <passwd> is the password set with +CPWD (in your case it should be the PIN code but it is probably not required since it is not set). <passwd>是使用+CPWD设置的密码(在您的情况下,它应该是 PIN 码,但可能不需要,因为它没有设置)。
  • <class> is a sum of integers each representing a class of information. <class>是整数的总和,每个整数代表一个 class 信息。 You don't eed it for your task.你不需要它来完成你的任务。

Note: in development phase, when "playing" with AT commands, I suggest enabling verbose errors mode providing either AT+CMEE=1 or AT+CMEE=2 according to what your device do support (check it by providing test command AT+CMEE=? ).注意:在开发阶段,当使用 AT 命令“播放”时,我建议启用详细错误模式,根据您的设备支持的情况提供AT+CMEE=1AT+CMEE=2 (通过提供测试命令AT+CMEE=? )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM