CN109766197B - 4G module stable working method based on Android system - Google Patents

4G module stable working method based on Android system Download PDF

Info

Publication number
CN109766197B
CN109766197B CN201811630457.5A CN201811630457A CN109766197B CN 109766197 B CN109766197 B CN 109766197B CN 201811630457 A CN201811630457 A CN 201811630457A CN 109766197 B CN109766197 B CN 109766197B
Authority
CN
China
Prior art keywords
module
count
layer
event
counting
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811630457.5A
Other languages
Chinese (zh)
Other versions
CN109766197A (en
Inventor
张宏宽
胡权
金昊炫
康克勤
梁淑萍
楼勇亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Soyea Technology Co Ltd
Original Assignee
Soyea Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Soyea Technology Co Ltd filed Critical Soyea Technology Co Ltd
Priority to CN201811630457.5A priority Critical patent/CN109766197B/en
Publication of CN109766197A publication Critical patent/CN109766197A/en
Application granted granted Critical
Publication of CN109766197B publication Critical patent/CN109766197B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The 4G module stable working method based on the Android system comprises an Android host and a 4G module, wherein the 4G module is communicated with a main control chip of the Android host through a USB interface and a UART interface, the Android system comprises an application layer, an application framework layer, a system operation library layer, a hardware abstraction layer HAL, a Kernel Kernel layer and a Device equipment layer, the working state of the 4G module is actively monitored on the hardware abstraction layer, the corresponding state of the 4G module to an AT instruction is monitored, an abnormal condition is found, and then software control related to the 4G module is actively restarted, so that the effect of ensuring the stable operation of the 4G module is achieved.

Description

4G module stable working method based on Android system
Technical Field
The invention relates to a 4G module stable working method based on an Android system, which is applied to a vehicle-mounted system, and the 4G module of the system is in a stable working state by monitoring a Linux kernel hot plug event and a message mechanism actively reported by the 4G module in a hardware abstraction layer HAL of the Android system.
Background
The wireless 4G module is a product which is generally called as a 4G technology-based wireless communication module and is characterized in that hardware is loaded to a specified frequency band, software supports a standard LTE protocol, and the software and the hardware are highly integrated and modularized. Because the 4G module utilizes the network of the mobile operator covered by the 4G global, it can carry out long-distance data communication, and is a frequently used technical means in industrial and Internet of things applications. The network built by the 4G modules has the advantages of wide coverage range, reliable transmission, good expandability, flexible networking, quick construction period, low operation cost and the like. The cost of building the network is low, the central station is only added with an interface server and a communication data line, and the terminal station can build a complete data acquisition and control system only by adding a 4G wireless communication module. Due to the advantages, the 4G module is widely applied to the fields of mobile broadband access, video monitoring, handheld terminals, vehicle-mounted equipment and the like. However, in the using process, the 4G module is often disabled due to software running efficiency, conflicts among programs, and short-time hardware disconnection, so that the running stability of the system and the practical fluency of the product are affected. Most of the above situations can be solved by a simple restart module, but due to the mechanism of the system, the user needs to manually restart after finding the situation, which results in the reduction of user experience.
Disclosure of Invention
In order to solve the problems, the invention provides a 4G module stable working method based on an Android system, which can automatically monitor the working state of a 4G module below a hardware abstraction layer and restart the 4G module according to the state of the 4G module so as to ensure stable operation.
In order to achieve the above object, the Android system-based 4G module stable working method provided by the invention comprises an Android host and a 4G module, wherein the 4G module is in communication with a main control chip of the Android host through a USB interface and a UART interface, the Android system comprises an application layer, an application framework layer, a system runtime layer, a hardware abstraction layer HAL, a Kernel layer and a Device layer, and the method comprises the following steps:
1) ril-daemon will execute/system/bin/rid program when the service is started, at this time, a listening thread is created by pthread _ create in the main method of rid;
2) the user space and the Linux kernel communicate by using a Netlink mechanism, so a Netlink socket is created in a monitoring thread, a socket function is called to create the socket, and a unique file descriptor value is obtained;
3) polling the socket descriptor created in 2) by using a poll mechanism, wherein when a poll method is called, no data thread can be blocked, and data can be returned immediately;
4) waiting for linux kernel event generation;
5) when no event occurs, the created thread is in a blocking state, so that system resources are saved;
6) after a uevent event is generated, analyzing the content of the event message in a hardware abstraction layer HAL, acquiring 'add' and 'remove' messages, and extracting PRODUCT field data to obtain values of a PRODUCT identification code pid and a manufacturer identification code vid;
7) comparing the obtained pid and vid values with a value preset by a system;
8) if the comparison result is not consistent, no processing is carried out at the moment;
9) if the comparison result is consistent, the rild process is exited by an exit command, and at this time, the system restarts ril-daemon service to recover the communication mechanism until the complete monitoring event mechanism is completed.
The further method is that the monitoring process of the state of the SIM card is completed through the following steps,
1) in the reference-ril document, the integer variable count is defined in the onansolidated function and is used for counting the number of at error times generated by the 4G module in work;
2) when counting, judging whether the counting is continuously generated at error information;
3) if the message is not a continuous at error message, clearing the count;
4) if the message is a continuous at error message, counting the count, and setting the maximum count threshold value to be 80;
5) judging whether the count value reaches the threshold value during each counting;
6) if the threshold value is not reached, continuing to count the count by 1;
7) when the count reaches the maximum threshold value, firstly, the count is cleared for continuing counting next time, and then an at command is sent to the 4G module to carry out soft restart operation on the 4G module.
The principle disclosed by the invention is as follows:
and the Android hardware abstraction layer encapsulates the Linux kernel driver, provides an interface upwards and shields the implementation details of the Linux bottom layer. The hot plug event of Linux is realized through a kobject mechanism of a kernel, and when an event occurs, the event can be captured by a hardware abstraction layer HAL, and then event filtering is performed, so that the event needing polling is extracted. When the Android system is started, ril-daemon service is loaded, a rild process is executed in the service, and the rild is located in a hardware abstraction layer. In the hardware abstraction layer HAL, a pthread _ create function is used to create a thread, inside which a PF _ NETLINK socket is created and polling is performed through poll mechanism whether a hot plug event is generated. If no event is generated in the current system, the created thread is always in a blocking state and waits for the event to occur. When the 4G module and the main controller usb interface are abnormal, such as loose, the Linux kernel reports a uevent event message, at the moment, the hardware abstraction layer HAL receives the event and filters out irrelevant message fields, only the add and remove messages are reserved and the PRODUCT message content is extracted, at the moment, the manufacturer identification code vid and the PRODUCT identification code pid of the 4G module can be obtained in the hardware abstraction layer HAL, the manufacturer identification code vid and the PRODUCT identification code pid are matched with usb data set by default in the system, if the matching is unsuccessful, the event which is not generated by the current 4G module is not processed, and if the matching is successful, the android background process is restarted, so that the normal working state is recovered.
Meanwhile, under normal conditions, the 4G module can actively report information such as a current network state and a signal value through the usb interface, and the upper layer application can also issue an AT command to the 4G module through the usb interface. When the 4G module is in normal operation, the module will respond to the AT command. In a vehicle-mounted environment, for a slot type SIM card, conditions that a contact point of the SIM card seat is not well contacted with a contact point of the SIM card seat, or a 4G module cannot identify an AT instruction due to the fact that the SIM card is loosened or a 4G signal cannot be found after passing through a network-free area and the like may occur, the 4G module cannot process a corresponding service function, and therefore communication interruption is caused, so that the SIM card identification fault of the module can be judged, and AT this time, AT error instructions can repeatedly occur in a system radio log. Therefore, the onansolidated method in the reference-ril file can be modified in the hardware abstraction layer, the number of times count of the AT instruction with errors in the radio log is continuously captured, when the number of times count of the errors reaches the set maximum threshold value, the judgment module cannot respond to the AT instruction, and AT the moment, the AT soft restart instruction is directly sent to restart the 4G module, so that the normal working state of the module is recovered.
Compared with the prior art, the method disclosed by the invention actively monitors the working state of the 4G module, and actively restarts the software control related to the 4G module after an abnormal condition is found, thereby achieving the effect of ensuring the stable operation of the 4G module.
Drawings
Fig. 1 is a flowchart illustrating an implementation of monitoring a Linux kernel hot plug event by a hardware abstraction layer of an Android system.
Fig. 2 is a flowchart illustrating an implementation of monitoring the state of the SIM card through a message mechanism autonomously reported by the 4G module.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
Example 1.
The Android system-based 4G module stable working method described in this embodiment includes an Android host and a 4G module, where the 4G module communicates with a main control chip of the Android host through a USB interface and a UART interface, the Android system includes an application layer, an application framework layer, a system runtime layer, a hardware abstraction layer HAL, a Kernel layer, and a Device layer, and processing steps for a Linux hot plug event are as follows, and a flowchart is shown in fig. 1:
1) ril-daemon service will execute/system/bin/rid procedures when it starts, creating a snoop thread through pthread _ create in rid's main method.
2) The user space and the Linux kernel communicate by using a Netlink mechanism, so a Netlink socket needs to be created in a listening thread. And calling a socket function to create a socket and obtaining the value of the unique file descriptor.
3) Polling the socket descriptor created in 2) using the poll mechanism. When the poll method is called, no data thread can be blocked, and data can be returned immediately.
4) Wait for linux kernel uevent event to generate.
5) When no event occurs, the created thread is in a blocking state, and system resources are saved.
6) As the working environment of the vehicle-mounted equipment is very likely to cause the loosening of the pcie interface, once the loosening occurs, the event of the uevent is reported through the Linux kernel.
7) After the event occurs, analyzing the event message content in the hardware abstraction layer, acquiring the 'add' and 'remove' messages, and extracting the data of the PRODUCT field to obtain the values of the PRODUCT identification code pid and the manufacturer identification code vid.
8) And comparing the obtained pid and vid values with a value preset by a system.
9) If the comparison result is inconsistent, the event information generated by the current 4G module can be considered not to be processed at the moment.
10) If the comparison result is consistent, the rild process is exited by an exit command, and the system restarts ril-daemon service to restore the communication mechanism. The monitor event mechanism to this one completion completes.
The steps of the monitoring process for the SIM status are as follows, and the flowchart is shown in fig. 2:
1) in the reference-ril document, the integer variable count is defined in the onansolidated function and is used to count the number of at errors generated by the module during operation.
2) When counting, judging whether it is the at error message generated continuously.
3) If it is not a continuous at error message, the count is cleared. The message is not continuous, and the description module can normally execute the at instruction without operation.
4) If the message is a continuous at error message, count is counted, and the maximum count threshold is set to 80.
5) And judging whether the count value reaches the threshold value or not every time of counting.
6) If the threshold is not reached, indicating that it may not be an at error message caused by a SIM card read failure, the count continues to be incremented by 1.
7) When the count reaches the maximum threshold value, firstly, the count is cleared for continuing counting next time, and then an at command is sent to the module to perform soft restart operation on the module.

