Exception handling method, terminal device and storage medium

By clearing and reloading the driver when the WIFI module is abnormal, the functional failure problem caused by the WIFI module is solved, and the stability and user experience of the terminal device are improved.

CN112805691BActive Publication Date: 2024-11-12SHENZHEN HEYTAP TECHNOLOGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201880098315.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-11-19
Publication Date
2024-11-12
Estimated Expiration
2038-11-19

AI Technical Summary

Technical Problem

When an abnormality occurs in the WIFI module, the terminal device cannot recover in time, which will affect the user experience and may cause the device to restart.

Method used

After receiving the instruction to enable the WIFI function, load and run the driver of the WIFI module. If the request subprocess fails, the driver is cleared from memory and reloaded to achieve exception handling and recovery.

Benefits of technology

It effectively solves the problem of functional failure caused by abnormal WIFI modules, improves the stability and user experience of the device, and avoids the risk of device restart.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112805691B_ABST
    Figure CN112805691B_ABST
Patent Text Reader

Abstract

An exception handling method, a terminal device and a computer-readable storage medium, the method comprising: after receiving an instruction to turn on the WIFI function of the terminal device, loading and running the driver of the WIFI module, initiating at least one request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device, if any request sub-process fails, clearing the driver of the WIFI module from the memory of the terminal device, after the driver of the WIFI module is cleared from the memory, reloading and running the driver of the WIFI module, through the application, timely recovery can be performed when an abnormality occurs in the WIFI module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of communication technology, and in particular, relates to an exception handling method, a terminal device, and a computer-readable storage medium. Background Art

[0002] At present, most mobile phones and other terminal devices are equipped with wireless network cards. The so-called wireless network card is actually one of the three important modules of Intel Centrino mobile technology - WIFI module. Wireless network cards usually have a transmitter module and a receiver module. When a user connects to a wireless LAN through the WIFI module on the terminal device, it is necessary to scan the available wireless access points (AP) nearby, select a scanned wireless access point as a configured AP, and connect to the configured AP to access the Internet through the configured AP. Summary of the invention

[0003] The present application provides an exception handling method, a terminal device and a computer-readable storage medium when accessing a wireless local area network through a WIFI module, so as to promptly recover when an exception occurs in the WIFI module.

[0004] A first aspect of the present application provides a power fallback method, which is applied to a terminal device including a WIFI module, and the method includes:

[0005] After receiving an instruction to enable the WIFI function of the terminal device, loading and running a driver program of the WIFI module;

[0006] Initiate at least one request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device;

[0007] If any request sub-process fails, clearing the driver of the WIFI module from the memory of the terminal device;

[0008] After the driver program of the WIFI module is cleared from the memory, the driver program of the WIFI module is reloaded and run.

[0009] A second aspect of the present application provides a terminal device, including:

[0010] A loading and running unit, configured to load and run a driver program of the WIFI module after receiving an instruction to enable the WIFI function of the terminal device;

[0011] A request sub-process initiating unit, configured to initiate at least one request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device;

[0012] A clearing unit, configured to clear the driver program of the WIFI module from the memory of the terminal device if any request sub-process fails;

[0013] The reloading and running unit is used to reload and run the driver program of the WIFI module after the driver program of the WIFI module is cleared from the memory.

[0014] The third aspect of an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method provided in the first aspect of the embodiment of the present application when executing the computer program.

[0015] The fourth aspect of the embodiments of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by one or more processors, it implements the steps of the method provided in the first aspect of the embodiments of the present application.

[0016] The fifth aspect of the embodiments of the present application provides a computer program product, which includes a computer program. When the computer program is executed by one or more processors, it implements the steps of the method provided in the first aspect of the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0018] Figure 1 It is a schematic diagram of an implementation flow of an exception handling method provided in an embodiment of the present application;

[0019] Figure 2 It is a schematic diagram of the implementation flow of another exception handling method provided in an embodiment of the present application;

[0020] Figure 3 It is a schematic diagram of the implementation flow of another exception handling method provided in an embodiment of the present application;

[0021] Figure 4 is a schematic block diagram of a terminal device provided in an embodiment of the present application;

[0022] Figure 5 It is a schematic block diagram of another terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0024] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0025] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0026] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0027] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0028] In order to illustrate the technical solution described in this application, a specific embodiment is provided below for illustration.

