CN113030794A - Device detection method and device, computer readable medium and electronic device - Google Patents

Device detection method and device, computer readable medium and electronic device Download PDF

Info

Publication number
CN113030794A
CN113030794A CN202110232047.0A CN202110232047A CN113030794A CN 113030794 A CN113030794 A CN 113030794A CN 202110232047 A CN202110232047 A CN 202110232047A CN 113030794 A CN113030794 A CN 113030794A
Authority
CN
China
Prior art keywords
state
cid
mode
interface
type
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110232047.0A
Other languages
Chinese (zh)
Other versions
CN113030794B (en
Inventor
李志杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202110232047.0A priority Critical patent/CN113030794B/en
Publication of CN113030794A publication Critical patent/CN113030794A/en
Application granted granted Critical
Publication of CN113030794B publication Critical patent/CN113030794B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R31/00Arrangements for testing electric properties; Arrangements for locating electric faults; Arrangements for electrical testing characterised by what is being tested not provided for elsewhere
    • G01R31/50Testing of electric apparatus, lines, cables or components for short-circuits, continuity, leakage current or incorrect line connections
    • G01R31/66Testing of connections, e.g. of plugs or non-disconnectable joints
    • G01R31/68Testing of releasable connections, e.g. of terminals mounted on a printed circuit board
    • G01R31/69Testing of releasable connections, e.g. of terminals mounted on a printed circuit board of terminals at the end of a cable or a wire harness; of plugs; of sockets, e.g. wall sockets or power sockets in appliances

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)

Abstract

The disclosure provides a device detection method, a device detection apparatus, a computer readable medium and an electronic device, and relates to the technical field of type-c transmission. The method comprises the following steps: responding to interrupt triggering of the terminal equipment charger input detection CID, and reading CID state data; the CID state data comprises a first state of the CID before the interrupt trigger and a second state of the CID after the interrupt trigger; and when the first state is different from the second state and the second state is the pull-out state, adjusting the connection mode of the type-c interface into an uplink port mode. The method and the device can avoid the periodic square waves output between the CC interfaces in the DPR mode, further reduce power consumption, and avoid the conditions of interface corrosion, electric leakage and the like.

Description

