CN109766197B - 4G module stable working method based on Android system - Google Patents
- ️Fri Dec 18 2020
CN109766197B - 4G module stable working method based on Android system - Google Patents
4G module stable working method based on Android system Download PDFInfo
-
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
- 2018-12-29 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
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
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.
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 (4)
* Cited by examiner, † Cited by third partyPublication 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 |
CN117707627B (en) * | 2023-05-26 | 2024-11-08 | 荣耀终端有限公司 | DToF device initialization method and electronic equipment |
Family Cites Families (10)
* Cited by examiner, † Cited by third partyPublication 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 using the same VID / PID |
CN102662734B (en) * | 2012-03-06 | 2014-01-29 | 中国人民解放军理工大学 | A kind of 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 |
-
2018
- 2018-12-29 CN CN201811630457.5A patent/CN109766197B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN109766197A (en) | 2019-05-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109766197B (en) | 2020-12-18 | 4G module stable working method based on Android system |
CN107133086B (en) | 2020-09-04 | Task processing method, device and system based on distributed system |
CN113115351B (en) | 2023-06-02 | Network exception processing method, processing device, terminal equipment and medium |
CN108228374B (en) | 2021-08-20 | Equipment fault processing method, device and system |
CN108255646A (en) | 2018-07-06 | A kind of self-healing method of industrial control program failure based on heartbeat detection |
CN108429629A (en) | 2018-08-21 | Equipment fault restoration methods and device |
WO2012056696A1 (en) | 2012-05-03 | Wireless communication system and wireless communication method |
EP2521030A1 (en) | 2012-11-07 | Intelligent data terminal and application method thereof |
CN111273923A (en) | 2020-06-12 | FPGA (field programmable Gate array) upgrading method based on PCIe (peripheral component interface express) interface |
CN112565348A (en) | 2021-03-26 | Intelligent equipment testing method and system, computer equipment and storage medium |
CN111800810B (en) | 2022-09-13 | Intelligent device and system and method for recovering abnormity of WCN module thereof |
CN108958989B (en) | 2021-09-17 | System fault recovery method and device |
KR102705465B1 (en) | 2024-09-09 | Methods for handling abnormalities, terminal devices and storage media |
CN105848114B (en) | 2019-11-19 | A kind of processing method and mobile terminal of multimedia message |
KR20060059657A (en) | 2006-06-02 | How to check smart card status of mobile communication terminal |
CN111010706B (en) | 2023-04-28 | Abnormality recovery method and device |
CN110224872B (en) | 2022-03-22 | Communication method, device and storage medium |
CN105677510A (en) | 2016-06-15 | Monitoring method of communication processor and intelligent terminal |
CN109391544B (en) | 2022-02-25 | Automatic restarting method and circuit for dead halt of 2G/3G/4G router |
CN113568719B (en) | 2024-04-19 | Service fault processing method and device, electronic equipment and storage medium |
CN107147805B (en) | 2020-06-05 | Mobile terminal offline processing method and device |
CN114253801A (en) | 2022-03-29 | Method for actively isolating fault peripheral in out-of-band mode |
CN115087002B (en) | 2025-04-01 | Base station disconnection recovery method, device, electronic device and storage medium |
CN113938406B (en) | 2023-04-07 | Ethernet communication abnormity monitoring and processing method and system based on SOMEIP protocol |
CN116541312B (en) | 2023-09-22 | Continuous integration test method and system for automobile software |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
2019-05-17 | PB01 | Publication | |
2019-05-17 | PB01 | Publication | |
2019-06-11 | SE01 | Entry into force of request for substantive examination | |
2019-06-11 | SE01 | Entry into force of request for substantive examination | |
2020-10-30 | 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 |
2020-10-30 | CB03 | Change of inventor or designer information | |
2020-12-18 | GR01 | Patent grant | |
2020-12-18 | GR01 | Patent grant |