[0029] Figure 1 1 is a schematic diagram of an implementation flow of an exception handling method provided in an embodiment of the present application, wherein the exception handling method is applied to a terminal device including a WIFI module. As shown in the figure, the method may include the following steps:

[0030] Step S101, after receiving an instruction to enable the WIFI function of the terminal device, loading and running a driver program of the WIFI module.

[0031] In an embodiment of the present application, a user can click on the display interface on the terminal device to turn on the WIFI function of the terminal device. For example, a virtual button for the wifi function is set on a terminal device such as a mobile phone. After the user clicks the virtual button for the wifi function, an instruction to turn on the WIFI function of the terminal device is sent through the virtual button.

[0032] After receiving the instruction to turn on the WIFI function of the terminal device, the driver program of the WIFI module will be loaded and run in the memory.

[0033] As another embodiment of the present application, a daemon process may be set for the driver of the WIFI module, and the daemon process is started after the driver of the WIFI module is detected to be running. Other functions of the daemon process will be described later.

[0034] Step S102: Initiate at least one request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device.

[0035] In the embodiment of the present application, when the terminal device accesses the wireless local area network through the WIFI module to access the Internet, it needs to go through the following process, which is simplified as follows: start, scan, display the scanned wireless access point, configure the wireless access point, connect to the wireless access point, obtain the IP address, and access the Internet.

[0036] Because when scanning, the framework layer of the WIFI system needs to initiate a scan request to the hardware layer of the WIFI system; when connecting, the framework layer of the WIFI system needs to initiate a connection request to the hardware layer of the WIFI system. Therefore, in an embodiment of the present application, the process from initiating a scan request to initiating a connection request can be called a scan request sub-process. The process from initiating a connection request to connecting to a wireless access point can be called a connection request sub-process. The request sub-process includes: a scan request sub-process and a connection request sub-process. After the scan request sub-process is successful, the connection request sub-process can be performed.

[0037] Step S103: if any request sub-process fails, the driver program of the WIFI module is cleared from the memory of the terminal device.

[0038] In the embodiment of the present application, whether the connection request sub-process or any one of the connection request sub-processes fails, it is necessary to clear the driver program of the WIFI module from the memory.

[0039] Taking the connection request sub-process as an example, if the framework layer does not receive a scan response returned by the hardware layer within the first preset time after initiating a scan request to the hardware layer, it is determined that the current scan request sub-process has failed, and the driver program of the WIFI module is cleared from the memory.

[0040] Of course, in actual applications, a single scan request sub-process may not necessarily be an error when the driver is loaded into the memory. It may be due to other reasons that the scan response returned by the hardware layer is not received. It can be set as follows: within the first preset time after the framework layer initiates a scan request to the hardware layer, if the scan response returned by the hardware layer is not received, the framework layer continues to initiate a scan request to the hardware layer. After the number of consecutive scan requests is greater than a certain number, it is determined that the current scan request sub-process has failed, and the driver of the WIFI module is cleared from the memory. The scan response is the information returned by the hardware layer of the WIFI system to the framework layer indicating that the scan request has been received.

[0041] Step S104, after the driver program of the WIFI module is cleared from the memory, the driver program of the WIFI module is reloaded and run.

[0042] In the embodiment of the present application, after the driver program of the WIFI module is cleared from the memory, the driver program of the WIFI module needs to be reloaded and run. In this way, the error when the driver program of the WIFI module is loaded and run last time can be eliminated by reloading and running the driver program of the WIFI module again.

[0043] As mentioned above, a daemon process can be set for the driver of the WIFI module, and the daemon process of the driver can automatically restart the driver when it is found that the driver exits abnormally. In the embodiment of the present application, the removal of the driver from the memory due to the failure of the request sub-process can be treated as the abnormal exit of the driver. Therefore, the daemon process can also trigger the reloading and running of the driver of the WIFI module after monitoring that the driver of the WIFI module is cleared from the memory.

[0044] In actual applications, if there is an abnormality in the WIFI module, long scanning requests and connection requests may cause the WIFI function to be unusable, affecting the user experience, and in severe cases may cause the terminal device to restart. The embodiment of the present application can actively and promptly try to recover after determining that the WIFI function is abnormal, such as clearing the driver from the memory, and reloading and running it, which can eliminate the error when loading and running the driver last time.