Device detection method and device, computer readable medium and electronic device
Technical Field
The present disclosure relates to the field of type-c transmission technologies, and in particular, to an apparatus detection method, an apparatus detection device, a computer-readable medium, and an electronic apparatus.
Background
The Type-C interface is a new transmission interface which is generated in recent years, named primitive is a USB (Universal Serial Bus) Type-C connector, has the advantages of high transmission efficiency, high transmission speed and the like, and is an aggregate integrating functions of transmitting data, charging, serving as a video output port and the like. Meanwhile, the type-c interface does not need to distinguish between positive and negative as the traditional interface and supports positive and negative insertion, so that the type-c interface is widely used.
Since a type-c interfacing device involves two roles, i.e., sink device or source device, it is usually necessary to configure the type-c interface into a dual role port mode (DPR). In the DPR mode, a CC pin of a type-c interface outputs periodic square waves so as to judge the type of the connected equipment. However, when the type-c interface is not connected to a device, such periodic square wave output may cause system power consumption of the device where the type-c interface is located; meanwhile, in the case that the type-c interface is electrified for a long time, interface corrosion, electric leakage and the like may occur.
Disclosure of Invention
The present disclosure is directed to a device detection method, a device detection apparatus, a computer-readable medium, and an electronic device, so as to reduce power consumption at least to some extent and avoid interface corrosion, electrical leakage, and the like.
According to a first aspect of the present disclosure, there is provided a device detection method applied to a digital signal processor of a terminal device configured with a type-c interface, the method including: responding to interrupt triggering of the terminal equipment charger input detection CID, and reading CID state data; the CID state data comprises a first state of the CID before the interrupt trigger and a second state of the CID after the interrupt trigger; and when the first state is different from the second state and the second state is the pull-out state, adjusting the connection mode of the type-c interface into an uplink port mode.
According to a second aspect of the present disclosure, there is provided a device detection apparatus applied to a digital signal processor of a terminal device configured with a type-c interface, the apparatus including: the state acquisition module is used for responding to interrupt triggering of the terminal equipment charger input detection CID and reading CID state data; the CID state data comprises a first state of the CID before the interrupt trigger and a second state of the CID after the interrupt trigger; and the mode adjusting module is used for adjusting the connection mode of the type-c interface into an uplink port mode when the first state is different from the second state and the second state is the pull-out state.
According to a third aspect of the present disclosure, a computer-readable medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, is adapted to carry out the above-mentioned method.
According to a fourth aspect of the present disclosure, there is provided an electronic apparatus, comprising: a processor; and memory storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the above-described method.
According to the equipment detection method provided by the embodiment of the disclosure, the CID is detected by inputting the charger to the terminal equipment, and when the CID of the terminal equipment is interrupted and triggered, the connection mode of the type-c interface is adjusted according to the CID state data. When the first state of the CID before the interrupt trigger is different from the second state of the CID after the interrupt trigger, indicating that the plugging and unplugging behavior of the connection interface occurs. And when the second state of the CID is a pull-out state after the interrupt trigger, namely when the current type-c interface is not connected with other equipment, the connection mode of the type-c interface is adjusted to an uplink port mode, so that the periodic square waves output between the CC interfaces in the DPR mode can be avoided, the power consumption is further reduced, and the situations of interface corrosion, electric leakage and the like are avoided.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty. In the drawings:
FIG. 1 illustrates a schematic diagram of an exemplary system architecture to which embodiments of the present disclosure may be applied;
FIG. 2 shows a schematic diagram of an electronic device to which embodiments of the present disclosure may be applied;
FIG. 3 schematically illustrates a pin diagram of a Type-C interface;
FIG. 4 is a schematic diagram illustrating a CC pin of a Type-C interface when a mobile phone is connected to a USB flash disk;
FIG. 5 schematically illustrates a flow chart of a device detection method in an exemplary embodiment of the disclosure;
FIG. 6 schematically illustrates a schematic diagram of an integrated insertion detection and power module in an exemplary embodiment of the disclosure;
FIG. 7 schematically illustrates a flow chart of another method of device detection in an exemplary embodiment of the disclosure;
fig. 8 schematically illustrates a composition diagram of an apparatus detection device in an exemplary embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
Fig. 1 is a schematic diagram illustrating a system architecture of an exemplary application environment to which a device detection method and apparatus according to an embodiment of the present disclosure may be applied.
As shown in fig. 1, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few. The terminal devices 101, 102, 103 may be various terminal devices configured with a type-c interface, including but not limited to smart phones, tablet computers, desktop computers, portable computers, and the like. It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation. For example, server 105 may be a server cluster comprised of multiple servers, or the like.
The device detection method provided by the embodiment of the present disclosure is generally executed by the terminal devices 101, 102, and 103, and accordingly, the device detection apparatus is generally disposed in the terminal devices 101, 102, and 103. However, it is easily understood by those skilled in the art that the device detection method provided in the embodiment of the present disclosure may also be executed by the server 105, and accordingly, the device detection apparatus may also be disposed in the server 105, which is not particularly limited in the exemplary embodiment. For example, in an exemplary embodiment, a type-c interface may be configured on the server 105, and further according to the device detection method provided by the embodiment of the present disclosure, device detection is performed based on the type-c interface.
The exemplary embodiments of the present disclosure provide an electronic device for implementing the device detection method, which may be the terminal device 101, 102, 103 or the server 105 in fig. 1. The electronic device comprises at least a processor and a memory for storing executable instructions of the processor, the digital signal processor in the processor being configured to perform the device detection method via execution of the executable instructions.
The following takes the mobile terminal 200 in fig. 2 as an example, and exemplifies the configuration of the electronic device. It will be appreciated by those skilled in the art that the configuration of figure 2 can also be applied to fixed type devices, in addition to components specifically intended for mobile purposes. In other embodiments, mobile terminal 200 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware. The interfacing relationship between the components is only schematically illustrated and does not constitute a structural limitation of the mobile terminal 200. In other embodiments, the mobile terminal 200 may also interface differently than shown in fig. 2, or a combination of multiple interfaces.
As shown in fig. 2, the mobile terminal 200 may specifically include: a processor 210, an internal memory 221, an external memory interface 222, a Universal Serial Bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 271, a microphone 272, a microphone 273, an earphone interface 274, a sensor module 280, a display 290, a camera module 291, an indicator 292, a motor 293, a button 294, and a Subscriber Identity Module (SIM) card interface 295. Wherein the sensor module 280 may include a depth sensor 2801, a pressure sensor 2802, a gyroscope sensor 2803, and the like.
Processor 210 may include one or more processing units, such as: the Processor 210 may include an Application Processor (AP), a modem Processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a video codec, a Digital Signal Processor (DSP), a baseband Processor, and/or a Neural-Network Processing Unit (NPU), and the like. The different processing units may be separate devices or may be integrated into one or more processors.
The digital signal processor is used for processing digital signals, and can process digital image signals and other digital signals. For example, when the mobile terminal 200 selects a frequency point, the digital signal processor is used to perform fourier transform or the like on the frequency point energy. In some embodiments of the present disclosure, the digital signal processor may be configured to adjust a connection mode of the type-c interface according to the CID status data.
A memory is provided in the processor 210. The memory may store instructions for implementing six modular functions: detection instructions, connection instructions, information management instructions, analysis instructions, data transmission instructions, and notification instructions, and execution is controlled by processor 210.
The charge management module 240 is configured to receive a charging input from a charger. The power management module 241 is used for connecting the battery 242, the charging management module 240 and the processor 210. The power management module 241 receives the input of the battery 242 and/or the charging management module 240, and supplies power to the processor 210, the internal memory 221, the display screen 290, the camera module 291, the wireless communication module 260, and the like. In some embodiments, the power management module 241 is provided with a voltage boosting circuit and an output circuit for boosting and outputting current when the mobile terminal 200 supplies power to an external device.
The wireless communication function of the mobile terminal 200 may be implemented by the antenna 1, the antenna 2, the mobile communication module 250, the wireless communication module 260, a modem processor, a baseband processor, and the like. Wherein, the antenna 1 and the antenna 2 are used for transmitting and receiving electromagnetic wave signals; the mobile communication module 250 may provide a solution including wireless communication of 2G/3G/4G/5G, etc. applied to the mobile terminal 200; the modem processor may include a modulator and a demodulator; the Wireless communication module 260 may provide a solution for Wireless communication including a Wireless Local Area Network (WLAN) (e.g., a Wireless Fidelity (Wi-Fi) network), Bluetooth (BT), and the like, applied to the mobile terminal 200. In some embodiments, antenna 1 of the mobile terminal 200 is coupled to the mobile communication module 250 and antenna 2 is coupled to the wireless communication module 260, such that the mobile terminal 200 may communicate with networks and other devices via wireless communication techniques.
Internal memory 221 may be used to store computer-executable program code, which includes instructions. The internal memory 221 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The storage data area may store data (e.g., audio data, a phonebook, etc.) created during use of the mobile terminal 200, and the like. In addition, the internal memory 221 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk Storage device, a Flash memory device, a Universal Flash Storage (UFS), and the like. The processor 210 executes various functional applications of the mobile terminal 200 and data processing by executing instructions stored in the internal memory 221 and/or instructions stored in a memory provided in the processor.
The depth sensor 2801 is used to acquire depth information of a scene. In some embodiments, a depth sensor may be provided to the camera module 291. The pressure sensor 2802 is used to sense a pressure signal and convert the pressure signal into an electrical signal. The gyro sensor 2803 may be used to determine a motion gesture of the mobile terminal 200.
In addition, other functional sensors, such as an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc., may be provided in the sensor module 280 according to actual needs.
Other devices for providing auxiliary functions may also be included in mobile terminal 200. For example, the keys 294 include a power-on key, a volume key, and the like, and a user can generate key signal inputs related to user settings and function control of the mobile terminal 200 through key inputs. Further examples include indicator 292, motor 293, SIM card interface 295, etc.
The naming primitive USB Type-C connector of the USB Type-C interface is a firm and easy-to-use interface, supports positive and negative insertion, and is convenient and quick; meanwhile, the interface supports ultra-high rate communication functions and power output, so the TYPEC protocol is widely used, for example, an adapter of an OTG device needs to use the protocol.
As shown in FIG. 3, the Type-C interface has 12 pairs of pins distributed symmetrically, so that the positive and negative insertion can be supported without distinguishing between the positive and negative as in the conventional interface. The more important pin is the CC pin, and the CC pin is used to detect which role the connected device is in, i.e., sink device or source device. For example, a mobile phone is connected to an OTG usb disk, the mobile phone may be set to a downlink port (DFP) mode for power supply, and the usb disk may be set to an uplink port UFP mode for receiving power supply from the mobile phone. At this time, the CC pin is as shown in fig. 4. The Rd of the USB flash disk is grounded, and at the moment, if the mobile phone is in a DFP mode, namely Rp and Rd are directly connected, external sink equipment can be detected, so that the OTG USB flash disk is detected.
It should be noted that, in the related art, it is generally required to integrate a discrete insertion detection circuit at the AP end. As shown in fig. 3, the Type-C interface has 4 GND pins that are symmetric with respect to each other, and when performing insertion detection, it is necessary to use one GND pin connected to a comparator for insertion detection. When a device (whether a source device or a sink device) is connected through a Type-C interface, the output of the comparator will pull down one GPIO (General-purpose input/output), at this time, the software will trigger an interrupt (the GPIO level will trigger an interrupt from high to low or from low to high), and then the mode of the connection interface is set to be a DRP mode, and then device detection is started. However, the above method requires additional hardware circuits such as a comparator for insertion detection, which may increase the circuit board area required for the terminal device and the cost of the terminal device.
In view of one or more of the above problems, the present example embodiment provides a device detection method. The device detection method can be applied to a digital signal processor of a terminal device configured with a type-c interface, i.e., the device detection method is performed by the digital signal processor. Referring to fig. 5, the device detection method may include the following steps S510 and S520:
in step S510, CID status data is read in response to an interrupt trigger for detecting a CID input by the terminal device charger.
The state data corresponding to the Charger Input Detect (CID) includes a first state of the CID before the interrupt trigger and a second state of the CID after the interrupt trigger.
In an exemplary embodiment, when the terminal device performs charger input detection, whether a connecting line and a device plug-in type-c interface exist can be directly determined through interrupt triggering, and then CID state data is determined according to whether the connecting line and the device plug-in type-c interface exist. For example, before an interrupt trigger occurs, the type-c interface is disconnected from the device, i.e., in a unplugged state; after the interrupt trigger occurs, the type-c interface is connected with the device, namely, in the plug-in state, it can be determined that the interrupt trigger is caused by the plug-in and the plug-out of the device. For another example, before the interrupt trigger and after the terminal trigger, the type-c interfaces are both connected devices, or both connected devices, which may be the interrupt trigger caused by other interrupt situations, and not the interrupt trigger caused by plugging and unplugging of the devices.
Through interruption triggering of the CID and acquisition of CID state data, whether other equipment is inserted through a type-c interface or not can be directly detected based on input detection of a charger in the charging circuit, an independent insertion detection circuit is avoided, the problem that the area of a circuit board required by the terminal equipment is increased is further avoided, and meanwhile, the cost is reduced.
In step S520, when the first state is different from the second state and the second state is the pull-out state, the connection mode of the type-c interface is adjusted to the uplink port mode.
The connection mode is used for representing a connection role which can be played by the terminal equipment where the type-c interface is located. For example, when the connection mode of the type-c interface is the uplink port mode, the type-c interface can be used as sink equipment to wait for the charger to charge; when the connection mode of the type-c interface is a downlink port mode, the device can be used as source equipment to supply power for other external equipment. In addition, data may be provided in both modes.
In an exemplary embodiment, when the first state before the interrupt trigger and the second state after the interrupt trigger included in the CID state data are different, as can be seen from the above example, it may be determined that the interrupt trigger of this time is caused by the insertion and extraction of the type-c interfacing device. At this time, if the second state is the pull-out state, it is proved that the interrupt trigger is caused by the pulling-out of the device connected to the type-c interface. Therefore, the connection mode of the type-c interface can be adjusted to an Uplink Facing Port (UFP) mode, so as to avoid that the connection mode of the type-c interface is still in a DRP mode when no device is connected, and further avoid the problems of power consumption, leakage, corrosion and the like caused by the periodic square wave output by the type-c interface.
Further, in an exemplary embodiment, when a first state before the interrupt trigger and a second state after the interrupt trigger are different, and the second state is an insertion state, it is proved that the interrupt trigger is caused by inserting a new device into the type-c interface. At this time, for the purpose of detecting the inserted new device, the connection mode may be adjusted from the UFP mode to the DRP mode, so as to determine whether the new inserted device is a sink device or a source device.
In addition, when the device connection is performed through the type-c interface, a type-c connection line needs to be used. Since some type-c connection lines are non-standard connection lines, a situation that the insertion and extraction cannot be detected by CID detection may occur. In this case, the terminal device may be provided with a detection switch that is turned on when used for operation, and the connection mode may be adjusted to the DRP mode when the detection switch is in an on state. Through setting up detection switch for the user can manually adjust the connected mode of type-c interface, and then is convenient for accomplish the testing process of equipment under the condition of unable automatic identification plug.
In an exemplary embodiment, the type of the externally connected device may be determined by detecting a CC interrupt of a CC pin of a type-c interface when the connection mode is in the DRP mode. When detecting that The externally connected device is an OTG (On-The-Go) device, The connection mode of The type-c interface may be adjusted to a DFP mode so as to supply power to The OTG device.
It should be noted that after the CC interrupt is detected through the CC pin, the second state may be read again to determine whether the second state is still the inserted state. By reading again, a fool-proof effect can be achieved. In addition, when the detection switch is present, fool-proofing can also be performed here by determining whether the detection switch is still in the on state.
Further, after the connection mode of the type-c interface is adjusted to the DFP mode, in order to implement power supply, the digital signal processor needs to send a power supply instruction to the application processor of the terminal device where the digital signal processor is located, and after receiving the power supply instruction, the application processor pulls up the levels of the boost circuit and the output chip, and then raises the voltage through the boost circuit to perform power supply output, thereby finally forming a power supply path of the OTG device.
In addition, since the Power supply path is implemented by a boost circuit outside the digital signal processor, and is not implemented by a Power Management Integrated Circuit (PMIC), the VBUS Power line of the USB type-c interface for supplying Power is immediately charged upon Power output. In this case, since the power management integrated circuit does not output power, an interrupt similar to that when the adapter is inserted may be generated, and at this time, the terminal device may have a charger recognition process, and then display a charging-related identifier on a display of the terminal device. In order to avoid the identifier, after the OTG device is powered on the basis of the connection port, if the above-mentioned charger identification process occurs, the connection mode needs to be read again, and if the connection mode is still the DFP mode at this time, the charger identification process needs to be shielded, so as to avoid displaying the charging-related identifier.
It should be noted that, after the user turns on the detection switch, the user can customize the preset condition, and after the preset condition is met, the turned-on detection switch is automatically turned off. For example, the preset condition may include a preset time for turning on the switch, and if the device is not detected, the detection switch may be turned off. Specifically, after the detection switch is turned on, the type-c interface is adjusted to the DRP mode. In this case, if no CC interrupt occurs to the CC pin, it indicates that no external device is plugged in. If no external device is inserted for a preset time, the detection switch can be closed.
In addition, since the digital signal processor is used to process digital signals, it is impossible to control hardware to perform corresponding operations, and thus after the type-c interface is adjusted to the DRP mode, it may be necessary to perform other operations by the application processor. For example, when the OTG device is powered, the application processor needs to pull up the power level, and then perform operations such as boosting and power output. Therefore, before reading the CID status data, it is necessary to determine whether the application processor of the terminal device is initialized successfully, and only after the application processor is initialized successfully, the CID status data is continuously read for subsequent processing.
On the contrary, when the application processor is not initialized successfully, the application processor cannot perform operations such as pulling up the level, and therefore cannot supply power to other devices in the DRP mode. At this time, the connection mode can be directly adjusted to the UFP mode.
It should be noted that, in an exemplary embodiment, if the connection mode is adjusted to the UFP mode due to the application processor not being initialized successfully, the initialization of the application processor may be continuously monitored, and after the initialization of the application processor is successfully initialized, the CID state data may be continuously read, so as to further adjust the type-c interface.
The technical solution of the embodiment of the present disclosure is described in detail below with a mobile phone configured with a high-pass ADSP digital signal processor and a type-c interface as a terminal device, and with an access OTG device as an example:
first, in the high-pass ADSP dsp, the USB module and the charging module are integrated therein, and in this case, the integrated plug-in detection and power supply module in the mobile phone may be as shown in fig. 6.
In fig. 6, after the OTG device is inserted into the UEB socket, the digital signal processor ADSP reads CID status data, determines that the OTG device is inserted, sets type-mode indicating a type-c interface connection mode to a DRP mode, and starts device detection. When OTG equipment is detected through a CC pin, informing an AP of POWER supply through glink, then pulling up GPIO of boost _ en by an AP end, boosting VPH _ POWER (consistent with battery voltage) to 5V by a boosting chip or a boosting circuit, outputting the voltage to an output chip, and then pulling up GPIO of out _ en by the AP end to output the chip voltage to V of a USB socket (type-c interface)BUSThe pins and the OTG equipment form a power supply path.
In addition, in order to avoid the situation that the non-standard type-c connecting line cannot be identified by the type-c interface, a detection switch is arranged at the mobile phone end, and when no equipment is inserted in the detection switch within a period of time, the detection switch is automatically turned off.
Referring to fig. 7, the above scheme can be implemented by the following steps:
step S701, CID interruption registration, CID interruption enabling and CID interruption triggering;
step S703, judging whether the application processor is initialized successfully;
step S705, after the initialization of the application processor is successful, reading CID state data; the CID state data comprises a first state before the interrupt trigger and a second state after the interrupt trigger;
step S707 of determining whether the first state and the second state are different;
step S709, when the initialization of the application processor is not successful, or when the first state is different from the second state and the second state is the unplugged state, setting typec-mode to the UFP mode;
it should be noted that, when typec-mode itself is already UFP mode, it does not need to be set repeatedly; meanwhile, if the state identifier corresponding to the detection switch indicates that the detection switch is in an on state (shock is 1), typec-mode does not need to be set to the UFP mode; specifically, the register of POWER _ roll is read first, and if it is not UFP mode at this time, and the otg _ switch is not turned on, then typec _ mode needs to be reset to UFP mode.
Step S711, the application processor is initialized successfully;
step S713, determining whether the second state is the insertion state or whether the detection switch is in the on state;
step S715, when the first state is different from the second state and the second state is the inserting state, setting typec-mode to DRP mode; or when the second state is the inserting state or the detection switch is in the opening state, typec-mode is set to the DRP mode.
Step S717, determining the type of the external connection device through CC interrupt, for example, the OTG device may be used as a sink device;
specifically, after the DRP mode is set, the CC pin level changes periodically, and the insertion of an external OTG device is detected, which may generate a CC interrupt.
Step 719, fool-proofing is performed by detecting whether the second state is the insertion state again, or detecting whether the switch is the on state;
specifically, in order to prevent fool, the second state and the detection switch state are read again in the cc interrupt processing function, and if the second state is the pull-out state and the detection switch is the off state, it indicates that the UFP mode needs to be reset; if the second state is the insertion state or the detection switch is the on state, the subsequent processing is performed according to typec detection.
Step S721, according to typec detection protocol, the register may be set as the identifier corresponding to the DFP;
specifically, according to the typec detection protocol, registers of the flag sink and src modes are set, and at the moment, the mobile phone serves as a power supply side, so that a relevant bit of the src register is set to 1, and meanwhile, the typec _ device register is set to DFP;
step S723, ADSP sends the power supply OTG _ ENABLE message to AP through bus glink;
step S725, the AP receives the message and operates the BOOST _ EN and the OUT _ EN to BOOST to 5V and output 5V to the USB port, so as to realize power supply;
step S727, when the charger identification process occurs, detecting whether the register mark is still the mark corresponding to the DFP;
the charger identification process comprises the interruption of inserting a plug into an adapter and the interruption of identifying the type of a charging appliance, and the attribute of usb _ online is in a charging state;
step S729, shielding the charger identification process when the register identifier is still the identifier corresponding to the DFP;
specifically, the src mode register and the register of typec _ device are read, and the mobile phone is directly returned when being judged as a DFP, so that no substantial processing is performed on the interrupt; meanwhile, the attribute of usb _ online returned to the AP through glink in the ADSP is also treated in the same way, so as to prevent the mobile phone from being plugged into the OTG device to display a charging icon;
step S731, OTG device enumeration and mount.
In the above embodiment, a scheme for identifying the OTG device is designed based on the ADSP architecture. The scheme can correctly identify the OTG equipment in various harsh scenes, and can meet the existing specification requirements (avoiding the power consumption and electric leakage conditions); in addition, the scheme is the first realization that the charging and USB module is integrated into ADSP from AP, provides a foundation for realizing corresponding functions of subsequent projects,
it is noted that the above-mentioned figures are merely schematic illustrations of processes involved in methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Further, referring to fig. 8, in the present exemplary embodiment, a device detection apparatus 800 is further provided, which is applied to a digital signal processor of a terminal device configured with a type-c interface, where the apparatus 800 includes a status obtaining module 810 and a mode adjusting module 820. Wherein:
the state obtaining module 810 may be configured to read CID state data in response to an interrupt trigger of the terminal device charger inputting the detection CID; the CID state data comprises a first state of the CID before the interrupt trigger and a second state of the CID after the interrupt trigger;
the mode adjustment module 820 may be configured to adjust the connection mode of the type-c interface to the uplink port mode when the first state is different from the second state, and the second state is the pull-out state.
In an exemplary embodiment, the mode adjustment module 820 may be configured to adjust the connection mode to the dual role port mode when the first state is different from the second state, and the second state is the insertion state.
In an exemplary embodiment, the mode adjustment module 820 may be configured to turn on a detection switch of the terminal device in response to a user operation to adjust the connection mode to the dual-role port mode according to a turn-on state of the detection switch.
In an exemplary embodiment, the mode adjustment module 820 may be configured to set the connection mode to the downstream port mode when the OTG device is detected.
In an exemplary embodiment, the mode adjustment module 820 may be configured to send a power supply instruction to an application processor of the terminal device, so that the application processor controls the voltage boost circuit to perform a voltage boost operation, so as to supply power to the OTG device based on the connection port.
In an exemplary embodiment, the mode adjustment module 820 may be configured to read the connection mode when the terminal device has a charger identification process; and shielding the charger identification process when the connection mode is the downlink port mode.
In an exemplary embodiment, the mode adjustment module 820 may be configured to turn off a detection switch of the terminal device when a preset condition is satisfied.
In an exemplary embodiment, the status obtaining module 810 may be configured to read the CID status data when the initialization of the application processor of the terminal device is successful.
In an exemplary embodiment, the mode adjustment module 820 may be configured to adjust the connection mode to the uplink port mode when the initialization of the application processor of the terminal device is not successful.
The specific details of each module in the above apparatus have been described in detail in the method section, and details that are not disclosed may refer to the method section, and thus are not described again.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
Exemplary embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product including program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the above-mentioned "exemplary methods" section of this specification, when the program product is run on the terminal device, for example, any one or more of the steps in fig. 5 or fig. 7 may be performed.
It should be noted that the computer readable media shown in the present disclosure may be computer readable signal media or computer readable storage media or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Furthermore, program code for carrying out operations of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is to be limited only by the terms of the appended claims.