Claims (1)

1. A4G module stable working method based on an Android system uses an Android host and a 4G module, the 4G module is communicated with a main control chip of the Android host through a USB interface and a UART interface, the Android system comprises an application layer, an application framework layer, a system operation base layer, a hardware abstraction layer HAL, a Kernel Kernel layer and a Device equipment layer, and the method is characterized by comprising the following steps:
1) ril-daemon will execute/system/bin/rid program when the service is started, at this time, a listening thread is created by pthread _ create in the main method of rid;
2) the user space and the Linux kernel communicate by using a Netlink mechanism, so a Netlink socket needs to be created in a monitoring thread, a socket function is called to create the socket, and a unique file descriptor value is obtained;
3) polling the socket descriptor created in 2) by using a poll mechanism, wherein when a poll method is called, no data thread can be blocked, and data can be returned immediately;
4) waiting for linux kernel event generation;
5) when no event occurs, the created thread is in a blocking state, so that system resources are saved;
6) after a uevent event is generated, analyzing the content of the event message in a hardware abstraction layer HAL, acquiring 'add' and 'remove' messages, and extracting PRODUCT field data to obtain values of a PRODUCT identification code pid and a manufacturer identification code vid;
7) comparing the obtained pid and vid values with a value preset by a system;
8) if the comparison result is not consistent, no processing is carried out at the moment;
9) if the comparison result is consistent, an exit command is used for exiting the rild process, at this time, the system can restart ril-daemon service, and the communication mechanism is restored again until the complete monitoring event mechanism is completed;
the SIM card state monitoring processing comprises the following steps:
1) in the reference-ril document, the integer variable count is defined in the onansolidated function and is used for counting the number of at error times generated by the 4G module in work;
2) when counting, judging whether the counting is continuously generated at error information;
3) if the message is not a continuous at error message, clearing the count;
4) if the message is a continuous at error message, counting the count, and setting the maximum count threshold value to be 80;
5) judging whether the count value reaches the threshold value during each counting;
6) if the threshold value is not reached, continuing to count the count by 1;
7) when the count reaches the maximum threshold value, firstly, the count is cleared for continuing counting next time, and then an at command is sent to the 4G module to carry out soft restart operation on the 4G module.
CN201811630457.5A 2018-12-29 2018-12-29 4G module stable working method based on Android system Active CN109766197B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811630457.5A CN109766197B (en) 2018-12-29 2018-12-29 4G module stable working method based on Android system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811630457.5A CN109766197B (en) 2018-12-29 2018-12-29 4G module stable working method based on Android system