[0045] Figure 21 is a schematic diagram of an implementation flow of another exception handling method provided in an embodiment of the present application, wherein the exception handling method is applied to a terminal device including a WIFI module. As shown in the figure, the method may include the following steps:

[0046] Step S201, after receiving an instruction to enable the WIFI function of the terminal device, loading and running a driver program of the WIFI module.

[0047] Step S202: Initiate a scan request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device.

[0048] The contents of steps S201 to S202 are consistent with those of steps S101 to S102 , and the details may refer to the description of steps S101 to S102 , which will not be repeated here.

[0049] Step S203, if a scan response returned by the hardware layer is received within a first preset time after the framework layer initiates a scan request to the hardware layer, and a scan result returned by the hardware layer is not received within a second preset time after the framework layer initiates a scan request to the hardware layer, then continue to initiate a scan request sub-process through the framework layer of the WIFI system of the terminal device to the hardware layer of the WIFI system.

[0050] Step S204, after the scanning request sub-processes for sending the preset number of consecutive times all fail, the driver program of the WIFI module is cleared from the memory.

[0051] In the embodiment of the present application, the purpose of the scan request sub-process is to obtain a list of scanned wireless access points. Figure 1 In the illustrated embodiment, if the scan response returned by the hardware layer is not received, it means that the hardware layer may not have received the scan request sent by the framework layer, and the hardware layer may not scan; it may also mean that an error occurs in the communication between the hardware layer and the framework layer, resulting in the inability of the framework layer and the hardware layer to communicate normally, resulting in the inability to return the scan result to the framework layer even after the hardware layer scans the wireless access point. Therefore, if the scan response returned by the hardware layer is not received within the first preset time after the framework layer initiates a scan request to the hardware layer, it means that the scan request sub-process has failed; even if the scan response returned by the hardware layer is received within the first preset time after the framework layer initiates a scan request to the hardware layer, but the scan result returned by the hardware layer is not received within the second preset time after the framework layer initiates a scan request to the hardware layer, it also means that the current scan request sub-process has failed. Only when the list of scanned wireless access points, that is, the scan result, can be obtained, it means that the scan request sub-process is successful.

[0052] In actual applications, whether the scan response is not received or the scan result is not received, it may be caused by an occasional exception, and does not mean that an error occurs in the memory of the terminal device when loading and running the driver. Therefore, if the scan response returned by the hardware layer is received within a first preset time after the framework layer initiates a scan request to the hardware layer, and the scan result returned by the hardware layer is not received within a second preset time after the framework layer initiates a scan request to the hardware layer, the framework layer of the WIFI system of the terminal device continues to initiate a scan request sub-process to the hardware layer of the WIFI system until the scan request sub-process fails for consecutive times, and the driver of the WIFI module is cleared from the memory.

[0053] It should be noted that when the scanning sub-process is re-initiated, the scanning request sub-process may be allowed to be sent continuously for a preset number of times until all the scanning request sub-processes sent continuously for the preset number of times fail. When any scanning request sub-process succeeds, the connection request sub-process may be entered.

[0054] As another embodiment of the present application, if a scan response returned by the hardware layer is received within a first preset time after the framework layer initiates a scan request to the hardware layer, and a scan result returned by the hardware layer is not received within a third preset time after receiving the scan response, it is determined that the current scan request sub-process has failed, and the driver program of the WIFI module is cleared from the memory.

[0055] In an embodiment of the present application, a second preset time can be set, and the starting point of the second preset time is the time when the framework layer initiates a scan request to the hardware layer. A third preset time can also be set, and the starting point of the third preset time is the time when the scan response is received.

[0056] Step S205, after the driver program of the WIFI module is cleared from the memory, the driver program of the WIFI module is reloaded and run.

[0057] This step is consistent with the content of step S104. Please refer to the description of step S104 for details, which will not be repeated here.

[0058] Figure 3 1 is a schematic diagram of an implementation flow of another exception handling method provided in an embodiment of the present application, wherein the exception handling method is applied to a terminal device including a WIFI module. As shown in the figure, the method may include the following steps:

[0059] Step S301, after receiving an instruction to enable the WIFI function of the terminal device, loading and running a driver program of the WIFI module.

