C114门户论坛百科APPEN| 举报 切换到宽版

亚星游戏官网

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索
查看: 2008|回复: 0

[技术讨论] 通过RILD层日志分析SIM卡状态 [复制链接]

军衔等级:

亚星游戏官网-yaxin222  新兵

注册:2019-4-24
发表于 2021-6-7 16:31:11 |显示全部楼层
                                   RILD层是应用层与modem交互的接口。// 切换数据卡,将原主卡slot 0主卡置为false,将slot 1设置为true08-09 11:24:40.335 2565 3243 D RILJ : [4820]> RIL_REQUEST_ALLOW_DATA allowed: false [SUB0]
08-09 11:24:40.371 2565 2851 D RILJ : [4820]< RIL_REQUEST_ALLOW_DATA [SUB0]08-09 11:24:41.153 2565 3250 D RILJ : [4839]> RIL_REQUEST_ALLOW_DATA allowed: true [SUB1]
08-09 11:24:41.159 2565 2855 D RILJ : [4839]< RIL_REQUEST_ALLOW_DATA [SUB1]// 查看PS域注册状态;0表示无数据,5表示有数据且漫游状态,1表示有数据且没有漫游,出现1/5表示数据驻网成功(PS域驻网成功)08-09 11:24:57.615 2565 2855 D RILJ : [4930]< DATA_REGISTRATION_STATE {0, null, null, null, 0, 20, null, null, null, null, null} [SUB1]
08-09 11:25:21.846 2565 2855 D RILJ : [4934]< DATA_REGISTRATION_STATE {5, a079, 0011c1d7, 3, null, 20, null, null, null, null, null} [SUB1]// 这条记录和上面记录结合起来看数据是否真正注册成功,如果失败,result是failure,且mFailCause会提示原因,比如apn不对,或者欠费等。08-09 11:25:26.265  2565  3074 D QtiDC-2 : DcActivatingState onSetupConnectionCompleted result=SUCCESS  SetupResult.mFailCause=NONE dc={QtiDC-2: State=DcActivatingState mApnSetting=[ApnSettingV3] yo, 1991, 45403, yo, null, null, null, null, null, 0, default | ia, IPV4V6, IPV4V6, true, 0, 0, 0, false, 0, 0, 0, 0, ,  RefCount=1 mCid=0 mCreateTime=-1 mLastastFailTime=-1 mLastFailCause=NONE mTag=21.查看信号状态1)搜索"< VOICE_REGISTRATION_STATE"查看CS域注册状态,也就是有无信号,第一个字段表示驻网状态,第四个字段表示网络类型,倒数第二个是拒绝入网原因。SUB0是卡槽1,SUB1是卡槽2比如下面日志中,13表示被拒绝入网,原因12是LA_NOT_ALLOWED; 5表示驻网成功,为漫游状态,网络类型14表示LTE07-23 01:36:35.516 748 2757 D RILJ : [5029]< VOICE_REGISTRATION_STATE {13, null, null, 0, null, null, null, 0, null, null, null, null, null, 12, null} [SUB1]
07-23 01:36:35.516 748 2757 D RILJ : [5033]< VOICE_REGISTRATION_STATE {13, null, null, 0, null, null, null, 0, null, null, null, null, null, 12, null} [SUB1]
07-23 01:38:20.744 748 2751 D RILJ : [5053]< VOICE_REGISTRATION_STATE {5, 03e9, 0c48f100, 14, null, null, null, 0, null, null, null, null, null, 0, null} [SUB0]
07-23 01:38:20.746 748 2757 D RILJ : [5057]< VOICE_REGISTRATION_STATE {13, null, null, 0, null, null, null, 0, null, null, null, null, null, 12, null} [SUB1]
07-23 01:38:20.799 748 2751 D RILJ : [5061]< VOICE_REGISTRATION_STATE {5, 03e9, 0c48f100, 14, null, null, null, 0, null, null, 0, null, null, 0, null} [SUB0]
07-23 01:38:42.989 748 2751 D RILJ : [5069]< VOICE_REGISTRATION_STATE {5, 03e9, 0c48f100, 14, null, null, null, 0, null, null, 0, null, null, 0, null} [SUB0]
07-23 01:38:43.235 748 2757 D RILJ : [5073]< VOICE_REGISTRATION_STATE {2, null, null, 0, null, null, null, 0, null, null, null, null, null, 0, null} [SUB1]
07-23 01:38:43.335 748 2751 D RILJ : [5078]< VOICE_REGISTRATION_STATE {2, null, null, 0, null, null, null, 0, null, null, null, null, null, 0, null} [SUB0]2)搜索"< DATA_REGISTRATION_STATE"查看PS域注册状态,也就是有无数据,和CS类似,第一个字段表示驻网状态,第四个字段表示网络类型。对于PS,只有主卡才会驻网,副卡不会驻网,不必关注。07-24 17:36:01.611 2629 2865 D RILJ : [3764]< DATA_REGISTRATION_STATE {5, a06f, 007e9627, 20, null, 20, null, null, null, null, null} [SUB0]
07-24 17:37:03.030 2629 2870 D RILJ : [3784]< DATA_REGISTRATION_STATE {2, null, null, null, 0, 20, null, null, null, null, null} [SUB1]
07-24 17:37:03.032 2629 2865 D RILJ : [3788]< DATA_REGISTRATION_STATE {5, a06f, 007ed5d8, 11, null, 20, null, null, null, null, null} [SUB0]3)PS驻网后,还需要搜索DcActivatingState,确认是否建立了网络连接,如果失败mFailCause会显示原因,比如欠费,APN不对07-25 14:28:52.569 2075 2208 D DC-2 : DcActivatingState onSetupConnectionCompleted result=SUCCESS SetupResult.mFailCause=NONE dc={DC-2: State=DcActivatingState mApnSetting=[ApnSettingV3] AIS, 2538, 52003, internet, , , , , , -1, default | ia, IPV4V6, IPV4V6, true, 0, 0, 0, false, 0, 0, 0, 0, , , false RefCount=1 mCid=0 mCreateTime=-1 mLastastFailTime=-1 mLastFailCause=NONE mTag=2 mLinkProperties={InterfaceName: rmnet_data0 LinkAddresses: [10.247.13.23/28,] Routes: [0.0.0.0/0 -> 10.247.13.24 rmnet_data0,] DnsAddresses: [115.178.58.26,115.178.58.10,] Domains: null MTU: 1500} linkCapabilities=[ Transports: CELLULAR Capabilities: IA&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN LinkUpBandwidth>=14Kbps LinkDnBandwidth>=14Kbps Specifier: <1>] mRestrictedNetworkOverride=false mApnContexts={{mApnType=default mState=CONNECTING mWaitingApns={[[ApnSettingV3] AIS, 2538, 52003, internet, , , , , , -1, default | ia, IPV4V6, IPV4V6, true, 0, 0, 0, false, 0, 0, 0, 0, , , false]} mApnSetting={[ApnSettingV3] AIS, 2538, 52003, internet, , , , , , -1, default | ia, IPV4V6, IPV4V6, true, 0, 0, 0, false, 0, 0, 0, 0, , , false} mReason=nwTypeChanged mDataEnabled=true mDependencyMet=true}={mTag=2 mApnContext={mApnType=default mState=CONNECTING mWaitingApns={[[ApnSettingV3] AIS, 2538, 52003, internet, , , , , , -1, default | ia, IPV4V6, IPV4V6, true, 0, 0, 0, false, 0, 0, 0, 0, , , false]} mApnSetting={[ApnSettingV3] AIS, 2538, 52003, internet, , , , , , -1, default | ia, IPV4V6, IPV4V6, true, 0, 0, 0, false, 0, 0, 0, 0, , , false} mReason=nwTypeChanged mDataEnabled=true mDependencyMet=true} mProfileId=0 mRat=0 mOnCompletedMsg={what=0x42000 when=-2h8m4s599ms obj=Pair{{mApnType=default mState=CONNECTING mWaitingApns={[[ApnSettingV3] AIS, 2538, 52003, internet, , , , , , -1, default | ia, IPV4V6, IPV4V6, true, 0, 0, 0, false, 0, 0, 0, 0, , , false]} mApnSetting={[ApnSettingV3] AIS, 2538, 52003, internet, , , , , , -1, default | ia, IPV4V6, IPV4V6, true, 0, 0, 0, false, 0, 0, 0, 0, , , false} mReason=nwTypeChanged mDataEnabled=true mDependencyMet=true} 2} target=Handler (com.qualcomm.qti.internal.telephony.dataconnection.QtiDcTracker) {6448827} replyTo=null}}}}驻网信息字段含义
驻网状态字段含义:
case 0: Not registered, MT is not currently searching *                 
                  a new operator to register case 2: // 2 is "searching"case 3: // 3 is "registration denied"case 4: // 4 is "unknown" no vaild in current basebandcase 10:// same as 0, but indicates that emergency call is possible.case 12:// same as 2, but indicates that emergency call is possible.case 13:// same as 3, but indicates that emergency call is possible.case 14:// same as 4, but indicates that emergency call is possible.return ServiceState.STATE_OUT_OF_SERVICE;
