CN110825682A - USB control method and electronic equipment - Google Patents

USB control method and electronic equipment Download PDF

Info

Publication number
CN110825682A
CN110825682A CN201911071262.6A CN201911071262A CN110825682A CN 110825682 A CN110825682 A CN 110825682A CN 201911071262 A CN201911071262 A CN 201911071262A CN 110825682 A CN110825682 A CN 110825682A
Authority
CN
China
Prior art keywords
usb interface
port
type
transmission information
condition
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
CN201911071262.6A
Other languages
Chinese (zh)
Other versions
CN110825682B (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.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN201911071262.6A priority Critical patent/CN110825682B/en
Publication of CN110825682A publication Critical patent/CN110825682A/en
Application granted granted Critical
Publication of CN110825682B publication Critical patent/CN110825682B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05KPRINTED CIRCUITS; CASINGS OR CONSTRUCTIONAL DETAILS OF ELECTRIC APPARATUS; MANUFACTURE OF ASSEMBLAGES OF ELECTRICAL COMPONENTS
    • H05K9/00Screening of apparatus or components against electric or magnetic fields
    • H05K9/0067Devices for protecting against damage from electrostatic discharge
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0042Universal serial bus [USB]

Abstract

A USB control method and an electronic device are provided. The invention provides a control method of electronic equipment and the electronic equipment, wherein the electronic equipment comprises: the USB interface and a metal shell arranged around the USB interface; the control method of the electronic equipment comprises the following steps: determining the port type and port transmission information of the external equipment under the condition that the electronic equipment is detected to be accessed into the external equipment through the USB interface; and controlling the metal shell to be grounded under the condition that the port type is a target port type and the port transmission information meets the preset condition. The invention can avoid the transmission interruption of the USB interface due to ESD discharge in the data transmission mode and reduce the risk of burning out of the USB interface due to grounding of the metal shell.

Description

USB control method and electronic equipment
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a USB control method and an electronic device.
Background
The USB (Universal Serial Bus) interface is a standard interface for charging and data transmission in electronic devices. Taking a mobile phone as an example, in order to ensure that a data transmission function can still normally work under an external electric field or magnetic field environment without transmission interruption or data error, in CE EMC certification in european union market, 8kv ESD (Electro-static discharge) discharge is required to be performed on a USB interface of the mobile phone in a data transmission state between the mobile phone and a computer, and data transmission is not interrupted. The existing USB interface design cannot meet the discharge requirement of 8kv, and transmission can be interrupted during discharge, which is because 1) the USB interface at the mobile phone end is suspended; 2) the shield of the data line is not connected to the GND of the data line.
Taking the case that the mobile phone and the computer transmit data through the data line as an example, when the data line is inserted into the mobile phone, the plug iron shell B of the data line is contacted with the USB interface shell of the mobile phone, and when the data line is inserted into the computer, the plug iron shell A of the data line is contacted with the USB interface shell of the computer. The shielding layer is connected with the plug iron shells at two ends of the data line. In a transmission state, when ESD discharges and tests, static electricity can be discharged to the plug iron shell B of the data line, because the USB interface shell of the mobile phone which is in contact with the plug iron shell B of the data line is not grounded, the static electricity can be transmitted to the USB interface shell of a computer through the shielding layer of the data line and is discharged to GND, and under the discharge path, D + D-signals wrapped in the shielding layer are easily interfered, so that transmission interruption occurs due to ESD discharging when transmission is carried out. That is, in the prior art, the USB interface of the electronic device has a problem that the transmission of the data transmission mode is interrupted due to the ESD discharge.
Disclosure of Invention
The invention provides a USB control method and electronic equipment, and aims to solve the problem that a USB interface of the electronic equipment in the prior art is interrupted in transmission due to ESD discharge in a data transmission mode.
In order to solve the technical problem, the invention is realized as follows:
in a first aspect, an embodiment of the present invention provides a USB control method, where an electronic device includes: the USB interface and a metal shell arranged around the USB interface;
the control method comprises the following steps:
determining the port type and port transmission information of the external equipment under the condition that the electronic equipment is detected to be accessed into the external equipment through the USB interface;
and controlling the metal shell to be grounded under the condition that the port type is a target port type and the port transmission information meets the preset condition.
In a second aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes: the USB interface and a metal shell arranged around the USB interface;
the electronic device includes:
the determining module is used for determining the port type and port transmission information of the external equipment under the condition that the electronic equipment is detected to be accessed into the external equipment through the USB interface;
and the control module is used for controlling the metal shell to be grounded under the condition that the port type is the target port type and the port transmission information meets the preset condition.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a computer program stored on the memory and executable on the processor, where the computer program implements the steps of the USB control method when executed by the processor.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the USB control method described above.
In the embodiment of the invention, the port type and the port transmission information of the external equipment are determined under the condition that the electronic equipment is detected to be accessed into the external equipment through the USB interface; and controlling the metal shell to be grounded under the condition that the port type is the target port type and the port transmission information meets the preset condition, so that the transmission interruption of the USB interface due to ESD discharge in the data transmission mode is avoided, and the risk of burning out the USB interface due to grounding of the metal shell is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive exercise.
FIG. 1 is a flow chart of a USB control method according to an embodiment of the present invention;
FIG. 2 illustrates an exemplary block circuit diagram of an electronic device provided by an embodiment of the invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the technical problems, technical solutions and advantages of the present invention more apparent, the following detailed description is given with reference to the accompanying drawings and specific embodiments.
The embodiment of the invention provides a USB control method, which is applied to electronic equipment, wherein the electronic equipment can comprise: the USB interface and a metal shell arranged around the USB interface; the USB interface is an interface which is standard on the electronic equipment and is used for charging and data transmission, namely, the USB interface can realize data exchange between the electronic equipment and external equipment (such as a U disk, a mobile phone, a computer and the like).
Referring to fig. 1, a flow chart of a USB control method according to an embodiment of the present invention is shown. The USB control method provided by the embodiment of the invention can comprise the following steps:
step 101, under the condition that the electronic device is detected to be connected to the external device through the USB interface, determining the port type and the port transmission information of the external device.
In this step, the electronic device detects whether an external device is inserted into the USB interface during use, determines the type of the port where the external device is inserted into the USB interface when detecting that the external device is inserted into the USB interface, and determines the port transmission information of the external device. Here, the Port types may include a Standard Downstream Port (SDP) type, a Charging Downstream Port (CDP) type, and a Dedicated Charging Port (DCP) type. The port transfer information is information indicating a device type of the external device.
Optionally, in the embodiment of the present invention, the electronic device may determine that the electronic device is detected to be connected to the external device through the USB interface when detecting that the interface voltage VBUS of the USB interface is greater than a preset voltage threshold by detecting the interface voltage VBUS of the USB interface.
And 102, controlling the metal shell to be grounded under the condition that the port type is the target port type and the port transmission information meets the preset condition.
In the embodiment of the invention, the target port type is a port type with a data transmission function. In this step, if the determined port type determined in step 101 is the target port type, that is, the port type of the external device has a data transmission function, and it is detected and determined that the port transmission information of the external device meets the preset condition, that is, the external device is the target device capable of performing data communication, that is, the electronic device can perform data transmission with the external device through the USB interface, the electronic device controls the metal shell of the USB interface to be grounded; otherwise, the electronic equipment controls the metal shell of the USB interface to be suspended. Therefore, transmission interruption of the USB interface due to ESD discharge in a data transmission mode can be avoided, and meanwhile, the metal shell of the USB interface is grounded only in an application scene of data transmission between the electronic equipment and external equipment through the USB interface, so that the risk of burning of the USB interface due to grounding of the metal shell can be reduced.
In the embodiment of the invention, the port type and the port transmission information of the external equipment are determined under the condition that the electronic equipment is detected to be accessed into the external equipment through the USB interface; and controlling the metal shell to be grounded under the condition that the port type is the target port type and the port transmission information meets the preset condition, so that the transmission interruption of the USB interface due to ESD discharge in the data transmission mode is avoided, and the risk of burning out the USB interface due to grounding of the metal shell is reduced.
In the embodiment of the invention, the electronic device can determine whether the port type of the external device is the target port type by acquiring the positive signal D + and the negative signal D-of the differential signal line under the condition that the electronic device is detected to be connected into the external device through the USB interface and then according to the positive signal D + and the negative signal D-.
For example, in the embodiment of the present invention, the target port type may be a standard downstream port type. In some optional embodiments of the present invention, in step 101, in the case that it is detected that the electronic device accesses the external device through the USB interface, determining a port type of the external device may include the following steps: under the condition that the electronic equipment is detected to be connected into external equipment through a USB interface, acquiring a positive electrode signal D + and a negative electrode signal D-of a differential signal line of the USB interface; and if the first voltage change value of the positive electrode signal D + after the USB interface is connected to the external equipment is detected to be larger than the first threshold value, and the second voltage change value of the negative electrode signal D-after the USB interface is connected to the external equipment is detected to be larger than the second threshold value, determining that the port type of the external equipment is the target port type. In the embodiment of the present invention, the electronic device may determine the voltage change values of the positive signal D + and the negative signal D-after the USB interface is connected to the external device, that is, the first voltage change value and the second voltage change value, by detecting the voltage value of the positive signal D + and the negative signal D-before the USB interface is connected to the external device, and the voltage value of the positive signal D + and the negative signal D-after the USB interface is connected to the external device, respectively, and then compare the first voltage change value with the first threshold and the second voltage change value with the second threshold, so that if it is determined that the first voltage change value is greater than the first threshold and the second voltage change value is greater than the second threshold, it may be determined that the port type of the external device is the target port type, that is, the standard downlink port type.
For example, in the embodiment of the present invention, as shown in fig. 2, the electronic device 10 includes a PMIC (Power management ic) 40, the PMIC40 is connected to a differential signal line of the USB interface, and the electronic device 10 may detect and obtain the positive signal D + and the negative signal D-through BC1.2 in the PMIC40, and determine the port type of the external device.
Optionally, in the embodiment of the present invention, when the device type corresponding to the port transmission information is a preset device type, the port transmission information meets a preset condition. Here, by determining that the device type corresponding to the port transmission information is the preset device type, the port transmission information meets the preset condition, that is, the external device is a target device capable of performing data communication, and can perform data transmission with the electronic device through the USB interface.
For example, in step 101, in the case that it is detected that the electronic device accesses the external device through the USB interface, determining the port type and the port transmission information of the external device may include the following steps: and under the condition that the electronic equipment is detected to be accessed into the external equipment through the USB interface, initiating a USB enumeration process and acquiring port transmission information, wherein the port transmission information comprises enumeration information of the external equipment. In this embodiment of the present invention, an electronic device may initiate an enumeration process between the electronic device and an external device when detecting that the external device is accessed through a USB interface, try to complete the enumeration process between the electronic device and the external device, and in the enumeration process, the electronic device allocates an address for the external device, configures a driver, and obtains port transmission information of the external device, where the port transmission information specifically includes enumeration information of the external device, and the enumeration information may include a device descriptor; then, determining the device type of the external device through enumeration information of the external device in the port transmission information, namely the device type corresponding to the port transmission information; further determining whether the device type corresponding to the port transmission information is a preset device type, that is, whether the external device is a target device, where the device type of the external device may be matched with a predetermined preset device type capable of performing data communication, and if the device type of the external device is matched with the preset device type, determining that the device type corresponding to the port transmission information is the preset device type, that is, the external device is the target device.
Optionally, in the embodiment of the present invention, the electronic device may first detect the port type of the external device, and then determine the port transmission information, that is, the electronic device may further determine the port transmission information of the external device by detecting and determining that the port type of the external device is the target port type, that is, initiate a USB enumeration process, and try to complete the enumeration process between the electronic device and the external device, so as to obtain the port transmission information of the external device. That is, in step 101, determining the port type and port transmission information of the external device may include the following steps: and under the condition that the port type is determined to be the target port type, initiating a USB enumeration process and acquiring port transmission information of the external equipment. Therefore, the operation of the electronic equipment can be reduced, and the processing efficiency is improved.
Alternatively, in this embodiment of the present invention, as shown in fig. 2, the electronic device 10 may be connected to the differential signal line through a USB PHY (USB port physical layer) module 51 of a CPU (central processing Unit) 50, so that the electronic device 10 may complete an enumeration process between the electronic device 10 and an external device by controlling the USB PHY module 51.
Optionally, in some embodiments of the present invention, in order to better implement ground control on the metal shell, the electronic device may further include a switch module, and the metal shell may be electrically connected to the ground terminal through the switch module; step 102, if the port type is the target port type and the port transmission information meets the preset condition, controlling the metal shell to be grounded may include: and when the port type is the target port type and the port transmission information meets the preset condition, controlling the switch module to be conducted, and electrically connecting the metal shell with the grounding end. Therefore, the grounding control of the metal shell can be conveniently and simply realized through the switch module, so that the transmission interruption of the USB interface in a data transmission mode due to ESD discharge can be avoided, and the risk of burning out of the USB interface due to grounding of the metal shell can be reduced.
Preferably, in the embodiment of the present invention, as shown in fig. 2, the switch module 20 is connected to a General-Purpose Input/Output (GPIO) module 52 inside the CPU 50, and the electronic device 10 can control the GPIO module 52 to Output a preset level to control the switch module 30 to be turned on or off, that is, when the port type is a target port type and the port transmission information meets a preset condition, the electronic device 10 controls the GPIO module 52 to Output a first level through the CPU 50 to drive the switch module 30 to be turned on, so as to ground the metal shell 20 of the USB interface; otherwise, the electronic device 10 controls the GPIO module 52 to output the second level through the CPU 50, and drives the switch module 30 to turn off.
For example, if the switch module is an N-MOS (Negative-Metal-Oxide-Semiconductor) transistor, as shown in fig. 2, a gate of the N-MOS transistor is connected to the GPIO module 52, a drain of the N-MOS transistor is connected to the Metal shell 20, and a source of the N-MOS transistor is grounded, the first level is a high level, and the second level is a low level, that is, when the port type is the target port type and the port transmission information meets the preset condition, the electronic device 10 controls the GPIO module 52 to output the high level to the gate of the N-MOS transistor through the CPU 50, and the high level drives the source and the drain of the N-MOS transistor to be conducted, so as to connect the Metal shell 20 of the USB interface to the ground.
According to the USB control method provided by the embodiment of the invention, under the condition that the electronic equipment is detected to be accessed into the external equipment through the USB interface, the port type and the port transmission information of the external equipment are determined; and controlling the metal shell to be grounded under the condition that the port type is the target port type and the port transmission information meets the preset condition, so that the transmission interruption of the USB interface due to ESD discharge in the data transmission mode is avoided, and the risk of burning out the USB interface due to grounding of the metal shell is reduced.
Based on the method, the embodiment of the invention provides electronic equipment for realizing the method.
Referring to fig. 3, a schematic structural diagram of an electronic device according to an embodiment of the invention is shown. An embodiment of the present invention provides an electronic device 300, where the electronic device 300 may include: the USB interface and a metal shell arranged around the USB interface; in this embodiment of the present invention, the electronic device 300 may include: a determination module 310 and a control module 320.
The determining module 310 is configured to determine a port type and port transmission information of an external device when it is detected that the electronic device is connected to the external device through the USB interface;
the control module 320 is configured to control the metal shell to be grounded when the port type is the target port type and the port transmission information meets a preset condition.
For example, in an optional embodiment of the present invention, the target port type may be a standard downlink port type, and the port transmission information meets the preset condition when the device type corresponding to the port transmission information is a preset device type.
In some alternative embodiments of the present invention, the determining module 310 may include: an acquisition unit and a determination unit.
The acquisition unit is used for acquiring a positive electrode signal and a negative electrode signal of a differential signal line of the USB interface under the condition that the electronic equipment is detected to be connected to external equipment through the USB interface;
the determining unit is configured to determine that the port type of the external device is the target port type if it is detected that a first voltage change value of the positive signal after the USB interface is connected to the external device is greater than a first threshold value and a second voltage change value of the negative signal after the USB interface is connected to the external device is greater than a second threshold value.
Optionally, in some embodiments of the present invention, the determining module 310 may include: a determination unit.
The determining unit is used for initiating a USB enumeration process and acquiring port transmission information under the condition that the electronic equipment is detected to be accessed into the external equipment through the USB interface, wherein the port transmission information comprises enumeration information of the external equipment.
Optionally, in some embodiments of the present invention, in order to better implement ground control on the metal shell, the electronic device may further include a switch module, and the metal shell may be connected to the ground terminal through the switch module; the control module 320 may include: a control unit.
And the control unit is used for controlling the switch module to be conducted under the condition that the port type is the target port type and the port transmission information meets the preset condition, and the metal shell is electrically connected with the grounding end.
The electronic device provided in the embodiment of the present invention can implement each process implemented by the electronic device in the method embodiments of fig. 1 to fig. 2, and is not described herein again to avoid repetition.
According to the electronic equipment provided by the embodiment of the invention, the port type and the port transmission information of the external equipment are determined by the determining module under the condition that the electronic equipment is detected to be accessed into the external equipment through the USB interface; the control module controls the metal shell to be grounded when the port type is the target port type and port transmission information meets a preset condition, so that transmission interruption of the USB interface due to ESD discharge in a data transmission mode is avoided, and the risk of burning of the USB interface due to grounding of the metal shell is reduced.
Fig. 4 is a schematic diagram of a hardware structure of an electronic device implementing various embodiments of the present invention.
The electronic device 400 includes, but is not limited to: radio frequency unit 401, network module 402, audio output unit 403, input unit 404, sensor 405, display unit 406, user input unit 407, interface unit 408, memory 409, processor 410, and power supply 411. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 4 does not constitute a limitation of the electronic device, and that the electronic device may include more or fewer components than shown, or some components may be combined, or a different arrangement of components. In the embodiment of the present invention, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a wearable device, a pedometer, and the like.
The processor 410 is configured to determine a port type and port transmission information of an external device when it is detected that the electronic device is connected to the external device through the USB interface; and controlling the metal shell to be grounded under the condition that the port type is a target port type and the port transmission information meets the preset condition. The embodiment of the invention can avoid transmission interruption of the USB interface due to ESD discharge in a data transmission mode, and reduce the risk of burning out of the USB interface due to grounding of the metal shell.
It should be understood that, in the embodiment of the present invention, the radio frequency unit 401 may be used for receiving and sending signals during a message sending and receiving process or a call process, and specifically, receives downlink data from a base station and then processes the received downlink data to the processor 410; in addition, the uplink data is transmitted to the base station. Typically, radio unit 401 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. Further, the radio unit 401 can also communicate with a network and other devices through a wireless communication system.
The electronic device provides wireless broadband internet access to the user via the network module 402, such as assisting the user in sending and receiving e-mails, browsing web pages, and accessing streaming media.
The audio output unit 403 may convert audio data received by the radio frequency unit 401 or the network module 402 or stored in the memory 409 into an audio signal and output as sound. Also, the audio output unit 403 may also provide audio output related to a specific function performed by the electronic apparatus 400 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 403 includes a speaker, a buzzer, a receiver, and the like.
The input unit 404 is used to receive audio or video signals. The input Unit 404 may include a Graphics Processing Unit (GPU) 4041 and a microphone 4042, and the Graphics processor 4041 processes image data of a still picture or video obtained by an image capturing apparatus (such as a camera) in a video capturing mode or an image capturing mode. The processed image frames may be displayed on the display unit 406. The image frames processed by the graphic processor 4041 may be stored in the memory 409 (or other storage medium) or transmitted via the radio frequency unit 401 or the network module 402. The microphone 4042 may receive sound, and may be capable of processing such sound into audio data. The processed audio data may be converted into a format output transmittable to a mobile communication base station via the radio frequency unit 401 in case of the phone call mode.
The electronic device 400 also includes at least one sensor 405, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor includes an ambient light sensor that adjusts the brightness of the display panel 4061 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 4061 and/or the backlight when the electronic apparatus 400 is moved to the ear. As one type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of an electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), and vibration identification related functions (such as pedometer, tapping); the sensors 405 may also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be described in detail herein.
The display unit 406 is used to display information input by the user or information provided to the user. The Display unit 406 may include a Display panel 4061, and the Display panel 4061 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.
The user input unit 407 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device. Specifically, the user input unit 407 includes a touch panel 4071 and other input devices 4072. Touch panel 4071, also referred to as a touch screen, may collect touch operations by a user on or near it (e.g., operations by a user on or near touch panel 4071 using a finger, a stylus, or any suitable object or attachment). The touch panel 4071 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 410, receives a command from the processor 410, and executes the command. In addition, the touch panel 4071 can be implemented by using various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. In addition to the touch panel 4071, the user input unit 407 may include other input devices 4072. Specifically, the other input devices 4072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a track ball, a mouse, and a joystick, which are not described herein again.
Further, the touch panel 4071 can be overlaid on the display panel 4061, and when the touch panel 4071 detects a touch operation thereon or nearby, the touch operation is transmitted to the processor 410 to determine the type of the touch event, and then the processor 410 provides a corresponding visual output on the display panel 4061 according to the type of the touch event. Although in fig. 4, the touch panel 4071 and the display panel 4061 are two independent components to implement the input and output functions of the electronic device, in some embodiments, the touch panel 4071 and the display panel 4061 may be integrated to implement the input and output functions of the electronic device, and the implementation is not limited herein.
The interface unit 408 is an interface for connecting an external device to the electronic apparatus 400. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 408 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic apparatus 400 or may be used to transmit data between the electronic apparatus 400 and an external device. Alternatively, the interface unit 408 may include a USB interface and a metal case disposed around the USB interface.
The memory 409 may be used to store software programs as well as various data. The memory 409 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 409 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 410 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, performs various functions of the electronic device and processes data by operating or executing software programs and/or modules stored in the memory 409 and calling data stored in the memory 409, thereby performing overall monitoring of the electronic device. Processor 410 may include one or more processing units; preferably, the processor 410 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 410.
The electronic device 400 may further include a power supply 411 (e.g., a battery) for supplying power to various components, and preferably, the power supply 411 may be logically connected to the processor 410 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system.
In addition, the electronic device 400 includes some functional modules that are not shown, and are not described in detail herein.
Preferably, an embodiment of the present invention further provides an electronic device, which includes a processor 410, a memory 409, and a computer program that is stored in the memory 409 and can be run on the processor 410, and when being executed by the processor 410, the computer program implements each process of the above-mentioned USB control method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not described here again.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the USB control method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. A USB control method is applied to electronic equipment, and is characterized in that the electronic equipment comprises: the USB interface and a metal shell arranged around the USB interface;
the control method comprises the following steps:
under the condition that the electronic equipment is detected to be accessed into external equipment through the USB interface, determining the port type and port transmission information of the external equipment;
and controlling the metal shell to be grounded under the condition that the port type is a target port type and the port transmission information meets the preset condition.
2. The control method according to claim 1, wherein the target port type is a standard downstream port SDP type, and when the device type corresponding to the port transmission information is a preset device type, the port transmission information meets the preset condition.
3. The method according to claim 2, wherein the determining the port type of the external device in the case of detecting that the electronic device accesses the external device through the USB interface includes:
under the condition that the electronic equipment is detected to be connected into the external equipment through the USB interface, acquiring a positive electrode signal and a negative electrode signal of a differential signal line of the USB interface;
and if it is detected that a first voltage change value of the positive electrode signal after the USB interface is accessed to the external device is larger than a first threshold value and a second voltage change value of the negative electrode signal after the USB interface is accessed to the external device is larger than a second threshold value, determining that the port type of the external device is the target port type.
4. The method according to claim 1, wherein the determining the port type and the port transmission information of the external device in the case of detecting that the electronic device accesses the external device through the USB interface includes:
and initiating a USB enumeration process and acquiring port transmission information under the condition that the electronic equipment is detected to be accessed into external equipment through the USB interface, wherein the port transmission information comprises enumeration information of the external equipment.
5. The control method according to claim 1, wherein the electronic device further comprises a switch module, and the metal housing is electrically connected to a ground terminal through the switch module; the controlling the metal shell to be grounded under the condition that the port type is a target port type and the port transmission information meets the preset condition comprises the following steps:
and controlling the switch module to be conducted under the condition that the port type is a target port type and the port transmission information meets the preset condition, wherein the metal shell is electrically connected with the grounding end.
6. An electronic device, characterized in that the electronic device comprises: the USB interface and a metal shell arranged around the USB interface;
the electronic device includes:
the determining module is used for determining the port type and port transmission information of the external equipment under the condition that the electronic equipment is detected to be accessed into the external equipment through the USB interface;
and the control module is used for controlling the metal shell to be grounded under the condition that the port type is a target port type and the port transmission information meets the preset condition.
7. The electronic device of claim 6, wherein the target port type is a standard downstream port SDP type, and the port transmission information meets the preset condition when a device type corresponding to the port transmission information is a preset device type.
8. The electronic device of claim 7, wherein the determining module comprises:
the acquisition unit is used for acquiring a positive electrode signal and a negative electrode signal of a differential signal line of the USB interface under the condition that the electronic equipment is detected to be connected to the external equipment through the USB interface;
a determining unit, configured to determine that a port type of the external device is the target port type if it is detected that a first voltage change value of the positive signal after the USB interface is connected to the external device is greater than a first threshold and a second voltage change value of the negative signal after the USB interface is connected to the external device is greater than a second threshold.
9. The electronic device of claim 6, wherein the determining module comprises:
and the determining unit is used for initiating a USB enumeration process and acquiring the port transmission information under the condition that the electronic equipment is detected to be accessed into the external equipment through the USB interface, wherein the port transmission information comprises enumeration information of the external equipment.
10. The electronic device of claim 6, further comprising a switch module, wherein the metal housing is electrically connected to a ground terminal via the switch module; the control module includes:
and the control unit is used for controlling the switch module to be conducted under the condition that the port type is a target port type and the port transmission information meets the preset condition, and the metal shell is electrically connected with the grounding end.
CN201911071262.6A 2019-11-05 2019-11-05 USB control method and electronic equipment Active CN110825682B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911071262.6A CN110825682B (en) 2019-11-05 2019-11-05 USB control method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911071262.6A CN110825682B (en) 2019-11-05 2019-11-05 USB control method and electronic equipment