[0060] Step S302, initiating a scan request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device;

[0061] Step S303, after the scan request sub-process is successful, a connection request sub-process is initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device.

[0062] Step S304, after the framework layer initiates a connection request to the hardware layer, it is determined whether the current connection request is the first connection request after the WIFI function is enabled this time.

[0063] Step S305, if it is the first connection request, then record the current time as the time of initiating the connection request this time, and monitor the status of the hardware layer;

[0064] Step S306: If it is not the first connection request, determine whether the time interval between the current time and the time when the connection request was last initiated is less than a preset time interval.

[0065] Step S307: If the time interval between the current time and the time when the connection request was initiated last time is less than the preset time interval, the current time is recorded as the time when the connection request is initiated this time, and the status of the hardware layer is monitored.

[0066] Step S308: If it is detected that the state of the hardware layer is a preset state, it is determined that the connection request sub-process fails, and the driver program of the WIFI module is cleared from the memory.

[0067] Step S309: after the driver program of the WIFI module is cleared from the memory, the driver program of the WIFI module is reloaded and run.

[0068] In an embodiment of the present application, after the scan request sub-process succeeds, the connection request sub-process continues to be executed. When executing the connection request sub-process, the driver of the WIFI module can be cleared from the memory after a connection request sub-process fails, and after the driver of the WIFI module is cleared from the memory, the driver of the WIFI module is reloaded and run. That is, the scan request sub-process and the connection request sub-process are re-performed; in order to avoid the failure of the first connection request sub-process caused by an abnormality in a single connection process, the connection request sub-process can also be performed again after the failure of the first connection request sub-process. If multiple connection request sub-processes fail, the driver of the WIFI module can be cleared from the memory, and after the driver of the WIFI module is cleared from the memory, the driver of the WIFI module is reloaded and run. The scan request sub-process and the connection request sub-process are re-performed in sequence.

[0069] In the embodiment of the present application, steps S304 to S309 are described as follows: after each connection request is issued, if the state of the hardware layer is detected to be a preset state, the connection request sub-process is determined to have failed, and the driver program of the WIFI module is cleared from the memory. That is, no matter how many times the connection request sub-process is performed, as long as the state of the hardware layer is detected to be a preset state, the driver program of the WIFI module is cleared from the memory, and the driver program is reloaded and run.

[0070] If the scan request sub-process and the connection request sub-process are executed in a loop according to the description of step S304 and step S309, the termination condition can be set as follows: if in any connection sub-process, after the framework layer initiates a connection request to the hardware layer, it is determined whether the time interval between the current time and the time when the connection request was last initiated is less than the preset time interval. If the time interval between the current time and the time when the connection request was last initiated is greater than or equal to the preset time interval, it indicates that there may be an abnormality in the hardware layer, and there is no need to keep clearing, loading and running the driver in the memory, and the WIFI function of the terminal device can be turned off.

[0071] Of course, in actual applications, other termination conditions may also be set: if the WIFI module fails to connect to the wireless access point within a fourth preset time after the instruction to turn on the WIFI function of the terminal device, the WIFI function of the terminal device is turned off.

[0072] As another embodiment of the present application, monitoring the status of the hardware layer includes:

[0073] If the state of the hardware layer is in switching, waiting for the switching result;

[0074] If the state switching of the hardware layer is completed, the monitored state of the hardware layer is the switching result.

[0075] In the embodiment of the present application, the framework layer and the hardware layer (bottom chip side or supplicant) need to maintain the same state to process a message together, and the state of the hardware layer can be connected or blank. If it is connected, it means that the wireless access point is connected, and if it is blank, it means that the wireless access point is not connected. Of course, the state of the hardware layer can also be in switching. If the current state of the hardware layer is still in switching, the current message is only pengding for a while, which does not mean that there is an abnormality at present, and you can wait for the switching result; the preset state represents a blank state.

[0076] As another embodiment of the present application, before clearing the driver of the WIFI module from the memory, the method further includes:

[0077] Opening a virtual operating environment, and running the driver of the WIFI module currently loaded in the memory in the virtual operating environment;

[0078] If the driver program of the WIFI module fails to run in the virtual running environment, the driver program of the WIFI module is cleared from the memory.