Claims (12)

1. A device detection method applied to a digital signal processor of a terminal device configured with a type-c interface, the method comprising:
responding to interrupt triggering of the terminal equipment charger input detection CID, and reading CID state data; wherein the CID status data comprises a first status of the CID before interrupt trigger and a second status of the CID after interrupt trigger;
and when the first state is different from the second state and the second state is the pull-out state, adjusting the connection mode of the type-c interface into an uplink port mode.
2. The method of claim 1, further comprising:
and when the first state is different from the second state and the second state is an insertion state, adjusting the connection mode to a dual-role port mode.
3. The method of claim 1, further comprising:
and responding to the operation of a user, starting a detection switch of the terminal equipment so as to adjust the connection mode to a dual-role port mode according to the starting state of the detection switch.
4. The method of claim 2 or 3, wherein after adjusting the connection mode to the dual role port mode, the method further comprises:
and when the OTG equipment is detected, setting the connection mode as a downlink port mode.
5. The method of claim 4, wherein after the setting the connection mode to the downstream port mode, the method further comprises:
and sending a power supply instruction to an application processor of the terminal equipment so as to enable the application processor to control a booster circuit to carry out boosting operation, so that the OTG equipment is supplied with power based on a connection port.
6. The method of claim 5, wherein after the providing power to the OTG device based on the connection port, the method further comprises:
reading the connection mode when a charger identification process occurs in the terminal equipment;
and shielding the charger identification process when the connection mode is a downlink port mode.
7. The method of claim 3, further comprising:
and when the preset condition is met, closing the detection switch of the terminal equipment.
8. The method of claim 1, wherein prior to the reading CID status data, the method further comprises:
and reading the CID state data when the initialization of the application processor of the terminal equipment is successful.
9. The method of claim 1, further comprising:
and when the application processor of the terminal equipment is not initialized successfully, adjusting the connection mode to an uplink port mode.
10. A device detection apparatus, applied to a digital signal processor of a terminal device configured with a type-c interface, the apparatus comprising:
the state acquisition module is used for responding to interrupt triggering of the terminal equipment charger input detection CID and reading CID state data; wherein the CID status data comprises a first status of the CID before interrupt trigger and a second status of the CID after interrupt trigger;
and the mode adjusting module is used for adjusting the connection mode of the type-c interface into an uplink port mode when the first state is different from the second state and the second state is the pull-out state.
11. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 9.
12. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1 to 9 via execution of the executable instructions.
CN202110232047.0A 2021-03-02 2021-03-02 Device detection method and device, computer readable medium and electronic device Active CN113030794B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110232047.0A CN113030794B (en) 2021-03-02 2021-03-02 Device detection method and device, computer readable medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110232047.0A CN113030794B (en) 2021-03-02 2021-03-02 Device detection method and device, computer readable medium and electronic device

