OTG function control processing method and device, equipment and medium
By using the distance sensing module on the OTG interface to emit light detection signals and judge light reflection signals, the problem of inaccurate identification of external devices by the OTG interface is solved, and the control accuracy and reliability of the OTG function are improved.
Patent Information
- Application Number
- CN202411368238.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-01-14
AI Technical Summary
In the prior art, the identification of the OTG interface has inaccurate access to external devices, resulting in inaccurate control of the OTG function, especially due to the easy accumulation of dust inside the hardware interface or physical damage caused by multiple plug-ins and unplugging.
The distance sensing module emits a light detection signal to the access direction of the OTG interface. In response to obtaining the light reflection signal of the light detection signal from the external device, it is determined based on the light reflection signal whether the external device meets the preset OTG interface access conditions, and Turn on the OTG function when the conditions are met.
It improves the control accuracy of the OTG function, avoids recognition errors caused by physical damage to the hardware interface, and enhances the reliability of the OTG function.
Smart Images

Figure CN119311612A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer application technology, and in particular to a control processing method, device, equipment and medium for an OTG function. Background Art
[0002] With the development of computer technology, electronic device data exchange technology (On The Go, OTG) is applied to the connection between different devices or mobile devices for data exchange. Currently, there are many types of electronic devices, such as tablet computers, mobile phones, digital cameras, camcorders, printers, etc. Different electronic devices have a variety of different standard connectors. OTG improves the inconvenience caused by data exchange between memory cards of various standards.
[0003] In the related art, the activation of the OTG function of the electronic device depends on the access to the hardware interface and the software driver identification, that is, the OTG interface is pre-set in the electronic device, and when it is detected that the OTG interface is connected to an external device, the OTG function in the electronic device is activated.
[0004] However, in actual applications, dust particles may easily accumulate inside the hardware interface or the hardware may be damaged due to repeated plugging and unplugging. Therefore, it is easy to cause inaccurate identification of whether an external device is connected based on the OTG interface, thereby causing inaccurate control of the OTG function. Summary of the invention
[0005] Based on this, it is necessary to provide a control processing method, device, equipment and medium for the OTG function that can improve the control accuracy of the OTG in response to the above technical problems.
[0006] An embodiment of the present disclosure provides a control and processing method for an OTG function, the method comprising: detecting an access status of an OTG interface in an electronic device; when the access status is not connected, emitting a light detection signal to an access direction of the OTG interface through a distance sensing module; in response to obtaining a light reflection signal of the external device to the light detection signal, determining whether the external device meets a preset OTG interface access condition according to the light reflection signal; and when the preset OTG interface access condition is met, turning on the OTG function in the electronic device.
[0007] The disclosed embodiment provides a control and processing device for an OTG function, comprising: an access detection module, used to detect the access status of an OTG interface in an electronic device; a transmitting module, used to transmit a light detection signal to the access direction of the OTG interface through a distance sensing module when the access status is not connected; an access determination module, used to determine whether the external device meets a preset OTG interface access condition according to a light reflection signal obtained from an external device to the light detection signal; and a function control module, used to enable the OTG function in the electronic device when the preset OTG interface access condition is met.
[0008] An embodiment of the present disclosure provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the control processing method of the OTG function provided by any embodiment of the present disclosure when executing the computer program.
[0009] An embodiment of the present disclosure provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the control processing method of the OTG function provided by any embodiment of the present disclosure is implemented.
[0010] The technical solution provided by the embodiments of the present disclosure is as follows:
[0011] The access state of the OTG interface in the electronic device is detected. When the access state is not connected, a light detection signal is emitted to the access direction of the OTG interface through a distance sensing module. In response to obtaining a light reflection signal of the external device to the light detection signal, it is determined according to the light reflection signal whether the external device meets the preset OTG interface access condition. When the preset OTG interface access condition is met, the OTG function in the electronic device is turned on. In this technical solution, the control accuracy of the OTG function is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 An application scenario diagram of a control processing method for an OTG function in an embodiment;
[0013] Figure 2 A pin diagram of an OTG interface according to an embodiment;
[0014] Figure 3 A schematic diagram of a control processing scenario of an OTG function according to an embodiment;
[0015] Figure 4 A schematic diagram of a control processing scenario of an OTG function according to another embodiment;
[0016] Figure 5 is a structural block diagram of a control processing device for an OTG function in one embodiment;
[0017] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the present disclosure more clear, the present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and are not used to limit the present disclosure.
[0019] The following describes the control processing method of the OTG function of the embodiment of the present disclosure with reference to the accompanying drawings. The method can be applied to the control processing device of the OTG function, such as Figure 1 As shown, the control processing method of the OTG function includes:
[0020] Step 101: Detect the access status of the OTG interface in the electronic device.
[0021] In this embodiment, it is first assumed that the detection logic of the OTG interface itself is executable to detect the access status of the OTG interface in the electronic device.
[0022] In some possible embodiments, Figure 2 As shown, the electronic device includes an ID pin associated with the OTG interface. If the OTG interface can work normally, it can detect whether the external device is connected based on the ID signal value of the ID pin of the OTG interface. If the ID signal value is not detected, it is considered that the access state of the OTG interface is not connected. Among them, VCC (power supply) pin: provides power supply voltage. GND (ground) pin: provides a ground reference point. D+ (data positive) pin: positive pole of the data signal. D- (data negative) pin: negative pole of the data signal. D+ and D- are used for data transmission. ID (identification) pin: used to identify the role type (host or slave) of data transmission.
[0023] Step 102: When the access state is not connected, a light detection signal is emitted toward the access direction of the OTG interface through the distance sensing module.
[0024] In some possible embodiments, when the access status is access, the corresponding OTG function is directly enabled.
[0025] In some possible embodiments, when the access status is not connected, in order to avoid the problem of not being able to recognize the access due to accumulation of dust particles inside the OTG interface or physical damage caused by repeated plugging and unplugging, a light detection signal is further emitted in the access direction of the OTG interface through a distance sensing module, so as to further determine whether to turn on the OTG function based on the emitted light detection signal.
[0026] It should be noted that the distance sensing module of the embodiment of the present disclosure actually detects the distance between the external device and the OTG interface through an optical signal. In different application scenarios, the distance sensing module is different. For example, the distance sensing module may be an infrared transmitting module, a composite light source transmitting module, etc., wherein the composite light source may include a variety of light source types, for example, may include A light, CWF light, D50 / D65 light, U30 light, Hz light, etc.
[0027] The access direction of the OTG interface can be understood as the direction in which the external device is connected to the OTG interface, that is, if an external device is to be connected to the corresponding OTG interface, an optical detection signal is emitted toward the access direction, and the external device can emit the optical detection signal.
[0028] For example, Figure 3 As shown, for the OTG interface of the electronic device, the distance sensing module transmits a light detection signal, and the external device can reflect the corresponding transmitted light signal back, so that the distance sensing module can receive the light reflection signal reflected by the external device.
[0029] During the actual execution process, the ambient light in the environment where the electronic device is located may interfere with the emitted light detection signal. Therefore, in order to avoid the interference of ambient light on the emitted light detection signal, in some possible embodiments, the ambient light source characteristic parameters in the ambient light signal can be extracted, wherein the ambient light source characteristic parameters include characteristic parameters such as light source intensity, band, and color temperature. The emitted light source characteristic parameters are determined according to the ambient light signal, wherein the emitted light source characteristic parameters may include light source intensity, light source band, light source color temperature, etc. According to the emitted light source characteristic parameters, a light detection signal is emitted toward the access direction of the OTG interface through the distance sensing module, wherein the light emitted according to the emitted light source characteristic parameters is less interfered by the ambient light.
[0030] In this embodiment, characteristic parameters of the ambient light source in the ambient light signal may be extracted, and the characteristic parameters of the ambient light source may be input into a preset model to obtain characteristic parameters of the emission light source output by the preset model.
[0031] The light source type of the ambient light signal can also be divided according to the experimental data into multiple types of ambient light. Then, for each type of ambient light, the characteristic parameters of the emitting light source with less interference are determined based on a large amount of sample data, and the correspondence between the ambient light type and the corresponding characteristic parameters of the emitting light source is stored. After obtaining the ambient light signal of the scene where the electronic device is currently located, the light source type corresponding to the ambient light signal is determined, and then, based on the light source type, the preset correspondence is queried to obtain the characteristic parameters of the emitting light source.
[0032] Step 103 : in response to obtaining a light reflection signal of the external device to the light detection signal, determining whether the external device meets a preset OTG interface access condition according to the light reflection signal.
[0033] It is easy to understand that if there is no external device ready to connect to the OTG interface, it is obviously impossible to obtain the optical reflection signal of the optical detection signal. Therefore, in this embodiment, in response to obtaining the optical reflection signal of the external device to the optical detection signal, it is determined whether the external device meets the preset OTG interface access conditions based on the optical reflection signal.
[0034] It should be noted that in different application scenarios, the methods for determining whether the external device meets the preset OTG interface access conditions according to the optical reflection signal are different, as shown in the following examples:
[0035] In some possible examples, the light reflection signal is collected according to a preset period, and it is determined whether the light reflection signal of a preset number of consecutive periods becomes larger, wherein after determining that the light reflection signal of a preset number of consecutive periods becomes larger, it is determined that the external device meets the preset OTG interface access condition. That is, in this embodiment, if the external device is connected to the OTG interface, the external device will get closer and closer to the OTG interface, and the closer the distance, the greater the signal value of the light reflection signal emitted by the external device, so it can be judged in advance that the external device is connected to the corresponding OTG interface.
[0036] In some possible embodiments, in order to further improve the accuracy of judgment, before determining that the external device meets the preset OTG interface access conditions, it is also necessary to determine that the signal values for a preset number of consecutive cycles are greater than the preset optical signal threshold. If they are not greater than the preset optical signal threshold, it is not considered that the preset OTG interface access conditions are met.
[0037] Of course, in one embodiment of the present disclosure, the above-mentioned judgment method based on determining whether the signal value of the optical reflection signal of a preset number of consecutive cycles becomes larger is mainly applied to the advance judgment before the OTG interface is connected. When an external device has been connected to the OTG interface, it can be directly determined that the preset OTG interface access condition is met based on the signal value of a preset number of consecutive cycles being greater than the preset optical signal threshold. That is, in this embodiment, if the signal value based on the preset number of consecutive cycles is greater than the preset optical signal threshold, it can be directly determined that the preset OTG interface access condition is met.
[0038] In some possible embodiments, the absolute value of the signal difference between the light reflection signal of each cycle and the corresponding light reflection signal can also be calculated to determine whether the absolute value decreases in multiple consecutive cycles. If it decreases, it is determined that the external device is connected to the OTG interface. The judgment method in this example can be combined with the judgment method in the above example to further improve the reliability of the judgment.
[0039] Step 104: When the preset OTG interface access condition is met, the OTG function in the electronic device is enabled.
[0040] In one embodiment of the present disclosure, when the preset OTG interface access conditions are met, the OTG function in the electronic device is turned on. Thus, even when it is detected that the OTG interface is not connected, the access of the external device can be detected based on the distance sensing module, thereby improving the control accuracy of the OTG function.
[0041] Among them, in order to improve the user experience, before turning on the OTG function in the electronic device, a notification message for turning on the OTG can also be sent. The notification message can be displayed in the electronic device in the form of a pop-up window, etc. In response to the user's confirmation operation on the notification message, the OTG function in the electronic device is turned on. Conversely, if the user's rejection operation on the notification message is obtained, the OTG function in the electronic device is not turned on.
[0042] In this embodiment, after the OTG function in the electronic device is turned on, the data transmission role type of the electronic device is also determined, that is, whether the electronic device performs data transmission as a host or as a slave. The data transmission role type can be set by default or can be set by the user on the electronic device side. When the data transmission role type is a host, the ID signal value corresponding to the ID pin corresponding to the OTG interface is switched to a first preset signal value. When the data transmission role type is a slave, the ID signal value corresponding to the ID pin corresponding to the OTG interface is switched to a second preset signal value, wherein the first preset signal value is less than the second preset signal value, that is, the first preset signal value is a low value, and the second preset signal value is a high value. In this embodiment, if the electronic device acts as a host, the ID pin is pulled low, and if the electronic device acts as a slave, the ID pin is pulled high.
[0043] In some possible embodiments, Figure 4 As shown, the ID pin of the electronic device can also be directly connected to the distance sensing module in the electronic device for communication. When an external device is connected through the distance sensing module, a control signal is directly sent to the ID pin. For example, the electronic device is set as the host by default, and a control signal carrying a first preset signal value is sent to the ID pin, so that the ID pin switches the signal value to the first preset signal value. At this time, it is detected that the OTG interface is in an access state.
[0044] In this embodiment, continue to refer to Figure 4Similarly, the ID pin of the external device can also be communicatively connected to the distance sensing module in the external device. When the external device is connected through the distance sensing module, a control signal is directly sent to the ID pin. For example, if the external device is a slave by default, a control signal carrying a second preset signal value is sent to the ID pin, so that the ID pin switches the signal value to the second preset signal value.
[0045] Furthermore, after turning on the OTG function in the electronic device, a light detection signal can be further emitted in the access direction of the OTG interface through the distance sensing module. In response to obtaining a light reflection signal of the external device to the light detection signal, it is determined whether the external device meets the preset OTG interface access conditions based on the light reflection signal. If the preset OTG interface access conditions are not met, the OTG function in the electronic device is turned off.
[0046] It should be emphasized that the access judgment method based on optical signals is less susceptible to interference than other signal detection methods. For example, if the proximity status of the target device is obtained based on the Hall element, it relies on the Hall sensor to detect the target magnetic field strength. When the target magnetic field strength meets the preset magnetic field threshold, it is confirmed that the external device with magnetic properties is approaching. However, many magnetic devices (including cameras, speakers, receivers, MICs, etc.) are currently used in electronic devices, and magnetic scenes such as magnetic charging are involved. In addition, users will be exposed to magnetic devices and environments in their daily life environment. When the magnetic field of the electronic device itself changes or the environmental magnetic field changes to the preset magnetic field threshold, it will cause the device with Hall elements to falsely trigger the recognition or the user-side to perceive repeated false reminders of approaching or moving away, affecting the user's actual experience.
[0047] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but the steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of the steps, and the steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0048] In summary, the control processing method of the OTG function of the embodiment of the present disclosure detects the access status of the OTG interface in the electronic device. When the access status is not connected, a light detection signal is emitted to the access direction of the OTG interface through the distance sensing module. In response to obtaining a light reflection signal of the external device to the light detection signal, it is determined according to the light reflection signal whether the external device meets the preset OTG interface access condition. When the preset OTG interface access condition is met, the OTG function in the electronic device is turned on. In this technical solution, the control accuracy of the OTG function is improved.
[0049] In order to implement the above embodiments, the present disclosure also proposes a control processing device for an OTG function. Figure 5 FIG. 1 is a schematic diagram of a control processing device for an OTG function according to an embodiment of the present disclosure. Figure 5 As shown, the device includes: an access detection module 510, a transmission module 520, an access determination module 530, and a function control module 540, wherein:
[0050] An access detection module 510 is used to detect the access status of the OTG interface in the electronic device;
[0051] The transmitting module 520 is used to transmit an optical detection signal to the access direction of the OTG interface through the distance sensing module when the access state is not connected;
[0052] An access determination module 530 is used to determine whether the external device meets a preset OTG interface access condition according to the optical reflection signal in response to obtaining an optical reflection signal of the external device to the optical detection signal;
[0053] The function control module 540 is used to enable the OTG function in the electronic device when the preset OTG interface access condition is met.
[0054] In one embodiment, the function control module 540 is further configured to:
[0055] When the access status is accessed, the OTG function in the electronic device is turned on.
[0056] In one embodiment, the transmitting module 520 is specifically configured to:
[0057] Identify the ambient light signal of the scene where the electronic device is currently located;
[0058] Determine characteristic parameters of the emitting light source according to the ambient light signal;
[0059] According to the characteristic parameters of the transmitting light source, an optical detection signal is transmitted toward the access direction of the OTG interface through the distance sensing module.
[0060] In one embodiment, the transmitting module 520 is specifically configured to:
[0061] Extracting characteristic parameters of ambient light source from ambient light signal;
[0062] The characteristic parameters of the ambient light source are input into the preset model to obtain the characteristic parameters of the emitted light source output by the preset model.
[0063] In one embodiment, the access determination module 530 is specifically configured to:
[0064] Determining whether the signal value of the light reflection signal increases for a consecutive preset number of cycles;
[0065] If the signal value increases for a preset number of consecutive cycles, it is determined that the external device meets the preset OTG interface access condition.
[0066] In one embodiment, the access determination module 530 is further configured to:
[0067] It is determined that the signal values of a preset number of consecutive cycles are all greater than a preset optical signal threshold.
[0068] In one embodiment, the invention further comprises: a pin control module, which is used to:
[0069] Determine the data transmission role type of the electronic device;
[0070] When the data transmission role type is a host, the ID signal value corresponding to the ID pin corresponding to the OTG interface is switched to a first preset signal value;
[0071] When the data transmission role type is a slave, the ID signal value corresponding to the ID pin corresponding to the OTG interface is switched to a second preset signal value, wherein the first preset signal value is smaller than the second preset signal value.
[0072] For the specific definition of the control processing device of the OTG function, please refer to the definition of the control processing method of the OTG function in the above text, which will not be repeated here. Each module in the control processing device of the above OTG function can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0073] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store relevant data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a control processing method of an OTG function is implemented.
[0074] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a control processing method for an OTG function is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse, etc.
[0075] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present disclosure, and does not constitute a limitation on the computer device to which the scheme of the present disclosure is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0076] In one embodiment, the control processing device of the OTG function provided by the present disclosure can be implemented in the form of a computer program. The computer program can be Figure 6 The computer device shown in the figure is run on the computer device. The memory of the computer device can store various program modules constituting the control processing device of the OTG function, such as: Figure 5The computer program composed of the various program modules enables the processor to execute the steps of the control processing method of the OTG function of each embodiment of the present disclosure described in this specification.
[0077] For example, Figure 6 The computer device shown can be Figure 5 The access detection module shown executes the steps of: detecting the access status of the OTG interface in the electronic device. The computer device can execute the steps of: when the access status is not connected, transmitting the light detection signal to the access direction of the OTG interface through the distance sensing module. The computer device can execute the steps of: in response to obtaining the light reflection signal of the external device to the light detection signal, determining whether the external device meets the preset OTG interface access condition according to the light reflection signal through the access determination module, and the computer device can execute the steps of: when the preset OTG interface access condition is met, turning on the OTG function in the electronic device.
[0078] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0079] Detecting the access status of the OTG interface in the electronic device;
[0080] When the access state is not connected, an optical detection signal is emitted in the access direction of the OTG interface through the distance sensing module;
[0081] In response to obtaining a light reflection signal of the external device to the light detection signal, determining whether the external device meets a preset OTG interface access condition according to the light reflection signal;
[0082] When the preset OTG interface access conditions are met, the OTG function in the electronic device is turned on.
[0083] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0084] Detecting the access status of the OTG interface in the electronic device;
[0085] When the access state is not connected, an optical detection signal is emitted toward the access direction of the OTG interface through the distance sensing module;
[0086] In response to obtaining a light reflection signal of the external device to the light detection signal, determining whether the external device meets a preset OTG interface access condition according to the light reflection signal;
[0087] When the preset OTG interface access conditions are met, the OTG function in the electronic device is turned on.
[0088] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0089] Detecting the access status of the OTG interface in the electronic device;
[0090] When the access state is not connected, an optical detection signal is emitted in the access direction of the OTG interface through the distance sensing module;
[0091] In response to obtaining a light reflection signal of the external device to the light detection signal, determining whether the external device meets a preset OTG interface access condition according to the light reflection signal;
[0092] When the preset OTG interface access conditions are met, the OTG function in the electronic device is turned on.
[0093] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0094] Detecting the access status of the OTG interface in the electronic device;
[0095] When the access state is not connected, an optical detection signal is emitted in the access direction of the OTG interface through the distance sensing module;
[0096] In response to obtaining a light reflection signal of the external device to the light detection signal, determining whether the external device meets a preset OTG interface access condition according to the light reflection signal;
[0097] When the preset OTG interface access conditions are met, the OTG function in the electronic device is turned on.
[0098] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided by the present disclosure can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in various forms, such as static random access memory (SRAM) and dynamic random access memory (DRAM).
[0099] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0100] The above-mentioned embodiments only express several implementation methods of the present disclosure, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present disclosure, and these all belong to the protection scope of the present disclosure. Therefore, the protection scope of the patent of the present disclosure shall be subject to the attached claims.
Claims
1. A control processing method for an OTG function, characterized in that: The method comprises: Detecting the access status of the OTG interface in the electronic device; When the access state is not connected, an optical detection signal is emitted toward the access direction of the OTG interface through a distance sensing module; In response to obtaining a light reflection signal of the external device to the light detection signal, determining whether the external device meets a preset OTG interface access condition according to the light reflection signal; When the preset OTG interface access condition is met, the OTG function in the electronic device is enabled.
2. The method according to claim 1, characterized in that After detecting the access status of the OTG interface in the electronic device, the method further comprises: When the access state is access, the OTG function in the electronic device is enabled.
3. The method according to claim 1, characterized in that The transmitting of the optical detection signal to the access direction of the OTG interface through the distance sensing module includes: Identify an ambient light signal of a scene in which the electronic device is currently located; Determine characteristic parameters of the emitting light source according to the ambient light signal; According to the characteristic parameters of the emitting light source, an optical detection signal is emitted toward the access direction of the OTG interface through a distance sensing module.
4. The method according to claim 3, characterized in that The step of acquiring characteristic parameters of an emitting light source according to the ambient light signal comprises: Extracting characteristic parameters of the ambient light source from the ambient light signal; The characteristic parameters of the ambient light source are input into a preset model to obtain the characteristic parameters of the emitting light source output by the preset model.
5. The method according to claim 1, characterized in that The determining, according to the optical reflection signal, whether the external device meets a preset OTG interface access condition includes: Determining whether the signal value of the light reflection signal increases for a consecutive preset number of cycles; If the signal value increases for the preset number of consecutive cycles, it is determined that the external device meets the preset OTG interface access condition.
6. The method according to claim 5, characterized in that Before determining that the external device meets the preset OTG interface access condition, the method further includes: It is determined that the signal values of the consecutive preset number of periods are all greater than a preset optical signal threshold.
7. The method according to any one of claims 1 to 6, characterized in that: After the OTG function in the electronic device is turned on, the method further includes: Determining a data transmission role type of the electronic device; When the data transmission role type is a host, the ID signal value corresponding to the ID pin corresponding to the OTG interface is switched to a first preset signal value; When the data transmission role type is a slave, the ID signal value corresponding to the ID pin corresponding to the OTG interface is switched to a second preset signal value, wherein the first preset signal value is smaller than the second preset signal value.
8. A control processing device for an OTG function, characterized in that: include: An access detection module is used to detect the access status of the OTG interface in the electronic device; A transmitting module, used for transmitting a light detection signal to the access direction of the OTG interface through a distance sensing module when the access state is not accessed; an access determination module, configured to determine whether the external device meets a preset OTG interface access condition according to the optical reflection signal obtained by the external device in response to the optical detection signal; The function control module is used to enable the OTG function in the electronic device when the preset OTG interface access condition is met.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.