[0079] In an embodiment of the present application, before clearing the driver program of the WIFI module from the memory each time, it can be determined whether there is an abnormality in the driver program currently loaded and running in the memory. If there is indeed an abnormality in the driver program currently loaded and running, the driver program can be cleared from the memory, and the driver program can be reloaded and run. If there is no abnormality in the driver program currently loaded and running, it is obviously meaningless to clear it from the memory and then reload and run the driver program. Therefore, a virtual operating environment can be started, and the driver program of the WIFI module currently loaded in the memory can be run in the virtual operating environment; if the driver program of the WIFI module fails to run in the virtual operating environment, it means that there is indeed an abnormality in the driver program currently loaded and running in the memory, and the driver program of the WIFI module is cleared from the memory.

[0080] As another embodiment of the present application, if the driver program of the WIFI module runs successfully in the virtual operating environment, the driver program of the WIFI module is re-run, and at least one request sub-process is re-initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device.

[0081] If the driver program of the WIFI module runs successfully in the virtual operating environment, it means that there is no abnormality in the driver program currently loaded in the memory, which may be caused by some reasons during the running process. There is no need to clear and reload the driver program in the memory, but it is necessary to re-run the driver program of the WIFI module and re-initiate at least one request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device.

[0082] Before starting the virtual operating environment, the method further includes: presetting the virtual operating environment. The setting of the virtual operating environment includes:

[0083] In the virtual operating environment, a virtual WIFI module is set based on the hardware parameters of the WIFI module;

[0084] Based on the data interaction between the framework layer and the hardware layer, response information is set for the virtual WIFI module.

[0085] As another embodiment of the present application, after initiating at least one request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device, it also includes:

[0086] If all request sub-processes are successful, the network is accessed through the wireless access point requested for connection in the connection request sub-process.

[0087] In the embodiment of the present application, the success of all request sub-processes indicates that the scanning request sub-process and the connection request sub-process are both successful, which means that a wireless access point has been connected, and the Internet can be accessed through the wireless access point requested to be connected in the connection request sub-process.

[0088] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0089] Figure 4 This is a schematic block diagram of a terminal device provided in an embodiment of the present application. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0090] The terminal device 4 may be a software unit, a hardware unit or a combination of software and hardware built into a mobile phone, a tablet computer, a notebook or other terminal device, or may be integrated into the mobile phone, a tablet computer, a notebook or other terminal device as an independent accessory.

[0091] The terminal device 4 includes:

[0092] A loading and running unit 41 is used to load and run the driver of the WIFI module after receiving an instruction to enable the WIFI function of the terminal device;

[0093] A request sub-process initiating unit 42, configured to initiate at least one request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device;

[0094] A clearing unit 43, configured to clear the driver program of the WIFI module from the memory of the terminal device if any request sub-process fails;

[0095] The reloading and running unit 44 is used to reload and run the driver program of the WIFI module after the driver program of the WIFI module is cleared from the memory.

[0096] As another embodiment of the present application, the request sub-process includes: a scan request sub-process and a connection request sub-process.

[0097] As another embodiment of the present application, the request sub-process initiating unit 42 includes:

[0098] The scanning sub-process module 421 is used to initiate a scanning request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device;

[0099] The connection sub-process module 422 is used to initiate a connection request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device after the scan request sub-process is successful.

[0100] As another embodiment of the present application, when a scan request sub-process is initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device, the clearing unit 43 is further used to:

[0101] If the scanning response returned by the hardware layer is not received within a first preset time after the framework layer initiates the scanning request to the hardware layer, it is determined that the current scanning request sub-process fails, and the driver program of the WIFI module is cleared from the memory.

[0102] As another embodiment of the present application, when a scan request sub-process is initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device, the clearing unit 43 is further used to:

[0103] If a scan response returned by the hardware layer is received within a first preset time after the framework layer initiates a scan request to the hardware layer, and a scan result returned by the hardware layer is not received within a second preset time after the framework layer initiates a scan request to the hardware layer, it is determined that the current scan request sub-process has failed, and the driver program of the WIFI module is cleared from the memory.

[0104] As another embodiment of the present application, when a scan request sub-process is initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device, the clearing unit 43 is further used to:

