WO2018113128A1 - Method for recognizing plug-and-play device, and electronic device - Google Patents

Method for recognizing plug-and-play device, and electronic device Download PDF

Info

Publication number
WO2018113128A1
WO2018113128A1 PCT/CN2017/078625 CN2017078625W WO2018113128A1 WO 2018113128 A1 WO2018113128 A1 WO 2018113128A1 CN 2017078625 W CN2017078625 W CN 2017078625W WO 2018113128 A1 WO2018113128 A1 WO 2018113128A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
voltage threshold
voltage value
pin
voltage
Prior art date
Application number
PCT/CN2017/078625
Other languages
French (fr)
Chinese (zh)
Inventor
王朝
马雷
罗伟
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201780005058.7A priority Critical patent/CN108475245B/en
Publication of WO2018113128A1 publication Critical patent/WO2018113128A1/en

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/14Handling requests for interconnection or transfer
    • 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/14Handling requests for interconnection or transfer
    • G06F13/20Handling requests for interconnection or transfer for access to input/output bus
    • G06F13/24Handling requests for interconnection or transfer for access to input/output bus using interrupt
    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02JCIRCUIT ARRANGEMENTS OR SYSTEMS FOR SUPPLYING OR DISTRIBUTING ELECTRIC POWER; SYSTEMS FOR STORING ELECTRIC ENERGY
    • H02J7/00Circuit arrangements for charging or depolarising batteries or for supplying loads from batteries
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the embodiments of the present invention relate to the field of electronic device data interface technologies, and in particular, to a method and an electronic device for identifying a plug-and-play device.
  • On The Go (OTG) technology enables the connection of various electronic devices to exchange data without a host.
  • Electronic devices such as mobile devices, can be connected directly or indirectly to the USB connector of the OTG device via a tiny 5-pin (micro 5pin) or 10-pin universal serial bus (USB) connector.
  • GPIO general-purpose input/output
  • the GPIO interface When the general-purpose input/output (GPIO) interface of the electronic device detects that the identity (ID) pin of the USB connector outputs a low level, the GPIO interface generates an interrupt response to the central processor of the mobile device. (Central Processing Unit, CPU), to wake up the CPU, and instruct the CPU to have OTG device access, so that the mobile device enters the OTG mode for data transmission.
  • CPU Central Processing Unit
  • FIG. 1 is a schematic structural diagram of an electronic device connected to an OTG device. As shown in FIG. 1, the electronic device is connected to the OTG device through a USB integrated circuit (IC) device, that is, the electronic device is indirectly connected to the OTG device.
  • IC USB integrated circuit
  • the USB IC device recognizes that the ID pin is pulled low by detecting the resistance value of the ID pin of the OTG device's USB connector to the ground, and the USB IC device generates an INT interrupt response to the CPU or power management unit of the electronic device.
  • Management unit (PMU) to indicate that an OTG device is connected, and the electronic device enters the OTG mode.
  • the USB IC device reads the corresponding address inside the inter-integrated circuit (I2C) register to obtain the data to be transmitted, and at the same time, the USB IC device recognizes whether the resistance between the USB ID interface and the ground satisfies the OTG function.
  • the preset threshold value if satisfied, the electronic device and the OTG device perform data transmission.
  • connection structure between the above devices can accurately identify the connection to the OTG device, it is necessary to add a USB IC device, which is costly.
  • the embodiment of the invention provides a method for identifying a plug-and-play device and an electronic device. On the basis of not adding the device, the accuracy of identifying the electronic device into the OTG mode is improved, and the cost is reduced, and in the non-OTG mode. Turn off the Plug and Play OTG function to reduce power consumption.
  • a method for identifying a plug and play device may include:
  • the electronic device determines the device type of the external device according to the working state of the power bus pin of the universal serial bus USB connector.
  • the electronic device type is a charging device
  • the electronic device enters a charging mode.
  • the electronic device acquires a first voltage value of the ID pin of the USB connector through an analog to digital converter (ADC) interface.
  • ADC analog to digital converter
  • the first voltage value is a voltage value between the ID pin and the ground.
  • the electronic device avoids the mutual exclusion of the OTG function inserted into the OTG device and the charging process by first checking whether a charging device is inserted.
  • the electronic device turns off the plug-and-play OTG function and stops responding to an interrupt generated by the GPIO interface, the first voltage threshold being less than the second voltage threshold.
  • the method improves the accuracy of identifying the electronic device into the OTG mode, reduces the cost, and avoids the voltage fluctuation of the GPIO port in the non-OTG mode to frequently wake up the power consumption generated by the electronic device and prevent the error on the basis of not adding the device. Enter the OTG mode.
  • the method further includes: if the first voltage value is greater than the second voltage threshold, after the electronic device is initialized, detecting the working state of the power bus BUS pin again, and re-determining the device of the external device Types of.
  • the device type is a non-charging device
  • the second voltage value of the ID pin is obtained through the ADC interface.
  • the electronic device determines that the external device is a plug and play OTG device.
  • the method further includes: if the first voltage value is less than the first voltage threshold, the electronic device determines that the external device is an OTG device.
  • the first voltage threshold is the maximum voltage value of the ID pin.
  • the value can be expressed as: VCC*((r0+R)/(R1+R+r0)), where VCC is the access voltage of the electronic device, and r0 is the resistance of the wire in the connection between the OTG device and the electronic device, R1 is Pull-up resistor, R is the grounding resistance of the ID pin.
  • an electronic device having the function of implementing the behavior of the electronic device in the actual method described above.
  • This function can be implemented in hardware or in hardware by executing the corresponding software.
  • the hardware or software includes one or more modules corresponding to the functions described above.
  • another electronic device comprising: a memory and a processor.
  • the memory is used to store program instructions
  • the processor is configured to determine the device type of the external device according to the working state of the power bus pin of the USB connector.
  • the processor is further configured to enter a charging mode when the device type is a charging device; or, when the device type is a non-charging device, obtain a first voltage value of the ID pin of the USB connector. If the first voltage value is greater than the first voltage threshold and less than the second voltage threshold, the processor turns off the OTG function, the first voltage threshold being less than the second voltage threshold.
  • the processor determines the device type of the external device again after being initialized.
  • the device type is a non-charging type device
  • the second voltage value of the ID pin is obtained.
  • the processor determines that the external device is an OTG device.
  • the processor is further configured to determine that the external device is an OTG device if the first voltage value is less than the first voltage threshold.
  • the first voltage threshold is the maximum voltage value of the ID pin.
  • a computer storage medium for storing computer software instructions for use in the electronic device described above, including a program designed to perform the above aspects.
  • 1 is a schematic structural diagram of an electronic device connected to an OTG device
  • FIG. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
  • FIG. 3 is a schematic circuit diagram of an electronic device connected to an external device according to an embodiment of the present invention.
  • FIG. 4 is a flowchart of a method for identifying a plug and play device according to an embodiment of the present invention
  • FIG. 5 is a flowchart of another method for identifying a plug and play device according to an embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of another electronic device according to an embodiment of the present invention.
  • the identification method of the OTG function of the present application can be applied to the electronic device shown in FIG. 2.
  • the electronic device and the external device are connected via a USB connector.
  • the electronic device may be a digital camera, a video camera, or a mobile phone.
  • the external device can be a printer, a USB flash drive or a memory card.
  • the electronic device can include a processor and a USB connector.
  • the processor can include an analog to digital converter (ADC) interface and a GPIO interface.
  • ADC analog to digital converter
  • the ADC interface and the GPIO interface are respectively connected to the ID pin of the USB connector.
  • ADC interface for reading the voltage value of the ID pin of the USB connector.
  • the GPIO interface is used to obtain the level status of the ID pin of the USB connector, such as a high level (as indicated by 1) or a low level (as indicated by 0), and an interrupt response is sent to the electronic device.
  • the ID pin of the USB connector When the electronic device is not connected to an external device, the ID pin of the USB connector is left floating, and the level of the ID pin is high. When the electronic device is connected to the external device, the level of the ID pin changes to a low level, and the electronic device identifies whether the external device is an OTG device according to the voltage value read by the ADC interface.
  • the ADC interface reads the voltage value on the ID pin and transmits the voltage value to the processor of the electronic device. (such as CPU).
  • the electronic device recognizes that the external device is an OTG device; when the voltage value read by the ADC interface is greater than a preset threshold, the electronic device identifies the external device as a non-OTG device.
  • the GPIO sends an interrupt response to the electronic device to wake up the processor of the electronic device, such as a CPU, and the electronic device enters the OTG mode to perform data transmission with the external device.
  • the GPIO does not send an interrupt response to the electronic device, that is, the OTG interrupt response is turned off.
  • the circuit connection structure of the electronic device and the external device can be as shown in FIG. 3.
  • the USB connector is a 10-pin USB connector, wherein VBUS is a power bus pin. D+ and D- are data pins, GND is a ground pin, and S1-S5 are fixed pins for more securely attaching the USB connector to the soldering plate.
  • the ID pin of the USB connector is connected to the second end of the resistor R2, and the first end of the resistor R2 is connected to the electronic device
  • the GPIO interface is connected to wake up the CPU.
  • the ID pin of the USB connector is connected to the second end of the resistor R3, and the first end of the resistor R3 is connected to the ADC interface of the electronic device for transmitting the voltage value of the ID pin to the CPU.
  • VCC is the external voltage of the electronic device
  • R1 is the pull-up resistor.
  • the first end of the pull-up resistor R1 is connected to VCC, and the second end of the pull-up resistor R1 is connected to the second end of the resistor R2 at an intersection M.
  • the first end of the coupling capacitor C1 is grounded, and the second end of the coupling capacitor C1 is connected to the intersection M.
  • Data signals can be transmitted between the external device and the USB connector.
  • the user inserts and removes an external device for a long time, causing electrostatic discharge (ESD) or surge phenomenon generated by the ID pin, which may cause damage to the electronic device.
  • ESD electrostatic discharge
  • the resistor R1, the resistor R2 and the capacitor C1 are connected in parallel to form an RC filter, which can solve the problem of damage of the electronic device due to the above electrostatic discharge or surge phenomenon.
  • the resistance of R2 can be 2k ⁇
  • the resistance of R3 can be 10k ⁇ .
  • the grounding resistor R ie, the resistance between the ID pin and the GND pin
  • the CPU of the electronic device can obtain the voltage of the grounding resistor R through the ADC interface. value.
  • FIG. 4 is a flowchart of a method for identifying a plug and play device according to an embodiment of the present invention. As shown in FIG. 4, the method may include:
  • Step 410 The electronic device detects a level state on the ID pin of the USB connector, and determines whether it is connected to the external device.
  • the electronic device After the electronic device is turned on, it is determined whether the electronic device is connected to the external device according to the level state on the ID pin of the USB connector. For example, when the ID pin of the USB connector has a low level, the electronic device determines to connect with the external device, and conversely, the electronic device determines that the external device is not connected.
  • Step 420 The electronic device determines the device type of the external device according to the working state of the power bus pin of the USB connector.
  • the USB connector of the electronic device detects the working state of the power bus (VBUS) pin (or whether there is an external voltage), Determine the device type of the external device.
  • VBUS power bus
  • the electronic device determines that the external device is a charging device, and the electronic device enters the charging mode, and the interrupt response of the GPIO interface is turned off.
  • the electronic device acquires a first voltage value of the ID pin (ie, a first voltage value of the grounding resistance R) through the ADC interface, and the first voltage value It is used to identify the external connection of the USB connector of the electronic device (for example, the connected external device is a non-charging device or is not connected to an external device).
  • the first voltage value is a voltage value of the grounding resistance R.
  • the electronic device avoids the mutual exclusion of the OTG function and the charging function of the OTG device by first checking whether a charging device is inserted.
  • Step 430 The electronic device identifies, according to a comparison result of the first voltage value of the ID pin and the first voltage threshold and the second voltage threshold, whether the electronic device enters the OTG mode.
  • the resistor R1 is connected in series with the grounding resistor R, that is, the grounding resistor R and the resistor R1 are divided, and the voltage value of the grounding resistor R can be expressed as VCC*(R/(R1+R)).
  • the maximum resistance Rm of the grounding resistance is (r0+R).
  • the maximum resistance Rm corresponds to
  • the voltage value is a first voltage threshold, which can be expressed as VCC*((r0+R)/(R1+R+r0)), ie the first voltage threshold is the maximum voltage value on the ID pin.
  • the second voltage threshold is a preset voltage threshold of the electronic device.
  • the value of the second voltage threshold is between a voltage value between the maximum voltage safety threshold of the electronic device and the minimum voltage safety threshold.
  • VCC is 3V
  • the first voltage threshold is less than the minimum voltage safety threshold of the electronic device, that is, the first voltage threshold is less than the second voltage threshold, for example, the first voltage threshold may be 0.15V, and the second voltage threshold may be 1.25V.
  • the electronic device After the electronic device acquires the first voltage value of the grounding resistance R through the ADC interface, the electronic device compares the first voltage value with the first voltage threshold and the second voltage threshold, respectively.
  • the electronic device determines that the external device is an OTG device, turns on the GPIO interrupt response, and the electronic device enters the OTG mode to perform data transmission with the OTG device.
  • the electronic device When the first voltage value is greater than the first voltage threshold and less than the second voltage threshold, the electronic device actively turns off the GPIO interrupt response to avoid the GPIO port voltage fluctuation to frequently wake up the power consumption generated by the electronic device, and prevent the erroneous entry into the OTG mode.
  • the GPIO port voltage fluctuation may be caused by the electronic device user being used for a long time, causing the USB interface to be dirty, and the GPIO port voltage fluctuation occurs.
  • the interrupt response of the GPIO is turned on, and the electronic device determines that there is no external device at this time, that is, the electronic device is in the standby state.
  • the electronic device initializes the processor and detects whether an external device is inserted, and turns on the interrupt response of the GPIO.
  • the electronic device If the electronic device has an external device inserted, the electronic device first determines whether the external device is a charging device.
  • the electronic device enters the charging mode and turns off the GPIO interrupt response.
  • the electronic device If the external device is a non-charging device and a low level is recognized on the GPIO interface, the electronic device reads the second voltage value of the grounding resistance R through the ADC interface, and when the second voltage value is less than the first voltage threshold, the electronic device Enter the OTG mode.
  • the electronic device is used as a mobile phone, and the OTG device is a USB disk as an example for detailed description.
  • step 510 is executed, and the processor in the mobile phone detects that the ID pin is low level through the GPIO interface, and determines to access the external device.
  • Step 520 The processor in the mobile phone detects whether an external voltage exists in the BUS pin;
  • step 530 If yes, go to step 530 and the mobile phone enters the charging mode.
  • step 540 the processor in the mobile phone acquires the voltage value V1 of the ID pin through the ADC interface.
  • Step 550 The processor in the mobile phone compares V1 with the first voltage threshold and the preset second voltage threshold respectively;
  • Step 560 V1 is smaller than the first voltage threshold, and the processor in the mobile phone determines that the external device is a U disk. At this time, the interrupt response of the GPIO is turned on, and the mobile phone enters the OTG mode to perform data transmission with the U disk.
  • Step 570 V1 is greater than the first voltage threshold, and is less than the second voltage threshold, and the processor in the mobile phone actively closes GPIO interrupt response.
  • Step 580 V1 is greater than the second voltage threshold, and the processor in the mobile phone turns on the interrupt response of the GPIO, and is in a standby state.
  • Step 590 the processor in the mobile phone initializes, and after the GPIO interface recognizes that there is a low level on the ID pin, it is determined whether the external voltage exists in the BUS pin;
  • step 530 If yes, go to step 530 and the mobile phone enters the charging mode.
  • step 600 is performed, and the processor in the mobile phone acquires the voltage value V2 on the ID pin through the ADC interface.
  • step 610 is executed, and the processor in the mobile phone determines that the external device is a USB flash drive. At this time, the interrupt response of the GPIO is turned on, and the mobile phone enters the OTG mode to perform data transmission with the USB flash drive.
  • step 620 is executed, the processor in the mobile phone turns on the GPIO interrupt response, is in the standby state, and proceeds to step 590.
  • the embodiment of the present invention further provides another electronic device, corresponding to the foregoing method for identifying the plug and play device.
  • the electronic device can include a processing unit 630.
  • the processing unit 630 is configured to determine, according to an operating state of a power bus pin of the USB connector of the device, a device type of the external device;
  • the processing unit 630 is further configured to enter a charging mode when the device type is a charging device; or, when the device type is a non-charging device, acquire a first voltage value of an ID pin of the USB connector.
  • the processing unit 630 turns off the OTG function, the first voltage threshold being less than the second voltage threshold.
  • the processing unit 630 after being initialized, detects an operating state of the power bus pin, and determines the device type of the external device again.
  • the processing unit is further configured to acquire a second voltage value of the ID pin when the device type is a non-charging type device according to an operating state of the power bus pin.
  • the processing unit determines that the external device is an OTG device.
  • the processing unit 630 is further configured to determine that the external device is an OTG device if the first voltage value is less than the first voltage threshold.
  • the first voltage threshold is a maximum voltage value of the ID pin.
  • the embodiment of the present invention further provides another electronic device, corresponding to the foregoing method for identifying the plug and play device.
  • the electronic device can include a processor 710, a memory 720, an ADC interface 730, a GPIO interface 740, and a USB connector 750.
  • the processor 710 can include a GPIO module 711 and an ADC 712.
  • the processor 710 can be a central processing unit (CPU), or a combination of a CPU and a hardware chip.
  • the hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof.
  • ASIC application-specific integrated circuit
  • PLD programmable logic device
  • On The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a general array logic (GAL), or any combination thereof.
  • CPLD complex programmable logic device
  • FPGA field-programmable gate array
  • GAL general array logic
  • the memory 720 may include a volatile memory such as a random-access memory (RAM); the memory 720 may also include a non-volatile memory such as a read-only memory (read) -only memory, ROM), flash memory, hard disk drive (HDD) or solid-state drive (SSD).
  • RAM random-access memory
  • ROM read-only memory
  • HDD hard disk drive
  • SSD solid-state drive
  • Memory 720 can also include a combination of the above types of memory.
  • the memory 720 stores the program code and transmits the stored program code to the processor 710.
  • the processor 710 is configured to determine a device type of the external device according to an operating state of the power bus pin of the USB connector 750 of the device.
  • the processor 710 is further configured to enter a charging mode when the device type is a charging device; or, when the device type is a non-charging device, acquire the first voltage value of the ID pin of the USB connector 750 through the ADC interface 730. . If the first voltage value is greater than the first voltage threshold and less than the second voltage threshold, the processor 710 turns off the interrupt response of the GPIO interface 740 in the GPIO module 711, that is, turns off the OTG function, and the first voltage threshold is less than the second voltage threshold.
  • the ADC 712 in the processor 710 is initialized, detects the working state of the power bus pin of the USB connector 750, and determines the device type of the external device again;
  • the processor 710 is further configured to acquire a second voltage value of the ID pin through the ADC interface 730 when the device type is a non-charging type device according to an operating state of the power bus pin. When the second voltage value is less than the first voltage threshold, the processor 710 determines that the external device is an OTG device.
  • the processor 710 is further configured to determine that the external device is an OTG device if the first voltage value is less than the first voltage threshold.
  • the first voltage threshold is a maximum voltage value of the ID pin.
  • Non-transitory medium such as random access memory, read only memory, flash memory, hard disk, solid state disk, magnetic tape, floppy disk, optical disc, and any combination thereof.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Power Sources (AREA)
  • Charge And Discharge Circuits For Batteries Or The Like (AREA)