Publications (2)

Publication Number Publication Date
CN109766197A CN109766197A (en) 2019-05-17
CN109766197B true CN109766197B (en) 2020-12-18

Family

ID=66452539

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811630457.5A Active CN109766197B (en) 2018-12-29 2018-12-29 4G module stable working method based on Android system

Country Status (1)

Country Link
CN (1) CN109766197B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113676340A (en) * 2020-05-15 2021-11-19 广州汽车集团股份有限公司 SDIO communication abnormity monitoring method, SDIO communication abnormity monitoring architecture and computer readable storage medium
CN111800810B (en) * 2020-06-30 2022-09-13 展讯通信(上海)有限公司 Intelligent device and system and method for recovering abnormity of WCN module thereof
CN113867879B (en) * 2021-10-15 2023-09-22 数源科技股份有限公司 Android-based system style depth customization method

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FI20050412A0 (en) * 2005-04-21 2005-04-21 Nokia Corp Method of forming connections in a telecommunications system
KR100740252B1 (en) * 2006-01-06 2007-07-18 (주)하이비젼시스템 USB Interface Method using one and the same VID/PID
CN102662734B (en) * 2012-03-06 2014-01-29 中国人民解放军理工大学 Android RIL system and construction method thereof
CN103970559B (en) * 2013-02-05 2017-09-29 北京壹人壹本信息科技有限公司 A kind of equipment loading method and device based on android system
CN105005722A (en) * 2015-06-26 2015-10-28 北京北信源软件股份有限公司 Access control method and apparatus for mobile storage device
US9934073B2 (en) * 2015-10-23 2018-04-03 Futurewei Technologies, Inc. Extension of resource constraints for service-defined containers
CN107295497A (en) * 2017-06-05 2017-10-24 惠州Tcl移动通信有限公司 A kind of AP and Modem exchange method and system
CN108121681B (en) * 2017-12-04 2020-12-11 泾县谷声信息科技有限公司 Hot plug implementation method, terminal and storage medium
CN108228425A (en) * 2017-12-29 2018-06-29 成都三零嘉微电子有限公司 A kind of linux system implements the system for obtaining equipment hot swap information
CN109032972A (en) * 2018-07-25 2018-12-18 郑州云海信息技术有限公司 A kind of processing method and system of hot plugging event