[0105] If a scan response returned by the hardware layer is received within a first preset time after the framework layer initiates a scan request to the hardware layer, and a scan result returned by the hardware layer is not received within a third preset time after receiving the scan response, it is determined that the current scan request sub-process has failed, and the driver program of the WIFI module is cleared from the memory.

[0106] As another embodiment of the present application, the scanning sub-process module 421 is further used for:

[0107] Before clearing the driver program of the WIFI module from the memory, continue to initiate a scan request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device until the scan request sub-process fails after sending a preset number of consecutive times.

[0108] As another embodiment of the present application, when a connection request sub-process is initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device, the clearing unit 43 is further used to:

[0109] After the framework layer initiates a connection request to the hardware layer, determining whether the current connection request is a first connection request;

[0110] If it is the first connection request, the current time is recorded as the time of initiating the connection request, and the status of the hardware layer is monitored;

[0111] If it is monitored that the state of the hardware layer is a preset state, it is determined that the connection request sub-process fails, and the driver program of the WIFI module is cleared from the memory.

[0112] As another embodiment of the present application, when a connection request sub-process is initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device, the clearing unit 43 is further used to:

[0113] If it is not the first connection request, determining whether the time interval between the current time and the time when the connection request was last initiated is less than a preset time interval;

[0114] If the time interval between the current time and the time when the connection request was last initiated is less than the preset time interval, the current time is recorded as the time when the connection request is initiated this time, and the status of the hardware layer is monitored;

[0115] If it is monitored that the state of the hardware layer is a preset state, it is determined that the connection request sub-process fails, and the driver program of the WIFI module is cleared from the memory.

[0116] As another embodiment of the present application, the clearing unit 43 is further used for:

[0117] If the state of the hardware layer is in switching, waiting for the switching result;

[0118] If the state switching of the hardware layer is completed, the monitored state of the hardware layer is the switching result.

[0119] As another embodiment of the present application, the terminal device 4 further includes:

[0120] A daemon process setting unit 45, used to set a daemon process for the driver of the WIFI module;

[0121] The daemon process is started after detecting that the driver program of the WIFI module is running;

[0122] The daemon process triggers reloading of the driver program of the WIFI module after monitoring that the driver program of the WIFI module has been cleared from the memory.

[0123] As another embodiment of the present application, the reloading operation unit 44 is further configured to:

[0124] The daemon process triggers reloading and running of the driver program of the WIFI module after monitoring that the driver program of the WIFI module has been cleared from the memory.

[0125] As another embodiment of the present application, the terminal device 4 further includes:

[0126] A virtual operation unit 46, used for opening a virtual operation environment before clearing the driver program of the WIFI module from the memory, and running the driver program of the WIFI module currently loaded in the memory in the virtual operation environment;

[0127] The clearing unit 43 is configured to clear the driver program of the WIFI module from the memory if the driver program of the WIFI module fails to run in the virtual running environment.

[0128] As another embodiment of the present application, the reloading operation unit 44 is further configured to:

[0129] After running the driver program of the WIFI module currently loaded in the memory in the virtual operating environment, if the driver program of the WIFI module runs successfully in the virtual operating environment, the driver program of the WIFI module is re-run, and at least one request sub-process is re-initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device.

[0130] As another embodiment of the present application, the terminal device 4 further includes:

[0131] A virtual environment setting unit, used to set a virtual WIFI module in a virtual operating environment based on the hardware parameters of the WIFI module;

[0132] Based on the data interaction between the framework layer and the hardware layer, response information is set for the virtual WIFI module.

[0133] As another embodiment of the present application, the terminal device 4 further includes:

[0134] The WIFI shut-down unit is used to shut down the WIFI function of the terminal device if the WIFI module fails to connect to the wireless access point within a fourth preset time after the instruction to turn on the WIFI function of the terminal device.

[0135] As another embodiment of the present application, the terminal device 4 further includes:

[0136] The Internet access service unit is used to access the Internet through the wireless access point requested for connection in the connection request sub-process if all request sub-processes are successful.

[0137] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the terminal device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned terminal device can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0138] Figure 5 is a schematic block diagram of a terminal device provided by another embodiment of the present application. Figure 5 As shown, the terminal device 5 of this embodiment includes: one or more processors 50, a memory 51, and a computer program 52 stored in the memory 51 and executable on the processor 50. When the processor 50 executes the computer program 52, the steps in the above-mentioned various method embodiments are implemented, for example Figure 1 Alternatively, when the processor 50 executes the computer program 52, the functions of each module / unit in the above terminal device embodiment are realized, for example Figure 4 The functions of the modules 41 to 44 are shown.