Publications (2)

Publication Number Publication Date
CN110825682A true CN110825682A (en) 2020-02-21
CN110825682B CN110825682B (en) 2022-08-02

Family

ID=69552474

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911071262.6A Active CN110825682B (en) 2019-11-05 2019-11-05 USB control method and electronic equipment

Country Status (1)

Country Link
CN (1) CN110825682B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112148529A (en) * 2020-09-24 2020-12-29 杭州海康机器人技术有限公司 Data transmission method and device, camera, computing equipment and storage medium

Citations (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101030189A (en) * 2007-03-09 2007-09-05 华为技术有限公司 Method for inspecting connected peripheral apparatus mode, terminal, earphone, charger and USB interface
CN101604278A (en) * 2008-06-12 2009-12-16 英业达股份有限公司 The method for testing power supply of usb connecting port
US8073985B1 (en) * 2004-02-12 2011-12-06 Super Talent Electronics, Inc. Backward compatible extended USB plug and receptacle with dual personality
CN102662898A (en) * 2012-04-06 2012-09-12 华为技术有限公司 Host-slave compatibility method, device and system for USB (universal serial bus) device
CN102761624A (en) * 2012-06-07 2012-10-31 华为技术有限公司 Method and device for debugging Internet access out of panel and cable
CN103561369A (en) * 2013-10-31 2014-02-05 惠州Tcl移动通信有限公司 Usb interface circuit and electronic equipment
CN104461952A (en) * 2014-11-28 2015-03-25 广东欧珀移动通信有限公司 Interface sharing method and terminal
CN104573468A (en) * 2015-01-30 2015-04-29 北京世纪龙脉科技有限公司 Single-kernel security authentication device with multiple USB (universal serial bus) interfaces
CN104615569A (en) * 2014-12-31 2015-05-13 小米科技有限责任公司 Electronic equipment and data transmission system
CN105404603A (en) * 2015-10-26 2016-03-16 云顶科技(江苏)有限公司 Anti-interference driving circuit of USB interface
CN205920481U (en) * 2015-12-31 2017-02-01 意法半导体 (Alps) 有限公司 Signal generation circuit and electronic equipment
CN106445858A (en) * 2015-08-13 2017-02-22 联想(北京)有限公司 Information processing method, information processing module and electronic device
TW201712962A (en) * 2015-06-25 2017-04-01 英特爾公司 Electrostatic discharge for electronic device coupling
CN107645899A (en) * 2017-08-31 2018-01-30 广东欧珀移动通信有限公司 Electrostatic protection apparatus and electronic equipment
CN108155623A (en) * 2018-01-22 2018-06-12 华勤通讯技术有限公司 A kind of terminal USB interface guard method, terminal and external equipment
CN108352704A (en) * 2016-07-26 2018-07-31 华为技术有限公司 A kind of electrostatic discharge protective circuit
CN108845655A (en) * 2018-06-21 2018-11-20 Oppo广东移动通信有限公司 Control method of electronic device, device, control circuit and electronic equipment
CN109041555A (en) * 2018-07-16 2018-12-18 Oppo广东移动通信有限公司 Electronic equipment
CN109980460A (en) * 2019-02-22 2019-07-05 维沃移动通信有限公司 A kind of USB interface protection circuit and guard method, mobile terminal

Patent Citations (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8073985B1 (en) * 2004-02-12 2011-12-06 Super Talent Electronics, Inc. Backward compatible extended USB plug and receptacle with dual personality
CN101030189A (en) * 2007-03-09 2007-09-05 华为技术有限公司 Method for inspecting connected peripheral apparatus mode, terminal, earphone, charger and USB interface
CN101604278A (en) * 2008-06-12 2009-12-16 英业达股份有限公司 The method for testing power supply of usb connecting port
CN102662898A (en) * 2012-04-06 2012-09-12 华为技术有限公司 Host-slave compatibility method, device and system for USB (universal serial bus) device
CN102761624A (en) * 2012-06-07 2012-10-31 华为技术有限公司 Method and device for debugging Internet access out of panel and cable
CN103561369A (en) * 2013-10-31 2014-02-05 惠州Tcl移动通信有限公司 Usb interface circuit and electronic equipment
CN104461952A (en) * 2014-11-28 2015-03-25 广东欧珀移动通信有限公司 Interface sharing method and terminal
CN104615569A (en) * 2014-12-31 2015-05-13 小米科技有限责任公司 Electronic equipment and data transmission system
CN104573468A (en) * 2015-01-30 2015-04-29 北京世纪龙脉科技有限公司 Single-kernel security authentication device with multiple USB (universal serial bus) interfaces
TW201712962A (en) * 2015-06-25 2017-04-01 英特爾公司 Electrostatic discharge for electronic device coupling
CN106445858A (en) * 2015-08-13 2017-02-22 联想(北京)有限公司 Information processing method, information processing module and electronic device
CN105404603A (en) * 2015-10-26 2016-03-16 云顶科技(江苏)有限公司 Anti-interference driving circuit of USB interface
CN205920481U (en) * 2015-12-31 2017-02-01 意法半导体 (Alps) 有限公司 Signal generation circuit and electronic equipment
CN108352704A (en) * 2016-07-26 2018-07-31 华为技术有限公司 A kind of electrostatic discharge protective circuit
CN107645899A (en) * 2017-08-31 2018-01-30 广东欧珀移动通信有限公司 Electrostatic protection apparatus and electronic equipment
CN108155623A (en) * 2018-01-22 2018-06-12 华勤通讯技术有限公司 A kind of terminal USB interface guard method, terminal and external equipment
CN108845655A (en) * 2018-06-21 2018-11-20 Oppo广东移动通信有限公司 Control method of electronic device, device, control circuit and electronic equipment
CN109041555A (en) * 2018-07-16 2018-12-18 Oppo广东移动通信有限公司 Electronic equipment
CN109980460A (en) * 2019-02-22 2019-07-05 维沃移动通信有限公司 A kind of USB interface protection circuit and guard method, mobile terminal

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112148529A (en) * 2020-09-24 2020-12-29 杭州海康机器人技术有限公司 Data transmission method and device, camera, computing equipment and storage medium

Also Published As

Publication number Publication date
CN110825682B (en) 2022-08-02

Similar Documents

Publication Publication Date Title
CN108459797B (en) Control method of folding screen and mobile terminal
CN108347759B (en) Anti-interference method of flexible screen and mobile terminal
CN109343759B (en) Screen-turning display control method and terminal
CN111092621B (en) Radio frequency circuit, control method and electronic equipment
CN107887947B (en) Protection method for charging port and mobile terminal
CN110838748B (en) Electronic equipment and charging control system thereof
CN109560591B (en) Charging method, device and terminal
CN111106821B (en) Touch control method and wearable device
CN109888928B (en) Terminal and wireless charging control method
CN109639887B (en) Control method and terminal equipment
CN109995110B (en) Connector, electronic equipment, data transmission method and device
CN111459330B (en) Electronic equipment and pressure key operation method
CN111651387B (en) Interface circuit and electronic equipment
US20220413448A1 (en) Electronic device and control method
CN109443261B (en) Method for acquiring folding angle of folding screen mobile terminal and mobile terminal
CN108448177B (en) Charging method and terminal
CN111240451B (en) Heat dissipation method, electronic device and computer-readable storage medium
CN110825682B (en) USB control method and electronic equipment
CN110442261B (en) Electronic equipment and touch operation detection method thereof
CN108595352B (en) Protection method and device for mobile terminal
CN107995372B (en) False touch grounding identification processing method and circuit and mobile terminal
CN109067429B (en) Control method and terminal equipment
US20220416557A1 (en) Electronic device
CN111309390A (en) Method for acquiring configuration information and electronic equipment
CN110021981B (en) Charger and terminal

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