case 1: // Registered, home networkreturn ServiceState.STATE_IN_SERVICE;
case 5: // in service, roamreturn ServiceState.STATE_IN_SERVICE;
default: loge("regCodeToServiceState: unexpected service state " + code);
return ServiceState.STATE_OUT_OF_SERVICE; // radio_tech 网络类型 typedef enum {
RADIO_TECH_UNKNOWN = 0,
RADIO_TECH_GPRS = 1,
RADIO_TECH_EDGE = 2,
RADIO_TECH_UMTS = 3,
RADIO_TECH_IS95A = 4,
RADIO_TECH_IS95B = 5,
RADIO_TECH_1xRTT = 6,
RADIO_TECH_EVDO_0 = 7,
RADIO_TECH_EVDO_A = 8,
RADIO_TECH_HSDPA = 9,
RADIO_TECH_HSUPA = 10,
RADIO_TECH_HSPA = 11,
RADIO_TECH_EVDO_B = 12,
RADIO_TECH_EHRPD = 13,
RADIO_TECH_LTE = 14,
RADIO_TECH_HSPAP = 15, // HSPA+RADIO_TECH_GSM = 16, // Only supports voiceRADIO_TECH_TD_SCDMA = 17,
RADIO_TECH_IWLAN = 18,
RADIO_TECH_LTE_CA = 19,
RADIO_TECH_DC_HSPAP = 20 //for airtel network, AP should display 4G when BP report this tech} RIL_RadioTechnology;
拒绝入网原因: // reg_reject_cause#define IMSI_UNKNOWN_IN_HLR  0x02
#define ILLEGAL_MS 0x03
#define IMSI_UNKNOWN_IN_VLR 0x04
#define IMEI_NOT_ACCEPTED 0x05
#define ILLEGAL_ME 0x06
#define GPRS_SERVICES_NOT_ALLOWED 0x07
#define GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED 0x08
#define MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK 0x09
#define IMPLICITLY_DETACHED 0x0A #define PLMN_NOT_ALLOWED 0x0B
#define LA_NOT_ALLOWED 0x0C #define NATIONAL_ROAMING_NOT_ALLOWED 0x0D
#define GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN 0x0E
#define NO_SUITABLE_CELLS_IN_LA 0x0F
#define MSC_TEMPORARILY_NOT_REACHABLE 0x10
#define NETWORK_FAILURE 0x11
#define MAC_FAILURE 0x14
#define SYNCH_FAILURE 0x15
#define CONGESTTION 0x16
#define GSM_AUTH_UNACCEPTED 0x17
#define CSG_NOT_AUTHORIZED 0x19
#define SERVICE_OPTION_NOT_SUPPORTED 0x20
#define REQ_SERV_OPT_NOT_SUBSCRIBED 0x21
#define SERVICE_OPT__OUT_OF_ORDER 0x22
#define CALL_CANNOT_BE_IDENTIFIED 0x26
#define NO_PDP_CONTEXT_ACTIVATED 0x28
#define RETRY_UPON_ENTRY_INTO_A_NEW_CELL_MIN_VALUE 0x30
#define RETRY_UPON_ENTRY_INTO_A_NEW_CELL_MAX_VALUE 0x3F
#define SEMANTICALLY_INCORRECT_MSG 0x5F
#define INVALID_MANDATORY_INFO 0x60
#define MESSAGE_TYPE_NON_EXISTANT 0x61
#define MESSAGE_TYPE_NOT_COMP_PRT_ST 0x62
#define IE_NON_EXISTANT 0x63
#define MSG_NOT_COMPATIBLE_PROTOCOL_STATE 0x652、查看手机状态分析日志时,有时候需要查看某段时间wifi是否链接/数据开关是否打开/主副卡设置在哪个卡槽/优选网络模式。1、wifi开关打开关闭,搜索setWifiEnabled。wifi是否连接,搜索mIsWifiConnected07-29 02:08:48.704  1471  1471 D WifiService: setWifiEnabled: true pid=1471, uid=100007-25 14:26:27.403  1471  2590 D WifiService: setWifiEnabled: false pid=1678, uid=100007-25 14:12:18.531 2075 2075 D QtiGsmDCT: [1]NETWORK_STATE_CHANGED_ACTION: mIsWifiConnected=false
07-25 14:12:18.564 2075 2075 D QtiGsmDCT: [0]NETWORK_STATE_CHANGED_ACTION: mIsWifiConnected=true2、数据开关08-29 14:00:54.466  1184 11534 D ConnectivityService: setMobileDataEnabled(true) // 打开数据开关08-29 14:01:11.136  1184 12409 D ConnectivityService: setMobileDataEnabled(false) // 关闭数据开关07-25 14:28:32.657 12395 12395 D ConnectivityManager: getMobileDataEnabled()- subId=1 retVal=true // 获取数据开关状态3、设置主副卡07-25 08:46:36.129  3120  3120 D RILJ    : [1722]> RIL_REQUEST_ALLOW_DATA allowed: false [SUB0] // 切换主卡时,先关闭原卡槽主卡07-25 08:46:36.181  3120  3120 D RILJ    : [1723]> RIL_REQUEST_ALLOW_DATA allowed: true [SUB1] // 再切换到新的卡槽4、设置优选网络模式07-25 08:46:40.262  3120  3120 D RILJ    : [1757]> REQUEST_SET_PREFERRED_NETWORK_TYPE : 10 [SUB0] // 设置07-25 08:46:40.272  3120  3178 D RILJ    : [1757]< REQUEST_SET_PREFERRED_NETWORK_TYPE  [SUB0] // 07-25 08:46:40.273 3120 3120 D RILJ : [1758]> REQUEST_SET_PREFERRED_NETWORK_TYPE : 20 [SUB1]
07-25 08:46:40.281 3120 3182 D RILJ : [1758]< REQUEST_SET_PREFERRED_NETWORK_TYPE [SUB1]优选网络模式值138    /* NETWORK_MODE_* See ril.h RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE */139    int NETWORK_MODE_WCDMA_PREF     = 0; /* GSM/WCDMA (WCDMA preferred) */140    int NETWORK_MODE_GSM_ONLY       = 1; /* GSM only */141    int NETWORK_MODE_WCDMA_ONLY     = 2; /* WCDMA only */142    int NETWORK_MODE_GSM_UMTS       = 3; /* GSM/WCDMA (auto mode, according to PRL) 143 AVAILABLE Application Settings menu*/144    int NETWORK_MODE_CDMA           = 4; /* CDMA and EvDo (auto mode, according to PRL) 145 AVAILABLE Application Settings menu*/146    int NETWORK_MODE_CDMA_NO_EVDO   = 5; /* CDMA only */147    int NETWORK_MODE_EVDO_NO_CDMA   = 6; /* EvDo only */148    int NETWORK_MODE_GLOBAL         = 7; /* GSM/WCDMA, CDMA, and EvDo (auto mode, according to PRL) 149 AVAILABLE Application Settings menu*/150    int NETWORK_MODE_LTE_CDMA_EVDO  = 8; /* LTE, CDMA and EvDo */151    int NETWORK_MODE_LTE_GSM_WCDMA  = 9; /* LTE, GSM/WCDMA */152    int NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA = 10; /* LTE, CDMA, EvDo, GSM/WCDMA */153    int NETWORK_MODE_LTE_ONLY       = 11; /* LTE Only mode. */154    int NETWORK_MODE_LTE_WCDMA      = 12; /* LTE/WCDMA */155    int NETWORK_MODE_TDSCDMA_ONLY            = 13; /* TD-SCDMA only */156    int NETWORK_MODE_TDSCDMA_WCDMA           = 14; /* TD-SCDMA and WCDMA */157    int NETWORK_MODE_LTE_TDSCDMA             = 15; /* TD-SCDMA and LTE */158    int NETWORK_MODE_TDSCDMA_GSM             = 16; /* TD-SCDMA and GSM */159    int NETWORK_MODE_LTE_TDSCDMA_GSM         = 17; /* TD-SCDMA,GSM and LTE */160    int NETWORK_MODE_TDSCDMA_GSM_WCDMA       = 18; /* TD-SCDMA, GSM/WCDMA */161    int NETWORK_MODE_LTE_TDSCDMA_WCDMA       = 19; /* TD-SCDMA, WCDMA and LTE */162    int NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA   = 20; /* TD-SCDMA, GSM/WCDMA and LTE */163    int NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA  = 21; /*TD-SCDMA,EvDo,CDMA,GSM/WCDMA*/164    int NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = 22; /* TD-SCDMA/LTE/GSM/WCDMA, CDMA, and EvDo */                                    

举报本楼

您需要登录后才可以回帖 登录 | 注册 |

手机版|C114 ( 沪ICP备12002291号-1 )|联系大家 |网站地图  

GMT+8, 2024-11-29 10:38 , Processed in 0.342536 second(s), 15 queries , Gzip On.

Copyright © 1999-2023 C114 All Rights Reserved

Discuz Licensed

回顶部
XML 地图 | Sitemap 地图