[0139] Exemplarily, the computer program 52 may be divided into one or more modules / units, which are stored in the memory 51 and executed by the processor 50 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 52 in the terminal device 5. For example, the computer program 52 may be divided into a loading and running unit, a request sub-process initiation unit, a clearing unit, and a reloading and running unit. Exemplarily:

[0140] A loading and running unit, configured to load and run a driver program of the WIFI module after receiving an instruction to enable the WIFI function of the terminal device;

[0141] A request sub-process initiating unit, configured to initiate at least one request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device;

[0142] A clearing unit, used for clearing the driver program of the WIFI module from the memory if any request sub-process fails;

[0143] The reloading and running unit is used to reload and run the driver program of the WIFI module after the driver program of the WIFI module is cleared from the memory.

[0144] Other units or modules can refer to Figure 4 The description in the illustrated embodiment will not be repeated here.

[0145] The terminal device includes but is not limited to a processor 50 and a memory 51. Those skilled in the art will understand that Figure 5 It is only an example of the terminal device 5 and does not constitute a limitation of the terminal device 5. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include an input device, an output device, a network access device, a bus, a touch screen, etc.

[0146] The processor 50 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0147] The memory 51 may be an internal storage unit of the terminal device 5, such as a hard disk or memory of the terminal device 5. The memory 51 may also be an external storage device of the terminal device 5, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 5. Further, the memory 51 may also include both an internal storage unit and an external storage device of the terminal device 5. The memory 51 is used to store the computer program and other programs and data required by the terminal device. The memory 51 may also be used to temporarily store data that has been output or is to be output.

[0148] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0149] In the embodiments provided in the present application, it should be understood that the disclosed terminal devices and methods can be implemented in other ways. For example, the terminal device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0150] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0151] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0152] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.

[0153] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0154] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. An exception handling method, characterized in that: Applied to a terminal device including a WIFI module, the method comprises: After receiving an instruction to enable the WIFI function of the terminal device, loading and running a driver program of the WIFI module; Initiate at least one request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device; If any request sub-process fails, clearing the driver of the WIFI module from the memory of the terminal device; After the driver program of the WIFI module is cleared from the memory, the driver program of the WIFI module is reloaded and run.

2. The exception handling method according to claim 1, characterized in that: The request sub-process includes: Scan request subprocess and connection request subprocess.

3. The exception handling method according to claim 2, characterized in that: The sub-process of initiating at least one request to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device comprises: Initiate a scan request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device; After the scan request sub-process is successful, a connection request sub-process is initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device.

4. The exception handling method according to claim 2, characterized in that: When a scan request sub-process is initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device, if any request sub-process fails, clearing the driver of the WIFI module from the memory of the terminal device includes: If the scanning response returned by the hardware layer is not received within a first preset time after the framework layer initiates the scanning request to the hardware layer, it is determined that the current scanning request sub-process fails, and the driver program of the WIFI module is cleared from the memory.

5. The exception handling method according to claim 4, characterized in that: When a scan request sub-process is initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device, if any request sub-process fails, clearing the driver of the WIFI module from the memory of the terminal device includes: If a scan response returned by the hardware layer is received within a first preset time after the framework layer initiates a scan request to the hardware layer, and a scan result returned by the hardware layer is not received within a second preset time after the framework layer initiates a scan request to the hardware layer, it is determined that the current scan request sub-process has failed, and the driver program of the WIFI module is cleared from the memory.

6. The exception handling method according to claim 4, characterized in that: When a scan request sub-process is initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device, if any request sub-process fails, clearing the driver of the WIFI module from the memory of the terminal device includes: If a scan response returned by the hardware layer is received within a first preset time after the framework layer initiates a scan request to the hardware layer, and a scan result returned by the hardware layer is not received within a third preset time after receiving the scan response, it is determined that the current scan request sub-process has failed, and the driver program of the WIFI module is cleared from the memory.

7. The exception handling method according to any one of claims 5 to 6, characterized in that: Before clearing the driver of the WIFI module from the memory, the method further includes: Continue to initiate a scan request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device until the scan request sub-process fails after sending a preset number of consecutive times.