Abstract

The embodiments of the present invention relate to a method for recognizing a plug-and-play device, and an electronic device. In this method, an electronic device determines a device type of an external device according to a working state of a power bus pin of a universal serial bus (USB) connector. When the device type is a charging-type device, the electronic device enters a charging mode. Alternatively, when the device type is a non-charging-type device, the electronic device acquires a first voltage value of an ID pin of the USB connector. If the first voltage value is greater than a first voltage threshold and is less than a second voltage threshold, the electronic device turns off a plug-and-play OTG function, and the first voltage threshold is less than the second voltage threshold. The method improves the accuracy of identifying the electronic device entering an OTG mode without adding a device, reduces costs, and at the same time, avoids the power consumption generated by frequently awakening the electronic device due to voltage fluctuations of a GPIO port in a non-OTG mode, and prevents the OTG mode from being entered by mistake.

Description

即插即用设备的识别方法和电子设备Plug-and-play device identification method and electronic device
本申请要求2016年12月20日提交中国专利局、申请号为201611186660.9、发明名称为“一种在电子设备上实现OTG功能的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请文件中。仅仅是为了简洁表述,其全部内容不在本申请文件中再原文重复一遍。The present application claims priority to Chinese Patent Application, filed on Dec. 20, 2016, to the Chinese Patent Office, Application No. 201611186660.9, entitled "A Method and Apparatus for Implementing OTG Functions on Electronic Devices", the entire contents of which are incorporated by reference. Combined in this application. For the sake of brevity, the entire contents are not repeated in the original application.
技术领域Technical field
本申请实施例涉及电子设备数据接口技术领域,尤其涉及一种即插即用设备的识别方法和电子设备。The embodiments of the present invention relate to the field of electronic device data interface technologies, and in particular, to a method and an electronic device for identifying a plug-and-play device.
背景技术Background technique
即插即用(On The Go,OTG)技术可以在没有主机(Host)的情况下,实现各种不同的电子设备间的连接,以进行数据交换。On The Go (OTG) technology enables the connection of various electronic devices to exchange data without a host.
电子设备(如移动设备)可以通过微型5引脚(micro 5pin)或10引脚的通用串行总线(universal serial bus,USB)连接器直接或间接与OTG设备的USB连接器相连。当电子设备的通用输入或输出(general-purpose input/output,GPIO)接口检测到USB连接器的标识(identity,ID)引脚输出低电平时,GPIO接口产生中断响应至移动设备的中央处理器(Central Processing Unit,CPU),以唤醒CPU,并指示CPU有OTG设备接入,使移动设备进入OTG模式,进行数据传输。Electronic devices, such as mobile devices, can be connected directly or indirectly to the USB connector of the OTG device via a tiny 5-pin (micro 5pin) or 10-pin universal serial bus (USB) connector. When the general-purpose input/output (GPIO) interface of the electronic device detects that the identity (ID) pin of the USB connector outputs a low level, the GPIO interface generates an interrupt response to the central processor of the mobile device. (Central Processing Unit, CPU), to wake up the CPU, and instruct the CPU to have OTG device access, so that the mobile device enters the OTG mode for data transmission.
图1为一种电子设备与OTG设备连接的结构示意图。如图1所示,电子设备通过USB集成电路(integrated circuit,IC)设备与OTG设备相连,即电子设备与OTG设备间接相连。FIG. 1 is a schematic structural diagram of an electronic device connected to an OTG device. As shown in FIG. 1, the electronic device is connected to the OTG device through a USB integrated circuit (IC) device, that is, the electronic device is indirectly connected to the OTG device.
USB IC设备通过检测OTG设备的USB连接器的ID引脚对地的阻值,识别出ID引脚被拉低,此时USB IC设备产生INT中断响应至电子设备的CPU或电源管理单元(power management unit,PMU),以指示有OTG设备接入,电子设备进入OTG模式。USB IC设备读取内部整合电路(inter-integrated circuit,I2C)寄存器内部相应的地址,获取待传输的数据,同时,USB IC设备识别此时USB ID接口与地之间的阻值是否满足OTG功能的预设门限值,若满足,电子设备与OTG设备进行数据传输。The USB IC device recognizes that the ID pin is pulled low by detecting the resistance value of the ID pin of the OTG device's USB connector to the ground, and the USB IC device generates an INT interrupt response to the CPU or power management unit of the electronic device. Management unit (PMU) to indicate that an OTG device is connected, and the electronic device enters the OTG mode. The USB IC device reads the corresponding address inside the inter-integrated circuit (I2C) register to obtain the data to be transmitted, and at the same time, the USB IC device recognizes whether the resistance between the USB ID interface and the ground satisfies the OTG function. The preset threshold value, if satisfied, the electronic device and the OTG device perform data transmission.
然而,上述设备间的连接结构虽然能够精确识别连接到OTG设备,但需要增加USB IC设备,成本较高。However, although the connection structure between the above devices can accurately identify the connection to the OTG device, it is necessary to add a USB IC device, which is costly.
发明内容Summary of the invention
本发明实施例提供了一种即插即用设备的识别方法和电子设备,在不外加设备的基础上,提高了识别电子设备进入OTG模式的精确度,降低了成本,同时在非OTG模式下关闭即插即用OTG功能,降低了功耗。The embodiment of the invention provides a method for identifying a plug-and-play device and an electronic device. On the basis of not adding the device, the accuracy of identifying the electronic device into the OTG mode is improved, and the cost is reduced, and in the non-OTG mode. Turn off the Plug and Play OTG function to reduce power consumption.
第一方面,提供了一种即插即用设备的识别方法,该方法可以包括: In a first aspect, a method for identifying a plug and play device is provided, and the method may include:
电子设备根据通用串行总线USB连接器的电源总线引脚的工作状态,确定外接设备的设备类型。当设备类型为充电类设备时,电子设备进入充电模式。当设备类型为非充电类设备时,电子设备通过模数转换器(analog to digital converter,ADC)接口获取USB连接器的ID引脚的第一电压值。其中,第一电压值为ID引脚与地之间的电压值。该电子设备通过先检查是否有充电类设备插入,避免了插入OTG设备的OTG功能与充电过程的互斥性。若第一电压值大于第一电压阈值,且小于第二电压阈值,则电子设备关闭即插即用OTG功能并停止响应GPIO接口产生的中断,第一电压阈值小于第二电压阈值。该方法在不外加设备的基础上,提高了识别电子设备进入OTG模式的精确度,降低了成本,同时避免了非OTG模式下GPIO口电压波动来频繁唤醒电子设备产生的功耗,以及防止误进入OTG模式。The electronic device determines the device type of the external device according to the working state of the power bus pin of the universal serial bus USB connector. When the device type is a charging device, the electronic device enters a charging mode. When the device type is a non-charging device, the electronic device acquires a first voltage value of the ID pin of the USB connector through an analog to digital converter (ADC) interface. The first voltage value is a voltage value between the ID pin and the ground. The electronic device avoids the mutual exclusion of the OTG function inserted into the OTG device and the charging process by first checking whether a charging device is inserted. If the first voltage value is greater than the first voltage threshold and less than the second voltage threshold, the electronic device turns off the plug-and-play OTG function and stops responding to an interrupt generated by the GPIO interface, the first voltage threshold being less than the second voltage threshold. The method improves the accuracy of identifying the electronic device into the OTG mode, reduces the cost, and avoids the voltage fluctuation of the GPIO port in the non-OTG mode to frequently wake up the power consumption generated by the electronic device and prevent the error on the basis of not adding the device. Enter the OTG mode.
在一个可选的实现中,该方法还包括:若第一电压值大于所述第二电压阈值,则电子设备经初始化后,再次检测电源总线BUS引脚的工作状态,重新确定外接设备的设备类型。当设备类型为非充电类设备时,通过ADC接口获取ID引脚的第二电压值。当第二电压值小于第一电压阈值时,电子设备确定外接设备为即插即用OTG设备。In an optional implementation, the method further includes: if the first voltage value is greater than the second voltage threshold, after the electronic device is initialized, detecting the working state of the power bus BUS pin again, and re-determining the device of the external device Types of. When the device type is a non-charging device, the second voltage value of the ID pin is obtained through the ADC interface. When the second voltage value is less than the first voltage threshold, the electronic device determines that the external device is a plug and play OTG device.
在一个可选的实现中,该方法还包括:若第一电压值小于第一电压阈值,则电子设备确定外接设备为OTG设备。In an optional implementation, the method further includes: if the first voltage value is less than the first voltage threshold, the electronic device determines that the external device is an OTG device.
在一个可选的实现中,第一电压阈值为ID引脚的最大电压值。其值可以表示为:VCC*((r0+R)/(R1+R+r0)),其中VCC为电子设备的接入电压,r0为OTG设备与电子设备连接中的导线的电阻,R1为上拉电阻,R为ID引脚的接地电阻。In an alternative implementation, the first voltage threshold is the maximum voltage value of the ID pin. The value can be expressed as: VCC*((r0+R)/(R1+R+r0)), where VCC is the access voltage of the electronic device, and r0 is the resistance of the wire in the connection between the OTG device and the electronic device, R1 is Pull-up resistor, R is the grounding resistance of the ID pin.
第二方面,提供了一种电子设备,该电子设备具有实现上述方法实际中电子设备行为的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块。In a second aspect, an electronic device is provided having the function of implementing the behavior of the electronic device in the actual method described above. This function can be implemented in hardware or in hardware by executing the corresponding software. The hardware or software includes one or more modules corresponding to the functions described above.
第三方面,提供了另一种电子设备,该电子设备包括:存储器和处理器。存储器用于存储程序指令,处理器用于根据USB连接器的电源总线引脚的工作状态,确定外接设备的设备类型。处理器还用于当设备类型为充电类设备时,进入充电模式;或者,当设备类型为非充电类设备时,获取USB连接器的ID引脚的第一电压值。若第一电压值大于第一电压阈值,且小于第二电压阈值,则处理器关闭OTG功能,第一电压阈值小于第二电压阈值。In a third aspect, another electronic device is provided, the electronic device comprising: a memory and a processor. The memory is used to store program instructions, and the processor is configured to determine the device type of the external device according to the working state of the power bus pin of the USB connector. The processor is further configured to enter a charging mode when the device type is a charging device; or, when the device type is a non-charging device, obtain a first voltage value of the ID pin of the USB connector. If the first voltage value is greater than the first voltage threshold and less than the second voltage threshold, the processor turns off the OTG function, the first voltage threshold being less than the second voltage threshold.
在一个可选的实现中,若第一电压值大于第二电压阈值,则处理器经初始化后,再次确定外接设备的设备类型。当设备类型为非充电类设备时,获取ID引脚的第二电压值。当第二电压值小于第一电压阈值时,处理器确定外接设备为OTG设备。In an optional implementation, if the first voltage value is greater than the second voltage threshold, the processor determines the device type of the external device again after being initialized. When the device type is a non-charging type device, the second voltage value of the ID pin is obtained. When the second voltage value is less than the first voltage threshold, the processor determines that the external device is an OTG device.
在一个可选的实现中,处理器还用于若第一电压值小于第一电压阈值,则确定外接设备为OTG设备。In an optional implementation, the processor is further configured to determine that the external device is an OTG device if the first voltage value is less than the first voltage threshold.
在一个可选的实现中,第一电压阈值为ID引脚的最大电压值。In an alternative implementation, the first voltage threshold is the maximum voltage value of the ID pin.
再一方面,提供了一种计算机存储介质,用于储存为上述电子设备所用的计算机软件指令,其包含用于执行上述方面所设计的程序。 In still another aspect, a computer storage medium is provided for storing computer software instructions for use in the electronic device described above, including a program designed to perform the above aspects.
附图说明DRAWINGS
图1为一种电子设备与OTG设备连接的结构示意图;1 is a schematic structural diagram of an electronic device connected to an OTG device;
图2为本发明实施例提供的一种电子设备的结构示意图;2 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
图3为本发明实施例提供的一种电子设备与外接设备连接的电路示意图;3 is a schematic circuit diagram of an electronic device connected to an external device according to an embodiment of the present invention;
图4为本发明实施例提供的一种即插即用设备的识别方法的流程图;4 is a flowchart of a method for identifying a plug and play device according to an embodiment of the present invention;
图5为本发明实施例提供的另一种即插即用设备的识别方法的流程图;FIG. 5 is a flowchart of another method for identifying a plug and play device according to an embodiment of the present invention;
图6为本发明实施例提供的一种电子设备的结构示意图;FIG. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure;
图7为本发明实施例提供的另一种电子设备的结构示意图。FIG. 7 is a schematic structural diagram of another electronic device according to an embodiment of the present invention.
具体实施方式detailed description
下面通过附图和实施例,对本申请的技术方案做进一步的详细描述。The technical solutions of the present application are further described in detail below through the accompanying drawings and embodiments.
本申请OTG功能的识别方法可以应用在图2所示的电子设备中。电子设备和外接设备通过USB连接器进行连接。The identification method of the OTG function of the present application can be applied to the electronic device shown in FIG. 2. The electronic device and the external device are connected via a USB connector.
其中,电子设备可以是数码照相机、摄像机或手机等。外接设备可以是打印机、U盘或存储卡等。The electronic device may be a digital camera, a video camera, or a mobile phone. The external device can be a printer, a USB flash drive or a memory card.
如图2所示,该电子设备可以包括处理器和USB连接器。处理器可以包括模数转换器(analog to digital converter,ADC)接口和GPIO接口。As shown in FIG. 2, the electronic device can include a processor and a USB connector. The processor can include an analog to digital converter (ADC) interface and a GPIO interface.
其中,ADC接口与GPIO接口分别与USB连接器的ID引脚相连。The ADC interface and the GPIO interface are respectively connected to the ID pin of the USB connector.
ADC接口,用于读取USB连接器的ID引脚的电压值。ADC interface for reading the voltage value of the ID pin of the USB connector.
GPIO接口,用于获取USB连接器的ID引脚的电平状态,如高电平(如用1表示)或低电平(如用0表示),以及向电子设备发送中断响应。The GPIO interface is used to obtain the level status of the ID pin of the USB connector, such as a high level (as indicated by 1) or a low level (as indicated by 0), and an interrupt response is sent to the electronic device.
当电子设备没有与外接设备连接时,USB连接器的ID引脚悬空,此时ID引脚的电平为高电平。当电子设备与外接设备连接时,此时ID引脚的电平变为低电平,电子设备根据ADC接口读取的电压值,识别外接设备是否为OTG设备。When the electronic device is not connected to an external device, the ID pin of the USB connector is left floating, and the level of the ID pin is high. When the electronic device is connected to the external device, the level of the ID pin changes to a low level, and the electronic device identifies whether the external device is an OTG device according to the voltage value read by the ADC interface.
例如,当电子设备与外接设备连接,GPIO接口获取的ID引脚上的电平为低电平时,ADC接口读取ID引脚上的电压值,并将该电压值传输至电子设备的处理器(如CPU)。当ADC接口读取的电压值小于预设阈值时,电子设备识别外接设备为OTG设备;当ADC接口读取的电压值大于预设阈值时,电子设备识别外接设备为非OTG设备。For example, when an electronic device is connected to an external device and the level on the ID pin acquired by the GPIO interface is low, the ADC interface reads the voltage value on the ID pin and transmits the voltage value to the processor of the electronic device. (such as CPU). When the voltage value read by the ADC interface is less than the preset threshold, the electronic device recognizes that the external device is an OTG device; when the voltage value read by the ADC interface is greater than a preset threshold, the electronic device identifies the external device as a non-OTG device.
若外接设备是OTG设备,GPIO发送中断响应至电子设备,以唤醒电子设备的处理器,如CPU,电子设备进入OTG模式,与外接设备进行数据传输。If the external device is an OTG device, the GPIO sends an interrupt response to the electronic device to wake up the processor of the electronic device, such as a CPU, and the electronic device enters the OTG mode to perform data transmission with the external device.
若外接设备不是OTG设备,GPIO不发送中断响应至电子设备,即关闭OTG的中断响应。If the external device is not an OTG device, the GPIO does not send an interrupt response to the electronic device, that is, the OTG interrupt response is turned off.
由此可知,本申请上述方法在不外加设备的基础上,能够保证精确识别是否进入OTG模式,从而降低了成本。It can be seen that the above method of the present application can ensure accurate identification of whether to enter the OTG mode without adding equipment, thereby reducing the cost.
与图2的结构示意图对应的,电子设备与外接设备连接的电路连接结构可以如图3所示,图3中,USB连接器为10管脚的USB连接器,其中VBUS为电源总线引脚,D+与D-为数据引脚,GND为接地引脚,S1-S5为固定引脚,以用于将USB连接器更加牢固的固定在焊板上。USB连接器的ID引脚与电阻R2的第二端连接,电阻R2的第一端与电子设备的 GPIO接口连接,以用于唤醒CPU。USB连接器的ID引脚与电阻R3的第二端连接,电阻R3的第一端与电子设备的ADC接口连接,以用于将ID引脚的电压值发送至CPU。VCC为电子设备的外接电压,R1为上拉电阻。上拉电阻R1的第一端接VCC,上拉电阻R1的第二端与电阻R2的第二端相连于一交点M。耦合电容C1的第一端接地,耦合电容C1的第二端与交点M相连。外接设备与USB连接器间可进行数据信号的传输。Corresponding to the structural diagram of FIG. 2, the circuit connection structure of the electronic device and the external device can be as shown in FIG. 3. In FIG. 3, the USB connector is a 10-pin USB connector, wherein VBUS is a power bus pin. D+ and D- are data pins, GND is a ground pin, and S1-S5 are fixed pins for more securely attaching the USB connector to the soldering plate. The ID pin of the USB connector is connected to the second end of the resistor R2, and the first end of the resistor R2 is connected to the electronic device The GPIO interface is connected to wake up the CPU. The ID pin of the USB connector is connected to the second end of the resistor R3, and the first end of the resistor R3 is connected to the ADC interface of the electronic device for transmitting the voltage value of the ID pin to the CPU. VCC is the external voltage of the electronic device, and R1 is the pull-up resistor. The first end of the pull-up resistor R1 is connected to VCC, and the second end of the pull-up resistor R1 is connected to the second end of the resistor R2 at an intersection M. The first end of the coupling capacitor C1 is grounded, and the second end of the coupling capacitor C1 is connected to the intersection M. Data signals can be transmitted between the external device and the USB connector.
其中,用户长时间插拔外接设备,使ID引脚所产生的静电放电(electrostatic disch arge,ESD)或浪涌现象,可能导致电子设备损坏。图3中,电阻R1、电阻R2和电容C1两两并联组成RC滤波器,可以解决由于上述静电放电或浪涌现象而导致的电子设备损坏的问题。其中,R2的阻值可以为2kΩ,R3的阻值可以为10kΩ。Among them, the user inserts and removes an external device for a long time, causing electrostatic discharge (ESD) or surge phenomenon generated by the ID pin, which may cause damage to the electronic device. In FIG. 3, the resistor R1, the resistor R2 and the capacitor C1 are connected in parallel to form an RC filter, which can solve the problem of damage of the electronic device due to the above electrostatic discharge or surge phenomenon. Among them, the resistance of R2 can be 2kΩ, and the resistance of R3 can be 10kΩ.
可选地,当电子设备有外接设备接入时,ID引脚上存在接地电阻R(即ID引脚与GND引脚间的电阻),电子设备的CPU可以通过ADC接口获取接地电阻R的电压值。Optionally, when the electronic device has an external device, the grounding resistor R (ie, the resistance between the ID pin and the GND pin) exists on the ID pin, and the CPU of the electronic device can obtain the voltage of the grounding resistor R through the ADC interface. value.
图4为本发明实施例提供的一种即插即用设备的识别方法的流程图。如图4所示,该方法可以包括:FIG. 4 is a flowchart of a method for identifying a plug and play device according to an embodiment of the present invention. As shown in FIG. 4, the method may include:
步骤410、电子设备检测USB连接器的ID引脚上的电平状态,判断是否与外接设备连接。Step 410: The electronic device detects a level state on the ID pin of the USB connector, and determines whether it is connected to the external device.
电子设备开机后,根据USB连接器的ID引脚上的电平状态,识别电子设备是否与外接设备连接。例如,当USB连接器的ID引脚存在低电平时,电子设备确定与外接设备连接,反之,电子设备确定未与外接设备连接。After the electronic device is turned on, it is determined whether the electronic device is connected to the external device according to the level state on the ID pin of the USB connector. For example, when the ID pin of the USB connector has a low level, the electronic device determines to connect with the external device, and conversely, the electronic device determines that the external device is not connected.
步骤420、电子设备根据USB连接器的电源总线引脚的工作状态,确定外接设备的设备类型。Step 420: The electronic device determines the device type of the external device according to the working state of the power bus pin of the USB connector.
在USB连接器的ID引脚存在低电平(即电子设备与外接设备连接)的情况下,电子设备的USB连接器检测电源总线(VBUS)引脚的工作状态(或有无外部电压),确定外接设备的设备类型。VBUS引脚存在外部电压是指VBUS引脚有输入电压。In the case where the ID pin of the USB connector is low (that is, the electronic device is connected to an external device), the USB connector of the electronic device detects the working state of the power bus (VBUS) pin (or whether there is an external voltage), Determine the device type of the external device. The presence of an external voltage on the VBUS pin means that the VBUS pin has an input voltage.
当VBUS引脚存在外部电压时,电子设备确定该外接设备为充电设备,电子设备进入充电模式,此时关闭GPIO接口的中断响应。When there is an external voltage on the VBUS pin, the electronic device determines that the external device is a charging device, and the electronic device enters the charging mode, and the interrupt response of the GPIO interface is turned off.
当VBUS引脚不存在外部电压(即外接设备为非充电设备)时,电子设备通过ADC接口获取ID引脚的第一电压值(即接地电阻R的第一电压值),该第一电压值用于识别电子设备USB连接器的外接情况(如接入的外接设备为非充电设备或未接入外接设备)。其中,当VBUS引脚有输入电压时,VBUS引脚存在外部电压。在图3中,第一电压值为接地电阻R的电压值。When the VBUS pin does not have an external voltage (that is, the external device is a non-charging device), the electronic device acquires a first voltage value of the ID pin (ie, a first voltage value of the grounding resistance R) through the ADC interface, and the first voltage value It is used to identify the external connection of the USB connector of the electronic device (for example, the connected external device is a non-charging device or is not connected to an external device). Among them, when the VBUS pin has an input voltage, there is an external voltage on the VBUS pin. In FIG. 3, the first voltage value is a voltage value of the grounding resistance R.
由此可知,电子设备通过先检查是否有充电类设备插入,避免了插入OTG设备的OTG功能与充电功能的互斥性。It can be seen that the electronic device avoids the mutual exclusion of the OTG function and the charging function of the OTG device by first checking whether a charging device is inserted.
步骤430、电子设备根据ID引脚的第一电压值分别与第一电压阈值和第二电压阈值的比较结果,识别电子设备是否进入OTG模式。Step 430: The electronic device identifies, according to a comparison result of the first voltage value of the ID pin and the first voltage threshold and the second voltage threshold, whether the electronic device enters the OTG mode.
结合图3,电阻R1与接地电阻R串联,也就是说,接地电阻R与电阻R1分压,接地电阻R的电压值可以表示为VCC*(R/(R1+R))。 Referring to FIG. 3, the resistor R1 is connected in series with the grounding resistor R, that is, the grounding resistor R and the resistor R1 are divided, and the voltage value of the grounding resistor R can be expressed as VCC*(R/(R1+R)).
可选地,OTG设备插入电子设备后,考虑到OTG设备与电子设备连接中的导线会存在的一定的电阻r0,故接地电阻的最大阻值Rm为(r0+R).最大阻值Rm对应的电压值为第一电压阈值,其可以表示为VCC*((r0+R)/(R1+R+r0)),即第一电压阈值为ID引脚上的最大电压值。Optionally, after the OTG device is inserted into the electronic device, considering the certain resistance r0 that the wire in the connection between the OTG device and the electronic device exists, the maximum resistance Rm of the grounding resistance is (r0+R). The maximum resistance Rm corresponds to The voltage value is a first voltage threshold, which can be expressed as VCC*((r0+R)/(R1+R+r0)), ie the first voltage threshold is the maximum voltage value on the ID pin.
可选地,第二电压阈值为电子设备预设的电压阈值。第二电压阈值的取值在电子设备的最大电压安全阈值与最小电压安全阈值间的电压值之间。例如VCC为3V,电子设备的最大电压安全阈值为3*(3/4)=2.25V,最小电压安全阈值为3*(1/4)=0.75V。也就是说,第二电压阈值大于0.75V,且小于2.25V,如第二电压阈值可以为1.25V。Optionally, the second voltage threshold is a preset voltage threshold of the electronic device. The value of the second voltage threshold is between a voltage value between the maximum voltage safety threshold of the electronic device and the minimum voltage safety threshold. For example, VCC is 3V, the maximum voltage safety threshold of the electronic device is 3*(3/4)=2.25V, and the minimum voltage safety threshold is 3*(1/4)=0.75V. That is, the second voltage threshold is greater than 0.75V and less than 2.25V, as the second voltage threshold may be 1.25V.
需要说明的是,第一电压阈值小于电子设备的最小电压安全阈值,即第一电压阈值小于第二电压阈值,如第一电压阈值可以为0.15V,第二电压阈值可以为1.25V。It should be noted that the first voltage threshold is less than the minimum voltage safety threshold of the electronic device, that is, the first voltage threshold is less than the second voltage threshold, for example, the first voltage threshold may be 0.15V, and the second voltage threshold may be 1.25V.
电子设备通过ADC接口获取接地电阻R的第一电压值后,电子设备将第一电压值分别与第一电压阈值和第二电压阈值进行比较。After the electronic device acquires the first voltage value of the grounding resistance R through the ADC interface, the electronic device compares the first voltage value with the first voltage threshold and the second voltage threshold, respectively.
当第一电压值小于第一电压阈值时,电子设备确定外接设备为OTG设备,开启GPIO的中断响应,电子设备进入OTG模式,与OTG设备进行数据传输。When the first voltage value is less than the first voltage threshold, the electronic device determines that the external device is an OTG device, turns on the GPIO interrupt response, and the electronic device enters the OTG mode to perform data transmission with the OTG device.
当第一电压值大于第一电压阈值,且小于第二电压阈值时,电子设备主动关闭GPIO的中断响应,以避免GPIO口电压波动来频繁唤醒电子设备产生的功耗,以及防止误进入OTG模式。其中,GPIO口电压波动可以是由于电子设备用户长时间使用造成USB接口脏污,而产生GPIO口电压波动。When the first voltage value is greater than the first voltage threshold and less than the second voltage threshold, the electronic device actively turns off the GPIO interrupt response to avoid the GPIO port voltage fluctuation to frequently wake up the power consumption generated by the electronic device, and prevent the erroneous entry into the OTG mode. . The GPIO port voltage fluctuation may be caused by the electronic device user being used for a long time, causing the USB interface to be dirty, and the GPIO port voltage fluctuation occurs.
当第一电压值大于第二电压阈值时,开启GPIO的中断响应,电子设备确定此时没有外接设备,即电子设备处于待机状态。When the first voltage value is greater than the second voltage threshold, the interrupt response of the GPIO is turned on, and the electronic device determines that there is no external device at this time, that is, the electronic device is in the standby state.
在该条件下,电子设备初始化处理器,并检测是否有外接设备插入,开启GPIO的中断响应。Under this condition, the electronic device initializes the processor and detects whether an external device is inserted, and turns on the interrupt response of the GPIO.
若电子设备有外接设备插入,电子设备先判断该外接设备是否为充电设备。If the electronic device has an external device inserted, the electronic device first determines whether the external device is a charging device.
若该外接设备为充电设备,则电子设备进入充电模式,关闭GPIO的中断响应。If the external device is a charging device, the electronic device enters the charging mode and turns off the GPIO interrupt response.
若该外接设备为非充电设备,且GPIO接口上识别出低电平,则电子设备通过ADC接口读取接地电阻R的第二电压值,当第二电压值小于第一电压阈值时,电子设备进入OTG模式。If the external device is a non-charging device and a low level is recognized on the GPIO interface, the electronic device reads the second voltage value of the grounding resistance R through the ADC interface, and when the second voltage value is less than the first voltage threshold, the electronic device Enter the OTG mode.
在一个例子中,如图5所示,以电子设备为手机,OTG设备为U盘为例进行详细说明。In an example, as shown in FIG. 5, the electronic device is used as a mobile phone, and the OTG device is a USB disk as an example for detailed description.
当手机开机后,执行步骤510,手机中的处理器通过GPIO接口检测到ID引脚存在低电平后,确定接入外接设备。After the mobile phone is powered on, step 510 is executed, and the processor in the mobile phone detects that the ID pin is low level through the GPIO interface, and determines to access the external device.
步骤520、手机中的处理器检测BUS引脚是否存在外部电压;Step 520: The processor in the mobile phone detects whether an external voltage exists in the BUS pin;
若存在,执行步骤530,手机进入充电模式。If yes, go to step 530 and the mobile phone enters the charging mode.
若不存在,执行步骤540,手机中的处理器通过ADC接口获取ID引脚的电压值V1。If not, executing step 540, the processor in the mobile phone acquires the voltage value V1 of the ID pin through the ADC interface.
步骤550,手机中的处理器将V1分别与第一电压阈值和预设的第二电压阈值进行比较;Step 550: The processor in the mobile phone compares V1 with the first voltage threshold and the preset second voltage threshold respectively;
步骤560,V1小于第一电压阈值,手机中的处理器确定外接设备为U盘,此时开启GPIO的中断响应,手机进入OTG模式,与U盘进行数据传输。Step 560: V1 is smaller than the first voltage threshold, and the processor in the mobile phone determines that the external device is a U disk. At this time, the interrupt response of the GPIO is turned on, and the mobile phone enters the OTG mode to perform data transmission with the U disk.
步骤570,V1大于第一电压阈值,且小于第二电压阈值,手机中的处理器主动关闭 GPIO的中断响应。 Step 570, V1 is greater than the first voltage threshold, and is less than the second voltage threshold, and the processor in the mobile phone actively closes GPIO interrupt response.
步骤580,V1大于第二电压阈值,手机中的处理器开启GPIO的中断响应,处于待机状态。 Step 580, V1 is greater than the second voltage threshold, and the processor in the mobile phone turns on the interrupt response of the GPIO, and is in a standby state.
步骤590,手机中的处理器进行初始化,并通过GPIO接口识别出ID引脚上存在低电平后,判断BUS引脚是否存在外部电压; Step 590, the processor in the mobile phone initializes, and after the GPIO interface recognizes that there is a low level on the ID pin, it is determined whether the external voltage exists in the BUS pin;
若若存在,则执行步骤530,手机进入充电模式。If yes, go to step 530 and the mobile phone enters the charging mode.
若不存在,则执行步骤600,手机中的处理器通过ADC接口获取ID引脚上的电压值V2,If not, step 600 is performed, and the processor in the mobile phone acquires the voltage value V2 on the ID pin through the ADC interface.
若V2小于第一电压阈值,则执行步骤610,手机中的处理器确定外接设备为U盘,此时开启GPIO的中断响应,手机进入OTG模式,与U盘进行数据传输。If V2 is less than the first voltage threshold, step 610 is executed, and the processor in the mobile phone determines that the external device is a USB flash drive. At this time, the interrupt response of the GPIO is turned on, and the mobile phone enters the OTG mode to perform data transmission with the USB flash drive.
若V2大于第一电压阈值,则执行步骤620,手机中的处理器开启GPIO的中断响应,处于待机状态,继续执行步骤590。If V2 is greater than the first voltage threshold, step 620 is executed, the processor in the mobile phone turns on the GPIO interrupt response, is in the standby state, and proceeds to step 590.
与上述即插即用设备的识别方法对应的,本发明实施例还提供另一种电子设备。如图6所示,该电子设备可以包括:处理单元630。The embodiment of the present invention further provides another electronic device, corresponding to the foregoing method for identifying the plug and play device. As shown in FIG. 6, the electronic device can include a processing unit 630.
处理单元630,用于根据设备的USB连接器的电源总线引脚的工作状态,确定外接设备的设备类型;The processing unit 630 is configured to determine, according to an operating state of a power bus pin of the USB connector of the device, a device type of the external device;
处理单元630,还用于当该设备类型为充电类设备时,进入充电模式;或者,当该设备类型为非充电类设备时,获取USB连接器的ID引脚的第一电压值。The processing unit 630 is further configured to enter a charging mode when the device type is a charging device; or, when the device type is a non-charging device, acquire a first voltage value of an ID pin of the USB connector.
若第一电压值大于第一电压阈值,且小于第二电压阈值,则处理单元630关闭OTG功能,第一电压阈值小于第二电压阈值。If the first voltage value is greater than the first voltage threshold and less than the second voltage threshold, the processing unit 630 turns off the OTG function, the first voltage threshold being less than the second voltage threshold.
可选地,若第一电压值大于第二电压阈值,则处理单元630经初始化后,检测电源总线引脚的工作状态,再次确定外接设备的设备类型。Optionally, if the first voltage value is greater than the second voltage threshold, the processing unit 630, after being initialized, detects an operating state of the power bus pin, and determines the device type of the external device again.
处理单元,还用于根据电源总线引脚的工作状态,当设备类型为非充电类设备时,获取ID引脚的第二电压值。The processing unit is further configured to acquire a second voltage value of the ID pin when the device type is a non-charging type device according to an operating state of the power bus pin.
当第二电压值小于第一电压阈值时,处理单元确定外接设备为OTG设备。When the second voltage value is less than the first voltage threshold, the processing unit determines that the external device is an OTG device.
可选地,处理单元630,还用于若第一电压值小于第一电压阈值,则确定外接设备为OTG设备。Optionally, the processing unit 630 is further configured to determine that the external device is an OTG device if the first voltage value is less than the first voltage threshold.
可选地,第一电压阈值为ID引脚的最大电压值。Optionally, the first voltage threshold is a maximum voltage value of the ID pin.
该电子设备的各功能单元的功能,可以通过上述实施例中电子设备的各步骤来实现,因此,本发明实施例提供的电子设备的具体工作过程,在此不复赘述。The functions of the functional units of the electronic device can be implemented by the steps of the electronic device in the foregoing embodiments. Therefore, the specific working process of the electronic device provided by the embodiment of the present invention is not described herein.
与上述即插即用设备的识别方法对应的,本发明实施例还提供另一种电子设备。如图7所示,该电子设备可以包括:处理器710、存储器720、ADC接口730、GPIO接口740和USB连接器750。The embodiment of the present invention further provides another electronic device, corresponding to the foregoing method for identifying the plug and play device. As shown in FIG. 7, the electronic device can include a processor 710, a memory 720, an ADC interface 730, a GPIO interface 740, and a USB connector 750.
其中,处理器710可以包括GPIO模块711和ADC 712。The processor 710 can include a GPIO module 711 and an ADC 712.
处理器710可以是中央处理器(central processing unit,CPU),或者CPU和硬件芯片的组合。上述硬件芯片可以是专用集成电路(application-specific integrated circuit,ASIC),可编程逻辑器件(programmable logic device,PLD)或其组合。上 述PLD可以是复杂可编程逻辑器件(complex programmable logic device,CPLD),现场可编程逻辑门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)或其任意组合。The processor 710 can be a central processing unit (CPU), or a combination of a CPU and a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. On The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a general array logic (GAL), or any combination thereof.
存储器720可以包括易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM);存储器720也可以包括非易失性存储器(non-volatile memory),例如只读存储器(read-only memory,ROM),快闪存储器(flash memory),硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD)。The memory 720 may include a volatile memory such as a random-access memory (RAM); the memory 720 may also include a non-volatile memory such as a read-only memory (read) -only memory, ROM), flash memory, hard disk drive (HDD) or solid-state drive (SSD).
存储器720还可以包括上述种类的存储器的组合。存储器720存储程序代码,并将存储的程序代码传输给处理器710。Memory 720 can also include a combination of the above types of memory. The memory 720 stores the program code and transmits the stored program code to the processor 710.
处理器710,用于根据该设备的USB连接器750的电源总线引脚的工作状态,确定外接设备的设备类型。The processor 710 is configured to determine a device type of the external device according to an operating state of the power bus pin of the USB connector 750 of the device.
处理器710,还用于当设备类型为充电类设备时,进入充电模式;或者,当设备类型为非充电类设备时,通过ADC接口730获取USB连接器750的ID引脚的第一电压值。若第一电压值大于第一电压阈值,且小于第二电压阈值,则处理器710关闭GPIO模块711中GPIO接口740的中断响应,即关闭OTG功能,第一电压阈值小于第二电压阈值。The processor 710 is further configured to enter a charging mode when the device type is a charging device; or, when the device type is a non-charging device, acquire the first voltage value of the ID pin of the USB connector 750 through the ADC interface 730. . If the first voltage value is greater than the first voltage threshold and less than the second voltage threshold, the processor 710 turns off the interrupt response of the GPIO interface 740 in the GPIO module 711, that is, turns off the OTG function, and the first voltage threshold is less than the second voltage threshold.
可选地,若第一电压值大于第二电压阈值,则处理器710中ADC 712经初始化后,检测USB连接器750的电源总线引脚的工作状态,再次确定外接设备的设备类型;Optionally, if the first voltage value is greater than the second voltage threshold, the ADC 712 in the processor 710 is initialized, detects the working state of the power bus pin of the USB connector 750, and determines the device type of the external device again;
处理器710,还用于根据电源总线引脚的工作状态,当所述设备类型为非充电类设备时,通过ADC接口730获取ID引脚的第二电压值。当第二电压值小于第一电压阈值时,处理器710确定外接设备为OTG设备。The processor 710 is further configured to acquire a second voltage value of the ID pin through the ADC interface 730 when the device type is a non-charging type device according to an operating state of the power bus pin. When the second voltage value is less than the first voltage threshold, the processor 710 determines that the external device is an OTG device.
可选地,处理器710,还用于若第一电压值小于所述第一电压阈值,则确定外接设备为OTG设备。Optionally, the processor 710 is further configured to determine that the external device is an OTG device if the first voltage value is less than the first voltage threshold.
可选地,第一电压阈值为ID引脚的最大电压值。Optionally, the first voltage threshold is a maximum voltage value of the ID pin.
由于上述实施例中该电子设备的各器件解决问题的实施方式以及有益效果可以参见图4所示的方法实施方式以及有益效果,故在此不复赘述。For the implementation and the beneficial effects of the various devices of the electronic device in the above embodiments, reference may be made to the method embodiments and the beneficial effects shown in FIG. 4, and thus details are not described herein.
专业人员应该还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person skilled in the art should further appreciate that the elements and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both, in order to clearly illustrate hardware and software. Interchangeability, the composition and steps of the various examples have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods to implement the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present application.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以通过程序来指令处理器完成,所述的程序可以存储于计算机可读存储介质中,所述存储介质是非短暂性(non-transitory)介质,例如随机存取存储器,只读存储器,快闪存储器,硬盘,固态硬盘,磁带(magnetic tape),软盘(floppy disk),光盘(optical disc)及其任意组合。It will be understood by those skilled in the art that all or part of the steps of implementing the above embodiments may be performed by a program, and the program may be stored in a computer readable storage medium, which is non-transitory ( Non-transitory medium, such as random access memory, read only memory, flash memory, hard disk, solid state disk, magnetic tape, floppy disk, optical disc, and any combination thereof.
以上所述,仅为本申请较佳的具体实施方式,但本申请的保护范围并不局限于此,任 何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应该以权利要求的保护范围为准。 The foregoing is only a preferred embodiment of the present application, but the scope of protection of the present application is not limited thereto. It is to be understood that those skilled in the art are susceptible to variations or substitutions within the scope of the present disclosure. Therefore, the scope of protection of the present application should be determined by the scope of protection of the claims.

Claims (12)

  1. 一种即插即用设备的识别方法,其特征在于,所述方法包括:A method for identifying a plug and play device, the method comprising:
    电子设备根据通用串行总线USB连接器的电源总线引脚的工作状态,确定外接设备的设备类型;The electronic device determines the device type of the external device according to the working state of the power bus pin of the universal serial bus USB connector;
    当所述设备类型为充电类设备时,所述电子设备进入充电模式;When the device type is a charging device, the electronic device enters a charging mode;
    当所述设备类型为非充电类设备时,所述电子设备获取所述USB连接器的ID引脚的第一电压值;When the device type is a non-charging type device, the electronic device acquires a first voltage value of an ID pin of the USB connector;
    若所述第一电压值大于第一电压阈值,且小于第二电压阈值,则所述电子设备关闭即插即用OTG功能,所述第一电压阈值小于所述第二电压阈值。If the first voltage value is greater than the first voltage threshold and less than the second voltage threshold, the electronic device turns off the plug and play OTG function, and the first voltage threshold is less than the second voltage threshold.
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 further comprising:
    若所述第一电压值大于所述第二电压阈值,则所述电子设备经初始化后,再次确定外接设备的设备类型;If the first voltage value is greater than the second voltage threshold, the electronic device determines the device type of the external device again after being initialized;
    当所述设备类型为非充电类设备时,所述电子设备获取所述ID引脚的第二电压值;When the device type is a non-charging type device, the electronic device acquires a second voltage value of the ID pin;
    当所述第二电压值小于所述第一电压阈值时,所述电子设备确定所述外接设备为OTG设备。When the second voltage value is less than the first voltage threshold, the electronic device determines that the external device is an OTG device.
  3. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 further comprising:
    若所述第一电压值小于所述第一电压阈值,则所述电子设备确定所述外接设备为OTG设备。And if the first voltage value is less than the first voltage threshold, the electronic device determines that the external device is an OTG device.
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述第一电压阈值为所述ID引脚的最大电压值。The method according to any one of claims 1 to 3, wherein the first voltage threshold is a maximum voltage value of the ID pin.
  5. 一种电子设备,其特征在于,所述设备包括:处理单元,An electronic device, comprising: a processing unit,
    所述处理单元,用于根据USB连接器的电源总线引脚的工作状态,确定外接设备的设备类型;The processing unit is configured to determine a device type of the external device according to an operating state of the power bus pin of the USB connector;
    所述处理单元,还用于当所述设备类型为充电类设备时,进入充电模式;当所述设备类型为非充电类设备时,获取所述USB连接器的ID引脚的第一电压值;The processing unit is further configured to: when the device type is a charging device, enter a charging mode; when the device type is a non-charging device, acquire a first voltage value of an ID pin of the USB connector. ;
    若所述第一电压值大于第一电压阈值,且小于第二电压阈值,则所述处理单元关闭OTG功能,所述第一电压阈值小于所述第二电压阈值。If the first voltage value is greater than the first voltage threshold and less than the second voltage threshold, the processing unit turns off the OTG function, the first voltage threshold being less than the second voltage threshold.
  6. 根据权利要求5所述的设备,其特征在于,The device according to claim 5, characterized in that
    若所述第一电压值大于所述第二电压阈值,则所述处理单元经初始化后,再次确定外接设备的设备类型;If the first voltage value is greater than the second voltage threshold, the processing unit determines the device type of the external device again after being initialized;
    所述处理单元,还用于当所述设备类型为非充电类设备时,获取所述ID引脚的第二电压值;The processing unit is further configured to acquire a second voltage value of the ID pin when the device type is a non-charging device;
    当所述第二电压值小于所述第一电压阈值时,所述处理单元确定所述外接设备为OTG设备。When the second voltage value is less than the first voltage threshold, the processing unit determines that the external device is an OTG device.
  7. 根据权利要求5所述的设备,其特征在于,所述处理单元,还用于若所述第一电压值小于所述第一电压阈值,则确定所述外接设备为OTG设备。The device according to claim 5, wherein the processing unit is further configured to determine that the external device is an OTG device if the first voltage value is less than the first voltage threshold.
  8. 根据权利要求5-7任一项所述的方法,其特征在于,所述第一电压阈值为所述ID引脚的最大电压值。 The method of any of claims 5-7, wherein the first voltage threshold is a maximum voltage value of the ID pin.
  9. 一种电子设备,其特征在于,包括:An electronic device, comprising:
    存储器,用于存储程序指令;a memory for storing program instructions;
    处理器,用于调用存储在所述存储器中的程序指令执行以下操作:a processor for calling a program instruction stored in the memory to perform the following operations:
    根据USB连接器的电源总线引脚的工作状态,确定外接设备的设备类型;Determining the device type of the external device according to the working state of the power bus pin of the USB connector;
    当所述设备类型为充电类设备时,进入充电模式;When the device type is a charging device, enter a charging mode;
    当所述设备类型为非充电类设备时,获取所述USB连接器的ID引脚的第一电压值;Obtaining a first voltage value of an ID pin of the USB connector when the device type is a non-charging type device;
    若所述第一电压值大于第一电压阈值,且小于第二电压阈值,则所述处理器关闭OTG功能,所述第一电压阈值小于所述第二电压阈值。If the first voltage value is greater than the first voltage threshold and less than the second voltage threshold, the processor turns off the OTG function, the first voltage threshold being less than the second voltage threshold.
  10. 根据权利要求9所述的设备,其特征在于,所述处理器还用于:The device according to claim 9, wherein the processor is further configured to:
    若所述第一电压值大于所述第二电压阈值,则所述处理器经初始化后,再次确定外接设备的设备类型;If the first voltage value is greater than the second voltage threshold, the processor determines the device type of the external device again after being initialized;
    当所述设备类型为非充电类设备时,获取所述ID引脚的第二电压值;Obtaining a second voltage value of the ID pin when the device type is a non-charging type device;
    当所述第二电压值小于所述第一电压阈值时,所述处理器确定所述外接设备为OTG设备。When the second voltage value is less than the first voltage threshold, the processor determines that the external device is an OTG device.
  11. 根据权利要求9所述的设备,其特征在于,所述处理器还用于:The device according to claim 9, wherein the processor is further configured to:
    若所述第一电压值小于所述第一电压阈值,则确定所述外接设备为OTG设备。And if the first voltage value is less than the first voltage threshold, determining that the external device is an OTG device.
  12. 根据权利要求9-11任一项所述的方法,其特征在于,所述第一电压阈值为所述ID引脚的最大电压值。 The method of any of claims 9-11, wherein the first voltage threshold is a maximum voltage value of the ID pin.
PCT/CN2017/078625 2016-12-20 2017-03-29 Method for recognizing plug-and-play device, and electronic device WO2018113128A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201780005058.7A CN108475245B (en) 2016-12-20 2017-03-29 Plug and play device identification method and electronic device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611186660 2016-12-20
CN201611186660.9 2016-12-20

Publications (1)

Publication Number Publication Date
WO2018113128A1 true WO2018113128A1 (en) 2018-06-28

Family

ID=62624339

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/078625 WO2018113128A1 (en) 2016-12-20 2017-03-29 Method for recognizing plug-and-play device, and electronic device

Country Status (2)

Country Link
CN (1) CN108475245B (en)
WO (1) WO2018113128A1 (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110659237A (en) * 2019-09-27 2020-01-07 闻泰通讯股份有限公司 Function adaptation method, device, equipment and storage medium
CN111343781A (en) * 2020-03-06 2020-06-26 Oppo广东移动通信有限公司 ESD event processing method, ESD event processing circuit and related product
CN111722122A (en) * 2020-06-01 2020-09-29 Oppo广东移动通信有限公司 Detection method, detection device, electronic equipment and computer-readable storage medium
CN112290639A (en) * 2020-11-11 2021-01-29 维沃移动通信有限公司 Interface circuit and electronic equipment charge
CN112290640A (en) * 2020-11-11 2021-01-29 维沃移动通信有限公司 Interface circuit and electronic equipment charge
CN112927446A (en) * 2019-12-06 2021-06-08 东芝泰格有限公司 Electronic device
CN113189499A (en) * 2021-03-05 2021-07-30 深圳市亿联智能有限公司 Battery low-power processing algorithm
CN114996187A (en) * 2022-05-06 2022-09-02 东莞市步步高教育软件有限公司 OTG function control method and device, computer equipment and storage medium
CN115525099A (en) * 2022-01-11 2022-12-27 荣耀终端有限公司 Terminal equipment and method for detecting keyboard access
CN116707048A (en) * 2022-09-06 2023-09-05 荣耀终端有限公司 OTG-based charging control method and related device

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110677602B (en) * 2019-09-30 2022-10-25 重庆惠科金扬科技有限公司 Channel mode switching method and device of display equipment and display equipment
CN112579500A (en) * 2020-12-08 2021-03-30 深圳市道通科技股份有限公司 Method and device for prompting anti-misplug USB interface and electronic equipment
CN116049055B (en) * 2022-05-26 2023-09-08 荣耀终端有限公司 Access identification method of electronic equipment interface and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150169491A1 (en) * 2013-12-13 2015-06-18 Primax Electronics Ltd. Electronic device using usb socket to load firmware and firmware loading method thereof
CN105068959A (en) * 2015-08-25 2015-11-18 广东欧珀移动通信有限公司 Terminal and charging method and apparatus for terminal with data exchange function
CN105635885A (en) * 2016-03-21 2016-06-01 青岛海信移动通信技术股份有限公司 USB interface multiplex circuit, mobile terminal and earphone
US20160306767A1 (en) * 2011-04-21 2016-10-20 Texas Instruments Incorporated Systems and methods for enabling communication between an accessory charger adapter (aca) and an aca-agnostic universal serial bus controller

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160306767A1 (en) * 2011-04-21 2016-10-20 Texas Instruments Incorporated Systems and methods for enabling communication between an accessory charger adapter (aca) and an aca-agnostic universal serial bus controller
US20150169491A1 (en) * 2013-12-13 2015-06-18 Primax Electronics Ltd. Electronic device using usb socket to load firmware and firmware loading method thereof
CN105068959A (en) * 2015-08-25 2015-11-18 广东欧珀移动通信有限公司 Terminal and charging method and apparatus for terminal with data exchange function
CN105635885A (en) * 2016-03-21 2016-06-01 青岛海信移动通信技术股份有限公司 USB interface multiplex circuit, mobile terminal and earphone

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110659237A (en) * 2019-09-27 2020-01-07 闻泰通讯股份有限公司 Function adaptation method, device, equipment and storage medium
CN112927446A (en) * 2019-12-06 2021-06-08 东芝泰格有限公司 Electronic device
CN111343781A (en) * 2020-03-06 2020-06-26 Oppo广东移动通信有限公司 ESD event processing method, ESD event processing circuit and related product
CN111722122A (en) * 2020-06-01 2020-09-29 Oppo广东移动通信有限公司 Detection method, detection device, electronic equipment and computer-readable storage medium
CN112290639A (en) * 2020-11-11 2021-01-29 维沃移动通信有限公司 Interface circuit and electronic equipment charge
CN112290640A (en) * 2020-11-11 2021-01-29 维沃移动通信有限公司 Interface circuit and electronic equipment charge
CN112290640B (en) * 2020-11-11 2022-09-02 维沃移动通信有限公司 Interface circuit and electronic equipment charge
CN113189499A (en) * 2021-03-05 2021-07-30 深圳市亿联智能有限公司 Battery low-power processing algorithm
CN115525099A (en) * 2022-01-11 2022-12-27 荣耀终端有限公司 Terminal equipment and method for detecting keyboard access
CN115525099B (en) * 2022-01-11 2023-08-11 荣耀终端有限公司 Terminal equipment and method for detecting keyboard access
CN114996187A (en) * 2022-05-06 2022-09-02 东莞市步步高教育软件有限公司 OTG function control method and device, computer equipment and storage medium
CN116707048A (en) * 2022-09-06 2023-09-05 荣耀终端有限公司 OTG-based charging control method and related device

Also Published As

Publication number Publication date
CN108475245B (en) 2020-12-22
CN108475245A (en) 2018-08-31

Similar Documents

Publication Publication Date Title
WO2018113128A1 (en) Method for recognizing plug-and-play device, and electronic device
US10318394B2 (en) USB TYPE-C to legacy USB cable detection
US8762746B1 (en) Power management in electronic devices
JP5717005B2 (en) Method and terminal for selecting an internal circuit according to the status of a USB interface
US7480758B2 (en) Method and apparatus for automatically switching between USB host and device
US10879686B2 (en) Overcurrent protection for universal serial bus Type-C (USB-C) connector systems
WO2013168289A1 (en) Electronic device and control method therefor
US20170052578A1 (en) Low-Power Type-C Receiver with High Idle Noise and DC-Level Rejection
US8862921B1 (en) Apparatus for remote wake-up during dedicated charging mode
US8458376B1 (en) USB peripheral device with automatic mode switch
TWI760615B (en) Method for performing detect control of write protection command of memory device, associated control chip and associated electronic device
US10630028B2 (en) Reverse overcurrent protection for universal serial bus type-C (USB-C) connector systems
US9590441B2 (en) Multi-standard compliant USB battery charging scheme with detection of host disconnection in ACA-DOCK mode
EP3674904B1 (en) Electronic device having type c usb interface, control method for type c usb interface, and storage medium
CN112042093A (en) Dynamic VCONN switching in dual-supply C-line cable applications
WO2016107033A1 (en) Electronic device and data transmission system
WO2022127659A1 (en) Protection method, protection apparatus, electronic device, readable storage medium, and chip
US20160328350A1 (en) Restart system and motherboard thereof
US8806255B2 (en) Interface connection control based on voltage at input rail
US20130067119A1 (en) Boot up configuration with usb data pins in embedded systems
US11385696B2 (en) Electronic apparatus, control method in electronic apparatus, and apparatus
CN110442539B (en) Mobile phone OTG switching method and device
US8566575B2 (en) Computer apparatus and method for charging portable electronic device using the computer apparatus
CN114546899A (en) USB device connection method, system and computer readable storage medium
US8909821B2 (en) Slim-line connector for serial ATA interface that is mounted on expansion bay of computer includes detection signals which indicate connection status and type of device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17883459

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17883459

Country of ref document: EP

Kind code of ref document: A1