Also Published As

Publication number Publication date
CN109766197A (en) 2019-05-17

Similar Documents

Publication Publication Date Title
CN109766197B (en) 4G module stable working method based on Android system
CN107133086B (en) Task processing method, device and system based on distributed system
CN113115351B (en) Network exception processing method, processing device, terminal equipment and medium
CN108228374B (en) Equipment fault processing method, device and system
CN109144873B (en) Linux kernel processing method and device
EP2521030A1 (en) Intelligent data terminal and application method thereof
CN111694710A (en) Method, device and equipment for monitoring faults of substrate management controller and storage medium
CN111273923A (en) FPGA (field programmable Gate array) upgrading method based on PCIe (peripheral component interface express) interface
CN111800810B (en) Intelligent device and system and method for recovering abnormity of WCN module thereof
CN107395451B (en) Processing method, device and equipment for internet traffic abnormity and storage medium
CN112565348A (en) Intelligent equipment testing method and system, computer equipment and storage medium
CN113396561A (en) Operation device maintenance method and apparatus, storage medium, and program product
CN111010706B (en) Abnormality recovery method and device
CN112817883A (en) Method, device and system for adapting interface platform and computer readable storage medium
KR20060059657A (en) Method for checking smart card in mobile communication terminal device
CN105824622A (en) Data processing method and electronic equipment
CN108958989B (en) System fault recovery method and device
CN105677510A (en) Monitoring method of communication processor and intelligent terminal
CN105306270A (en) Simple network management protocol (SNMP) based data monitoring methods, and devices
CN109391544B (en) Automatic restarting method and circuit for dead halt of 2G/3G/4G router
CN113424159A (en) Operation device maintenance method and apparatus, storage medium, and program product
CN113938406B (en) Ethernet communication abnormity monitoring and processing method and system based on SOMEIP protocol
CN116541312B (en) Continuous integration test method and system for automobile software
CN111448792B (en) Communication normality confirmation device, communication normality confirmation method, and storage medium
CN107147805B (en) Mobile terminal offline processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB03 Change of inventor or designer information

Inventor after: Zhang Hongkuan

Inventor after: Hu Quan

Inventor after: Jin Haoxuan

Inventor after: Kang Keqin

Inventor after: Liang Shuping

Inventor after: Lou Yongliang

Inventor before: Kang Keqin

Inventor before: Jin Haoxuan

Inventor before: Zhang Hongkuan

Inventor before: Hu Quan

CB03 Change of inventor or designer information
GR01 Patent grant
GR01 Patent grant