8. The exception handling method according to claim 2, characterized in that: When a connection request sub-process is initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device, if any request sub-process fails, clearing the driver of the WIFI module from the memory of the terminal device includes: After the framework layer initiates a connection request to the hardware layer, determining whether the current connection request is a first connection request; If it is the first connection request, the current time is recorded as the time of initiating the connection request, and the status of the hardware layer is monitored; If it is monitored that the state of the hardware layer is a preset state, it is determined that the connection request sub-process fails, and the driver program of the WIFI module is cleared from the memory.

9. The exception handling method according to claim 8, characterized in that: After determining whether the current connection request is the first connection request, it also includes: If it is not the first connection request, determining whether the time interval between the current time and the time when the connection request was last initiated is less than a preset time interval; If the time interval between the current time and the time when the connection request was initiated last time is less than the preset time interval, the current time is recorded as the time when the connection request is initiated this time, and the status of the hardware layer is monitored; If it is monitored that the state of the hardware layer is a preset state, it is determined that the connection request sub-process fails, and the driver program of the WIFI module is cleared from the memory.

10. The exception handling method according to any one of claims 8 or 9, characterized in that: The monitoring of the status of the hardware layer comprises: If the state of the hardware layer is in switching, waiting for the switching result; If the state switching of the hardware layer is completed, the monitored state of the hardware layer is the switching result.

11. The exception handling method according to claim 2, characterized in that: After initiating at least one request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device, the method further includes: If all request sub-processes are successful, the network is accessed through the wireless access point requested for connection in the connection request sub-process.

12. The exception handling method according to claim 1, characterized in that: After the driver program of the WIFI module is cleared from the memory, before the driver program of the WIFI module is reloaded and run, the method further includes: Setting a daemon process for the driver of the WIFI module; The daemon process is started after detecting that the driver program of the WIFI module is running; The daemon process triggers reloading of the driver program of the WIFI module after monitoring that the driver program of the WIFI module has been cleared from the memory.

13. The exception handling method according to claim 12, characterized in that: After the driver program of the WIFI module is cleared from the memory, reloading and running the driver program of the WIFI module includes: The daemon process triggers reloading and running of the driver program of the WIFI module after monitoring that the driver program of the WIFI module has been cleared from the memory.

14. The exception handling method according to claim 1, characterized in that: Before clearing the driver of the WIFI module from the memory, the method further includes: Opening a virtual operating environment, and running the driver of the WIFI module currently loaded in the memory in the virtual operating environment; If the driver program of the WIFI module fails to run in the virtual running environment, the driver program of the WIFI module is cleared from the memory.

15. The exception handling method according to claim 14, characterized in that: After the driver program of the WIFI module currently loaded in the memory is run in the virtual running environment, the method further includes: If the driver program of the WIFI module runs successfully in the virtual operating environment, the driver program of the WIFI module is re-run, and at least one request sub-process is re-initiated to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device.

16. The exception handling method according to claim 14, characterized in that: Before starting the virtual operating environment, the method further includes: In the virtual operating environment, a virtual WIFI module is set based on the hardware parameters of the WIFI module; Based on the data interaction between the framework layer and the hardware layer, response information is set for the virtual WIFI module.

17. The exception handling method according to claim 1, characterized in that: After receiving the instruction to turn on the WIFI function of the terminal device, it also includes: If the WIFI module fails to connect to the wireless access point successfully within a fourth preset time after the instruction to turn on the WIFI function of the terminal device, the WIFI function of the terminal device is turned off.

18. A terminal device, characterized in that: include: A loading and running unit, configured to load and run a driver program of a WIFI module of the terminal device after receiving an instruction to turn on the WIFI function of the terminal device; A request sub-process initiating unit, configured to initiate at least one request sub-process to the hardware layer of the WIFI system through the framework layer of the WIFI system of the terminal device; A clearing unit, configured to clear the driver program of the WIFI module from the memory of the terminal device if any request sub-process fails; The reloading and running unit is used to reload and run the driver program of the WIFI module after the driver program of the WIFI module is cleared from the memory.

19. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 17 are implemented.

20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by one or more processors, the steps of the method according to any one of claims 1 to 17 are implemented.