Publications (2)

Publication Number Publication Date
CN113030794A true CN113030794A (en) 2021-06-25
CN113030794B CN113030794B (en) 2022-07-15

Family

ID=76465883

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110232047.0A Active CN113030794B (en) 2021-03-02 2021-03-02 Device detection method and device, computer readable medium and electronic device

Country Status (1)

Country Link
CN (1) CN113030794B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114116546A (en) * 2021-11-19 2022-03-01 Oppo广东移动通信有限公司 Device unplugging reporting method and device, computer readable medium and electronic device

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080294923A1 (en) * 2007-05-24 2008-11-27 Research In Motion Limited System and method for interfacing an electronic device with a host system
CN105975414A (en) * 2015-10-26 2016-09-28 乐视移动智能信息技术(北京)有限公司 Method and device for controlling mobile terminal
US20180018934A1 (en) * 2016-07-12 2018-01-18 Samsung Electronics Co., Ltd. Electronic device supporting usb interface and control method for usb interface
CN207281214U (en) * 2017-05-25 2018-04-27 深圳市乐得瑞科技有限公司 Type-C interface and connection detection circuit thereof
CN110520854A (en) * 2017-10-31 2019-11-29 华为技术有限公司 A kind of electronic equipment, control method and the readable storage medium storing program for executing of USB Type C interface
US20190369708A1 (en) * 2019-06-29 2019-12-05 Intel Corporation Power saving for type-c connectors
WO2020024116A1 (en) * 2018-07-31 2020-02-06 华为技术有限公司 Interface configuration method, terminal device and interface
CN111433756A (en) * 2018-07-24 2020-07-17 华为技术有限公司 Terminal and Type C interface anti-corrosion method
CN111752362A (en) * 2019-03-29 2020-10-09 北京小米移动软件有限公司 Method, device and storage medium for preventing interface from being corroded
CN111949107A (en) * 2019-05-15 2020-11-17 北京小米移动软件有限公司 Method and device for controlling electronic equipment comprising USB Type-C interface and electronic equipment
CN212114183U (en) * 2020-05-14 2020-12-08 闻泰通讯股份有限公司 TYPE-C interface module, data line and power transmission circuit

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080294923A1 (en) * 2007-05-24 2008-11-27 Research In Motion Limited System and method for interfacing an electronic device with a host system
CN105975414A (en) * 2015-10-26 2016-09-28 乐视移动智能信息技术(北京)有限公司 Method and device for controlling mobile terminal
US20180018934A1 (en) * 2016-07-12 2018-01-18 Samsung Electronics Co., Ltd. Electronic device supporting usb interface and control method for usb interface
CN207281214U (en) * 2017-05-25 2018-04-27 深圳市乐得瑞科技有限公司 Type-C interface and connection detection circuit thereof
CN110520854A (en) * 2017-10-31 2019-11-29 华为技术有限公司 A kind of electronic equipment, control method and the readable storage medium storing program for executing of USB Type C interface
CN111433756A (en) * 2018-07-24 2020-07-17 华为技术有限公司 Terminal and Type C interface anti-corrosion method
WO2020024116A1 (en) * 2018-07-31 2020-02-06 华为技术有限公司 Interface configuration method, terminal device and interface
CN111752362A (en) * 2019-03-29 2020-10-09 北京小米移动软件有限公司 Method, device and storage medium for preventing interface from being corroded
CN111949107A (en) * 2019-05-15 2020-11-17 北京小米移动软件有限公司 Method and device for controlling electronic equipment comprising USB Type-C interface and electronic equipment
US20190369708A1 (en) * 2019-06-29 2019-12-05 Intel Corporation Power saving for type-c connectors
CN212114183U (en) * 2020-05-14 2020-12-08 闻泰通讯股份有限公司 TYPE-C interface module, data line and power transmission circuit

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114116546A (en) * 2021-11-19 2022-03-01 Oppo广东移动通信有限公司 Device unplugging reporting method and device, computer readable medium and electronic device

Also Published As

Publication number Publication date
CN113030794B (en) 2022-07-15

Similar Documents

Publication Publication Date Title
CN110829523B (en) Electronic equipment and reverse charging method
US9483093B2 (en) Electronic device and method for controlling a setting of a maximum consumption current
CN102880238B (en) Interface expanding method and device for tablet personal computer
US11340676B2 (en) Method of identifying external electronic device based on power information and electronic device and storage medium for supporting same
KR102015972B1 (en) Device Charging Over USB Using a Plurality of Handshakes
US20140300321A1 (en) Method for controlling charging of electronic device, and electronic device and charging device supporting the same
CN107707000B (en) OTG power supply and wireless charging compatible circuit, related method and terminal equipment
CN111239617B (en) Control method and device for charge and discharge test, storage medium and system
CN108228509B (en) USB interface switching device and electronic equipment
EP2669761A2 (en) System, apparatus, and method of performing charging operation in host mode
TW201525702A (en) Method and apparatus for charging electronic device with USB connection
US20240248125A1 (en) Method for Detecting Impedance of Charging Cable, Electronic Device, and Power Supply Device
WO2017161750A1 (en) Mobile apparatus
CN113937832A (en) Charging cable, and identification method and system of charging cable
KR20210014356A (en) Electronic device for preventing damage of usb device and operating method thereof
CN113030794B (en) Device detection method and device, computer readable medium and electronic device
CN115800557A (en) Wireless charging method, electronic device, storage medium, and program
CN204706733U (en) USB connecting line
US11394225B2 (en) Method and apparatus for changing impedance of terminal included in connector
CN114116546B (en) Equipment pull-out reporting method and device, computer readable medium and electronic equipment
TWI633440B (en) Electronic device
CN113162131A (en) Reverse charging system, reverse charging method and terminal equipment
CN113162129B (en) Electronic equipment, charging method and system
KR102714346B1 (en) Method for identifying an external electronic device based on power information, storage medium and an electronic device therefor
CN116565985A (en) Charging control method and device, computer readable medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant