[go: up one dir, main page]

CN107003974A - A kind of interface detection method and device - Google Patents

A kind of interface detection method and device Download PDF

Info

Publication number
CN107003974A
CN107003974A CN201680002678.0A CN201680002678A CN107003974A CN 107003974 A CN107003974 A CN 107003974A CN 201680002678 A CN201680002678 A CN 201680002678A CN 107003974 A CN107003974 A CN 107003974A
Authority
CN
China
Prior art keywords
interface
expansion
expansion equipment
bus
equipment
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
CN201680002678.0A
Other languages
Chinese (zh)
Other versions
CN107003974B (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.)
As Science And Technology (beijing) Co Ltd
Original Assignee
As Science And Technology (beijing) 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 As Science And Technology (beijing) Co Ltd filed Critical As Science And Technology (beijing) Co Ltd
Publication of CN107003974A publication Critical patent/CN107003974A/en
Application granted granted Critical
Publication of CN107003974B publication Critical patent/CN107003974B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/10Program control for peripheral devices
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • G06F13/4081Live connection to bus, e.g. hot-plugging
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R31/00Arrangements for testing electric properties; Arrangements for locating electric faults; Arrangements for electrical testing characterised by what is being tested not provided for elsewhere
    • G01R31/50Testing of electric apparatus, lines, cables or components for short-circuits, continuity, leakage current or incorrect line connections
    • G01R31/66Testing of connections, e.g. of plugs or non-disconnectable joints
    • G01R31/68Testing of releasable connections, e.g. of terminals mounted on a printed circuit board

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Telephone Function (AREA)

Abstract

A kind of interface detection method and device, methods described include:Detect the interface pin (101) of terminal;If being the first level for the interface pin for inserting detection, determining the expansion interface of terminal has expansion equipment insertion;The interface chip of the expansion equipment is suspended in bus (102);Power-up initializing is carried out to the expansion equipment, the facility information of the expansion equipment is read by bus;The facility information includes device id (103);The device type (104) of the expansion equipment is determined according to the device id.The expansion equipment of insertion is suspended in bus by methods described, when the interface pin for inserting detection is the first level, the device type of the expansion equipment is read by bus, it is adaptable to which various types of interface detections, autgmentability is stronger.

Description

一种接口检测方法及装置Method and device for interface detection

技术领域technical field

本发明涉及终端技术领域,特别涉及一种接口检测方法及装置。The present invention relates to the technical field of terminals, in particular to an interface detection method and device.

背景技术Background technique

云端机器人是将认知系统放在云里,身体、驱动、传感器放在机器人本体上,通过移动通信将二者连接起来的智能机器人;云端机器人是智能仿人机器人发展的方向。A cloud robot is an intelligent robot that puts the cognitive system in the cloud, puts the body, drive, and sensors on the robot body, and connects the two through mobile communication; the cloud robot is the development direction of intelligent humanoid robots.

随着终端技术的不断发展,终端产品愈发种类繁多,例如:智能手机、电脑、pad等。目前终端大多包括一个或多个接口,用于将USB、耳机或数据线等插入这些相应的接口从而与终端建立连接实现相应的功能。With the continuous development of terminal technology, there are more and more types of terminal products, such as smart phones, computers, pads, etc. At present, most terminals include one or more interfaces, which are used to insert USB, earphones, or data cables into these corresponding interfaces so as to establish a connection with the terminal to realize corresponding functions.

现有技术中,USB接口对应只能插入USB设备、耳机接口对应只能插入耳机设备等等,当将USB设备插入USB接口、耳机设备插入耳机接口后,终端通常是采用硬件中断的方式告知系统,根据相应接口的引脚的电压来确定该接口是否插入设备。In the prior art, the USB interface can only be inserted into a USB device, and the earphone interface can only be inserted into an earphone device, etc. When the USB device is inserted into the USB interface, and the earphone device is inserted into the earphone interface, the terminal usually uses a hardware interrupt to notify the system , to determine whether the interface is plugged into the device according to the voltage of the pin of the corresponding interface.

现有技术不足在于:The deficiencies in the prior art are:

通过电压高低检测设备类型的方式,由于电压分级难以控制,因此只能支持极少数的简单设备,例如:USB、耳机等,扩展性不强。The device type is detected by the voltage level. Since the voltage classification is difficult to control, it can only support a very small number of simple devices, such as USB, earphones, etc., and the scalability is not strong.

发明内容Contents of the invention

本发明实施例提出了一种接口检测方法及装置,用于解决现有技术中通过电压高低检测设备类型的方式,由于电压分级难以控制,只能支持极少数的简单设备、扩展性不强的技术问题。The embodiment of the present invention proposes an interface detection method and device, which is used to solve the problem of detecting the type of equipment through voltage level in the prior art. Since the voltage classification is difficult to control, it can only support a small number of simple equipment, and the expansion is not strong. technical problem.

在一个方面,本发明实施例提供了一种接口检测方法,包括如下步骤:In one aspect, an embodiment of the present invention provides an interface detection method, including the following steps:

检测终端的接口管脚;Detect the interface pins of the terminal;

如果用于插入检测的接口管脚为第一电平,确定终端的接口有扩展设备插入;所述扩展设备的接口芯片被挂到总线上;If the interface pin used for insertion detection is at the first level, it is determined that an expansion device is inserted into the interface of the terminal; the interface chip of the expansion device is connected to the bus;

对所述扩展设备进行上电初始化,通过总线读取所述扩展设备的设备信息;所述设备信息包括设备标识ID;Perform power-on initialization on the expansion device, and read the device information of the expansion device through the bus; the device information includes a device identification ID;

根据所述设备ID确定所述扩展设备的设备类型。Determine the device type of the extension device according to the device ID.

在另一个方面,本发明实施例提供了一种接口检测装置,包括:In another aspect, an embodiment of the present invention provides an interface detection device, including:

检测模块,用于检测终端的接口管脚;A detection module, configured to detect interface pins of the terminal;

第一确定模块,用于如果用于插入检测的接口管脚为第一电平,确定终端的接口有扩展设备插入;The first determination module is configured to determine that an expansion device is inserted into the interface of the terminal if the interface pin used for insertion detection is at the first level;

挂接模块,用于将所述扩展设备的接口芯片挂到总线上;A hooking module, configured to hang the interface chip of the expansion device on the bus;

读取模块,用于对所述扩展设备进行上电初始化,通过总线读取所述扩展设备的设备信息;所述设备信息包括设备ID;A reading module, configured to power-on and initialize the expansion device, and read the device information of the expansion device through the bus; the device information includes a device ID;

第二确定模块,用于根据所述设备ID确定所述扩展设备的设备类型。A second determining module, configured to determine the device type of the extension device according to the device ID.

有益效果如下:Beneficial effects are as follows:

当前通过电压高低检测设备类型的方式,由于电压分级难以控制,只能支持极少数的简单设备、扩展性不强的问题,由于本发明实施例所提供的技术方案,可以通过检测终端的接口管脚,在用于插入检测的接口管脚为第一电平时确定终端的接口有扩展设备插入,所述扩展设备被挂到总线上,在对所述扩展设备上电初始化之后,可以通过总线读取得到所述扩展设备的设备类型,本发明实施例可以支持较多类型的扩展设备插入,扩展性较好,解决了现有技术中通过电压高低来检测设备类型的方式由于电压分级难以控制、只能检测非常少数的接口设备、扩展性不强的技术问题。The current method of detecting device types through voltage levels is difficult to control due to voltage grading, and can only support a small number of simple devices and poor scalability. Due to the technical solution provided by the embodiment of the present invention, it can be detected through the interface tube of the terminal Pin, when the interface pin used for insertion detection is at the first level, it is determined that an expansion device is inserted into the interface of the terminal, and the expansion device is connected to the bus. After the expansion device is powered on and initialized, it can be read through the bus. The device type of the expansion device is obtained. The embodiment of the present invention can support the insertion of more types of expansion devices, and the scalability is better. Only a very small number of interface devices and technical problems with poor scalability can be detected.

附图说明Description of drawings

下面将参照附图描述本发明的具体实施例,其中:Specific embodiments of the present invention will be described below with reference to the accompanying drawings, wherein:

图1为本发明实施例中接口检测方法实施的流程示意图;Fig. 1 is a schematic flow chart of the implementation of the interface detection method in the embodiment of the present invention;

图2为本发明实施例中接口检测过程示意图;FIG. 2 is a schematic diagram of an interface detection process in an embodiment of the present invention;

图3为本发明实施例中接口检测装置的结构示意图一;Fig. 3 is a structural schematic diagram 1 of an interface detection device in an embodiment of the present invention;

图4为本发明实施例中接口检测装置的结构示意图二;Fig. 4 is a schematic structural diagram II of an interface detection device in an embodiment of the present invention;

图5为本发明实施例中接口检测装置的结构示意图三;Fig. 5 is a schematic structural diagram III of the interface detection device in the embodiment of the present invention;

图6为本发明实施例中手机插入扩展设备的结构示意图;6 is a schematic structural diagram of a mobile phone inserted into an expansion device in an embodiment of the present invention;

图7示出了本发明实施例中pad插接扩展设备的结构示意图。Fig. 7 shows a schematic structural diagram of a pad plug-in expansion device in an embodiment of the present invention.

具体实施方式detailed description

为了使本发明的技术方案及优点更加清楚明白,以下结合附图对本发明的示例性实施例进行进一步详细的说明,显然,所描述的实施例仅是本发明的一部分实施例,而不是所有实施例的穷举。并且在不冲突的情况下,本说明中的实施例及实施例中的特征可以互相结合。In order to make the technical solutions and advantages of the present invention clearer, the exemplary embodiments of the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all implementations. Exhaustive list of examples. And in the case of no conflict, the embodiments in this description and the features in the embodiments can be combined with each other.

发明人在发明过程中注意到:The inventor noticed during the invention that:

现有技术中,手机、电脑等终端只能通过硬件中断的方式告知系统,然后系统通过硬件状态的切换和判断来检测设备的具体类型。当检测到中断时,获取该手机或电脑上具有的标准接口的引脚电压,根据引脚电压与预设电压比较来确定该标准接口是否插入了该接口对应的设备。In the prior art, terminals such as mobile phones and computers can only notify the system through hardware interrupts, and then the system detects the specific type of the device through switching and judging the hardware status. When an interruption is detected, the pin voltage of the standard interface on the mobile phone or the computer is obtained, and it is determined whether the standard interface is inserted into the device corresponding to the interface according to the comparison between the pin voltage and the preset voltage.

系统通过电压高低的方式检测,只能简单的检测设备类型,无法得到设备的具体版本和制造商等信息;而且,现有的设备检测由于电压的分级比较难以控制,所以只能支持极少数的简单设备,例如:USB、UART等标准接口设备,这些设备通常只有很少的管脚(例如:3pin),而且只能通过获取该管脚的电压并根据电压的值来确定是否插入相应设备(例如:VBUS达到5v表示插入了USB等),使用场景受限、扩展性不强,无法适用于具有复杂功能的复合接口设备(例如:68pin)。The system detects by means of voltage level, and can only simply detect the type of equipment, and cannot obtain information such as the specific version and manufacturer of the equipment; moreover, the existing equipment detection is difficult to control due to the classification of voltage, so it can only support a very small number of Simple devices, such as USB, UART and other standard interface devices, these devices usually have only a few pins (for example: 3pin), and can only determine whether to insert the corresponding device by obtaining the voltage of the pin and according to the value of the voltage ( For example: VBUS reaching 5v means that USB is plugged in, etc.), the usage scenarios are limited, the scalability is not strong, and it cannot be applied to composite interface devices with complex functions (for example: 68pin).

针对上述不足,本发明实施例提出了一种接口检测方法及装置,通过预置设备ID、利用总线技术读取扩展设备的类型来加载相应的驱动程序并启动相应的服务和应用,从而使得终端无需中断即可检测出接口状态,并且可以适用于具有复杂功能的复合接口设备,扩展性极强、应用广泛。In view of the above deficiencies, the embodiment of the present invention proposes an interface detection method and device, by presetting the device ID, using the bus technology to read the type of the expansion device to load the corresponding driver and start the corresponding service and application, so that the terminal The interface status can be detected without interruption, and it can be applied to composite interface devices with complex functions, with strong scalability and wide application.

为了便于本申请的实施,下面结合具体实施例对本申请所提出的接口检测方法及装置进行说明。In order to facilitate the implementation of the present application, the interface detection method and device proposed in the present application will be described below in conjunction with specific embodiments.

实施例一、Embodiment one,

图1示出了本发明实施例一中接口检测方法实施的流程示意图,如图所示,所述接口检测方法可以包括如下步骤:FIG. 1 shows a schematic flow diagram of the implementation of the interface detection method in Embodiment 1 of the present invention. As shown in the figure, the interface detection method may include the following steps:

步骤101、检测终端的接口管脚;Step 101, detecting the interface pins of the terminal;

步骤102、如果用于插入检测的接口管脚为第一电平,确定终端的接口有扩展设备插入;所述扩展设备的接口芯片被挂到总线上;Step 102, if the interface pin used for insertion detection is at the first level, it is determined that an expansion device is inserted into the interface of the terminal; the interface chip of the expansion device is connected to the bus;

步骤103、对所述扩展设备进行上电初始化,通过总线读取所述扩展设备的设备信息;所述设备信息包括设备标识ID;Step 103: Perform power-on initialization on the expansion device, and read the device information of the expansion device through the bus; the device information includes a device identification ID;

步骤104、根据所述设备ID确定所述扩展设备的设备类型。Step 104. Determine the device type of the extension device according to the device ID.

具体实施时,如果所述扩展设备是在终端下电的情况下安装,那么,本发明实施例可以在终端上电以后检测终端的接口管脚;如果所述扩展设备为即插即用,那么,本发明实施例可以通过中断检测终端的接口管脚。During specific implementation, if the expansion device is installed when the terminal is powered off, the embodiment of the present invention can detect the interface pins of the terminal after the terminal is powered on; if the expansion device is plug-and-play, then , the embodiment of the present invention can detect the interface pin of the terminal by interrupting.

终端的接口管脚pins可以有很多,其中可以包括用于插入检测的接口管脚,例如:PLUG_DET_UP和PLUG_DET_Down,在检测时如果用于插入检测的接口管脚为第一电平,则可以确定终端的接口有扩展设备插入。其中,所述第一电平可以为低电平或者高电平,例如:检测对终端的接口管脚,如果PLUG_DET_UP和PLUG_DET_Down均为低电平,则可以确定终端的接口有扩展设备插入。There can be many interface pins of the terminal, which may include interface pins for insertion detection, for example: PLUG_DET_UP and PLUG_DET_Down, if the interface pins for insertion detection are at the first level during detection, the terminal can be determined There is an expansion device plugged into the interface. Wherein, the first level may be low level or high level. For example, when detecting the interface pins of the terminal, if both PLUG_DET_UP and PLUG_DET_Down are low level, it can be determined that an expansion device is inserted into the interface of the terminal.

所述扩展设备插入终端的接口后,所述扩展设备的接口芯片即被挂到总线上,终端的系统即可通过总线读取所述扩展设备的设备信息。总线(Bus)是计算机各种功能部件之间传送信息的公共通信干线,本发明实施例中系统的各个部件可以通过总线相连,外部扩展设备可以通过相应的接口芯片与总线相连,一条总线上可以连接多个扩展设备,且这些扩展设备分别可以传送设备信息至终端的系统。After the expansion device is inserted into the interface of the terminal, the interface chip of the expansion device is connected to the bus, and the system of the terminal can read the device information of the expansion device through the bus. The bus (Bus) is the public communication trunk line for transmitting information between various functional components of the computer. The various components of the system in the embodiment of the present invention can be connected through the bus, and the external expansion equipment can be connected with the bus through the corresponding interface chip. One bus can A system in which multiple extension devices are connected, and each of these extension devices can transmit device information to the terminal.

所述扩展设备的设备信息可以包括设备类型,本发明实施例通过总线的形式读取扩展设备的设备信息,即可获得所述扩展设备的设备类型。其中,设备类型是设备的分类,一个类型的扩展设备可以有多种不同的设备,设备ID则是唯一标识所述扩展设备的ID,具体实施时,所述扩展设备上可以预先写有设备ID,通过设备ID可以确定出所述扩展设备的设备类型。例如:充电宝这一类型的扩展设备可以有很多,ID=A01则是一具体的充电宝设备。The device information of the expansion device may include a device type. In the embodiment of the present invention, the device type of the expansion device can be obtained by reading the device information of the expansion device in the form of a bus. Among them, the device type is the classification of the device, a type of expansion device can have a variety of different devices, and the device ID is the ID that uniquely identifies the expansion device. During specific implementation, the device ID can be pre-written on the expansion device , the device type of the extension device can be determined through the device ID. For example: there can be many expansion devices of the type of power bank, and ID=A01 is a specific power bank device.

本发明实施例通过将扩展设备插入终端后即挂到总线上,终端通过检测接口管脚来确定是否有扩展设备插入,在确定有扩展设备插入后通过总线即可读取到扩展设备的设备类型,通过一个接口即可实现各种类型的扩展设备的插入、检测;并且,现有技术中终端的一个接口只能连接一个标准接口设备,而本发明实施例由于采用的是总线形式,同一时刻可以支持多个扩展设备的插入,扩展性较强,解决了现有技术中通过电压高低的方式来检测设备类型、只能检测标准接口设备等问题。In the embodiment of the present invention, after the expansion device is inserted into the terminal, it is hung on the bus, and the terminal determines whether there is an expansion device inserted by detecting the interface pins, and the device type of the expansion device can be read through the bus after the expansion device is determined to be inserted. , the insertion and detection of various types of expansion devices can be realized through one interface; moreover, one interface of the terminal in the prior art can only be connected to one standard interface device, but because the embodiment of the present invention adopts the bus form, at the same time It can support the insertion of multiple expansion devices, and has strong scalability, which solves the problems in the prior art that the device type is detected by means of voltage level and only standard interface devices can be detected.

实施中,所述方法可以进一步包括:In implementation, the method may further include:

根据所述扩展设备的设备类型,加载设备驱动并启动相应的服务程序和应用程序;According to the device type of the expansion device, load the device driver and start the corresponding service program and application program;

向所述扩展设备发送所述扩展设备启动所需要的程序;Sending the program required for the expansion device to start to the expansion device;

待所述扩展设备启动后,与所述扩展设备执行状态同步。After the expansion device starts, perform state synchronization with the expansion device.

具体实施时,如果确定终端的接口有扩展设备插入,可以进行扩展设备的探测(probe),具体可以为:对扩展设备进行上电初始化操作,然后通过总线读取所述扩展设备的设备信息。所述设备信息中可以包括设备类型,根据所述扩展设备的设备类型加载相应的驱动程序,并启动相应的服务和应用。During specific implementation, if it is determined that an expansion device is plugged into the interface of the terminal, the detection of the expansion device can be performed. Specifically, the expansion device can be powered on and initialized, and then the device information of the expansion device can be read through the bus. The device information may include a device type, and a corresponding driver is loaded according to the device type of the extended device, and corresponding services and applications are started.

具体实施时,任何情况下,终端的CPU都需要启动相关驱动和服务等程序,部分扩展设备需要终端的CPU将相关的程序发送给所述扩展设备。具体的启动过程可以为:初始化接口总线,发送相关的程序给扩展设备,所述扩展设备启动,然后终端HOST端与扩展设备两端状态同步,进入正常工作模式。其中,两端状态同步可以为建立连接后读取扩展设备的状态,扩展设备的状态可以包括上次扩展设备关机时的状态,所述终端可以控制扩展设备开/关机。During specific implementation, in any case, the CPU of the terminal needs to start programs such as related drivers and services, and some extension devices require the CPU of the terminal to send related programs to the extension device. The specific start-up process can be: initialize the interface bus, send related programs to the expansion device, the expansion device starts, and then the terminal HOST and the two ends of the expansion device are synchronized to enter the normal working mode. Wherein, the state synchronization at both ends may be to read the state of the extension device after the connection is established, the state of the extension device may include the state when the extension device was turned off last time, and the terminal may control the extension device to turn on/off.

所述向所述扩展设备发送的所述扩展设备启动所需要的程序,可以为终端预先存储,也可以为终端从云端下载后再传输至扩展设备。The program required for starting the extension device sent to the extension device may be pre-stored by the terminal, or may be downloaded from the cloud by the terminal and then transmitted to the extension device.

所述扩展设备的设备类型可以为电脑猫(调制解调器modem的俗称)、或者应用类设备,所述应用类设备具体可以为充电宝、心率计、投影仪等。The device type of the extension device can be a computer modem (commonly known as a modem), or an application device, and the application device can specifically be a power bank, a heart rate meter, a projector, and the like.

本发明实施例可以在确定所述扩展设备的设备类型后,加载驱动并启动相应的服务和应用,可以通过总线完成状态同步,实现扩展设备的正常使用。In the embodiment of the present invention, after determining the device type of the extension device, the driver can be loaded and corresponding services and applications can be started, and the state synchronization can be completed through the bus to realize the normal use of the extension device.

实施中,所述方法可以进一步包括:In implementation, the method may further include:

监测所述扩展设备的工作状态;monitoring the working status of the expansion device;

根据所述工作状态对所述扩展设备进行维护。The extension device is maintained according to the working state.

具体实施时,在完成初始化正常工作之后,所述扩展设备的工作状态可能会发生动态变化,例如:繁忙busy→空闲idle→挂起suspend→休眠standby→关闭down等,还有可能发生异常情况。During specific implementation, after the normal work of initialization is completed, the working state of the expansion device may change dynamically, for example: busy → idle → suspend → standby → shutdown, etc., and abnormal situations may also occur.

本发明实施例可以通过相应的服务程序来监测扩展设备的工作状态、维护扩展设备的状态,例如:在正常插入或未插入扩展设备时通知终端CPU、在插入异常时弹出提示信息、或者在运行过程中进行状态更新和维护等,以确保扩展设备的正常使用。The embodiment of the present invention can monitor the working state of the expansion device and maintain the state of the expansion device through the corresponding service program, for example: notify the terminal CPU when the expansion device is inserted normally or not, pop up a prompt message when the insertion is abnormal, or run Status update and maintenance are carried out during the process to ensure the normal use of the extended device.

实施中,所述总线具体可以为串行总线I2C总线,所述扩展设备的接口芯片被挂到总线上具体可以为所述扩展设备的I2C接口芯片被挂到I2C总线上。In implementation, the bus may specifically be a serial bus I2C bus, and the interface chip of the expansion device is connected to the bus. Specifically, the I2C interface chip of the expansion device may be connected to the I2C bus.

具体实施时,所述总线可以为I2C总线或其他总线,扩展设备中的I2C接口芯片在扩展设备插入终端的接口后即被挂到I2C总线上,所述扩展设备的接口芯片可以通过I2C总线与终端的系统建立联系,所述终端的系统可以通过I2C总线读取所述扩展设备的设备信息。During specific implementation, the bus can be an I2C bus or other buses. The I2C interface chip in the expansion device is hung on the I2C bus after the expansion device is inserted into the terminal interface. The interface chip of the expansion device can communicate with the I2C bus through the I2C bus. The system of the terminal establishes a connection, and the system of the terminal can read the device information of the extension device through the I2C bus.

I2C总线的读写通常具有固定的格式,一般顺序可以为:地址(读/写)→寄存器地址→数据,本发明实施例可以采用这一顺序来最终获取到所述扩展设备的设备信息,具体实施时,本发明实施例可以预先设置一组地址(例如:2、4或者8个)作为扩展设备的地址。The reading and writing of the I2C bus usually has a fixed format, and the general sequence can be: address (read/write)→register address→data, and this sequence can be used in the embodiment of the present invention to finally obtain the device information of the expansion device, specifically During implementation, the embodiment of the present invention may preset a group of addresses (for example, 2, 4 or 8) as the addresses of the expansion device.

在实施中采用I2C总线等方式是由于这些方式比较常用、主流,易于本领域技术人员使用/理解,所以这里以I2C总线为例;但是,从理论上来说,用其他的方式也是可以的,只要能够实现挂接外部扩展设备的目的即可,I2C总线仅用于教导本领域技术人员具体如何实施本发明,但并不意味仅能使用I2C总线,实施过程中可以结合实践需要来确定相应的方式。In the implementation, the I2C bus and other methods are used because these methods are more commonly used and mainstream, and are easy to use/understand by those skilled in the art, so the I2C bus is used as an example here; however, in theory, it is also possible to use other methods, as long as It is enough to realize the purpose of connecting external expansion devices. The I2C bus is only used to teach those skilled in the art how to implement the present invention, but it does not mean that only the I2C bus can be used. During the implementation process, the corresponding method can be determined in combination with practical needs .

实施中,所述设备信息还可以包括:制造商信息和/或设备版本。In implementation, the device information may further include: manufacturer information and/or device version.

具体实施时,所述设备信息还可以包括制造商信息、设备版本等信息。During specific implementation, the device information may also include manufacturer information, device version and other information.

现有技术通过电压高低的方式检测,只能简单的检测出设备类型,无法得到设备的具体版本、制造商等信息,而本发明实施例通过总线的方式读取扩展设备的设备信息,所述设备信息可以包括设备的具体版本、制造商等信息,从而可以获取扩展设备的全面信息。The existing technology can only detect the device type simply by detecting the voltage level, but cannot obtain information such as the specific version and manufacturer of the device. However, the embodiment of the present invention reads the device information of the expansion device through the bus. The device information may include information such as the specific version and manufacturer of the device, so that comprehensive information about the extended device can be obtained.

实施中,所述终端的接口可以为68pin的复合接口。In implementation, the interface of the terminal may be a 68pin composite interface.

具体实施时,本发明实施例中终端的接口可以为复合接口,具体可以为68pin或者其他数量管脚的复合接口。During specific implementation, the interface of the terminal in the embodiment of the present invention may be a composite interface, specifically a composite interface with 68 pins or other numbers of pins.

由于本发明实施例采用的是复合接口,因此,该接口可以支持多种类型的扩展设备,而现有技术中的终端只能支持标准接口的设备,本发明实施例的扩展性更强。Since the embodiment of the present invention adopts a composite interface, the interface can support various types of expansion devices, while terminals in the prior art can only support devices with standard interfaces, and the embodiment of the present invention has stronger expandability.

实施例二、Embodiment two,

本发明实施例以一具体实例进行说明。The embodiment of the present invention is described with a specific example.

图2示出了本发明实施例中接口检测过程的示意图,如图所示,所述接口检测过程可以包括如下步骤:FIG. 2 shows a schematic diagram of the interface detection process in an embodiment of the present invention. As shown in the figure, the interface detection process may include the following steps:

步骤201、检测接口管脚Plug_DET_UP和Plug_DET_Down;Step 201, detecting interface pins Plug_DET_UP and Plug_DET_Down;

步骤202、判断两个pin是否均为低电平;Step 202, judging whether the two pins are both low;

如果是,则执行步骤203;If yes, then perform step 203;

如果不是,则执行步骤207;If not, then perform step 207;

步骤203、确定扩展设备插入;Step 203, determine that the expansion device is plugged in;

步骤204、开始扩展设备检测;Step 204, start extended device detection;

步骤205、通过I2C获取设备ID;Step 205, obtain the device ID through I2C;

步骤206、上报扩展设备类型,结束;Step 206, report the extended device type, end;

步骤207、判断两个pin是否均为高电平;Step 207, judging whether the two pins are both high;

如果是,则确定无扩展设备插入,结束;If yes, then determine that no expansion device is plugged in, end;

如果不是,则提示扩展设备插入连接问题,结束。If not, it will prompt the expansion device to plug in the connection problem, end.

具体实施中,可以根据设备ID确定设备类型,例如:假设扩展设备的设备ID为A0123,那么扩展设备的设备类型则可以为A。In a specific implementation, the device type may be determined according to the device ID. For example, if the device ID of the extension device is A0123, then the device type of the extension device may be A.

本发明实施例可以检测接口的用于插入检测的管脚Plug_DET_UP和Plug_DET_Down,如果这两个pin均为低电平,则可以确定扩展设备插入,然后进行设备检测、通过I2C总线获取设备ID、上报设备类型等操作;如果两个pin均为高电平,则说明没有扩展设备插入;如果一个pin为高电平、另一个pin为低电平,则说明扩展设备插入有问题、连接异常,可以提示用户插入连接问题,待用户重新插入后再次进行检测操作。The embodiment of the present invention can detect the plug-in detection pins Plug_DET_UP and Plug_DET_Down of the interface. If these two pins are both low level, it can be determined that the expansion device is plugged in, and then the device detection is performed, and the device ID is obtained through the I2C bus and reported. Device type and other operations; if both pins are high level, it means that no expansion device is plugged in; if one pin is high level and the other pin is low level, it means that there is a problem with the insertion of the expansion device or the connection is abnormal. Prompt the user to insert the connection problem, and perform the detection operation again after the user reinserts.

实施例三、Embodiment three,

基于同一发明构思,本发明实施例中还提供了一种接口检测装置,由于这些设备解决问题的原理与一种接口检测方法相似,因此这些设备的实施可以参见方法的实施,重复之处不再赘述。Based on the same inventive concept, an interface detection device is also provided in the embodiment of the present invention. Since the problem-solving principle of these devices is similar to an interface detection method, the implementation of these devices can refer to the implementation of the method, and the repetition is no longer repeat.

图3示出了本发明实施例中接口检测装置的结构示意图一,如图所示,所述接口检测装置可以包括:Fig. 3 shows a first schematic structural diagram of an interface detection device in an embodiment of the present invention. As shown in the figure, the interface detection device may include:

检测模块301,用于检测终端的接口管脚;A detection module 301, configured to detect interface pins of the terminal;

第一确定模块302,用于如果用于插入检测的接口管脚为第一电平,确定终端的接口有扩展设备插入;The first determination module 302 is configured to determine that an expansion device is inserted into the interface of the terminal if the interface pin used for insertion detection is at the first level;

挂接模块303,用于将所述扩展设备的接口芯片挂到总线上;A hooking module 303, configured to hang the interface chip of the expansion device on the bus;

读取模块304,用于对所述扩展设备进行上电初始化,通过总线读取所述扩展设备的设备信息;所述设备信息包括设备标识ID;The reading module 304 is configured to perform power-on initialization on the expansion device, and read the device information of the expansion device through the bus; the device information includes a device identification ID;

第二确定模块305,用于根据所述设备ID确定所述扩展设备的设备类型。The second determining module 305 is configured to determine the device type of the extension device according to the device ID.

具体实施时,所述检测模块可以在终端上电以后检测终端的接口管脚,也可以通过中断的方式定时或不定时的检测终端的接口管脚。During specific implementation, the detection module may detect the interface pins of the terminal after the terminal is powered on, or detect the interface pins of the terminal regularly or irregularly by way of interruption.

所述第一电平可以为低电平或者高电平,所述第一确定模块具体可以用于如果用于插入检测的接口管脚为低电平,确定终端的接口有扩展设备插入;终端的接口管脚pins可以有很多,其中可以包括用于插入检测的接口管脚,例如:PLUG_DET_UP和PLUG_DET_Down,所述第一确定模块具体可以用于如果PLUG_DET_UP和PLUG_DET_Down管脚均为低电平,确定终端的接口有扩展设备插入。The first level may be a low level or a high level, and the first determination module may be specifically configured to determine that an extension device is inserted into the interface of the terminal if the interface pin used for insertion detection is a low level; There may be many interface pins, which may include interface pins for insertion detection, for example: PLUG_DET_UP and PLUG_DET_Down, and the first determination module may specifically be used to determine if the PLUG_DET_UP and PLUG_DET_Down pins are both low The interface of the terminal has expansion equipment plugged in.

挂接模块具体可以用于在扩展设备插入终端的接口后,将扩展设备的接口芯片挂到总线上,一条总线上可以连接多个扩展设备,挂接模块可以用于将多个扩展设备的接口芯片分别挂到总线上,这些扩展设备均可以直接与终端的系统直接传递数据。Specifically, the hook-up module can be used to hang the interface chip of the expansion device on the bus after the expansion device is inserted into the interface of the terminal. Multiple expansion devices can be connected to one bus, and the hook-up module can be used to connect the interfaces of multiple expansion devices The chips are respectively hung on the bus, and these expansion devices can directly transmit data with the terminal system.

本发明实施例中挂接模块在扩展设备插入终端接口后即将所述扩展设备挂到总线上,检测模块可以通过检测终端接口管脚来确定是否有扩展设备插入,读取模块在在确定有扩展设备插入后通过总线即可读取到扩展设备的设备类型,本发明实施例通过一个接口即可实现各种类型的扩展设备的插入、检测;并且,现有技术中终端的一个接口只能连接一个标准接口设备,而本发明实施例由于采用的是总线形式,同一时刻可以支持多个扩展设备的插入,扩展性较强,解决了现有技术中通过电压高低的方式来检测设备类型、只能检测标准接口设备等问题。In the embodiment of the present invention, after the expansion device is inserted into the terminal interface, the hook-up module will hang the expansion device on the bus, and the detection module can determine whether there is an expansion device inserted by detecting the pins of the terminal interface. After the device is inserted, the device type of the expansion device can be read through the bus, and the embodiment of the present invention can realize the insertion and detection of various types of expansion devices through one interface; and, one interface of the terminal in the prior art can only connect A standard interface device, and because the embodiment of the present invention adopts the bus form, it can support the insertion of multiple expansion devices at the same time, and the scalability is strong. Can detect standard interface equipment and other problems.

图4示出了本发明实施例中接口检测装置的结构示意图二,如图所示,所述装置可以进一步包括:Fig. 4 shows a schematic structural diagram II of an interface detection device in an embodiment of the present invention. As shown in the figure, the device may further include:

启动模块306,用于根据所述扩展设备的设备类型,加载设备驱动并启动相应的服务程序和应用程序;A startup module 306, configured to load a device driver and start a corresponding service program and application program according to the device type of the extension device;

发送模块307,用于向所述扩展设备发送所述扩展设备启动所需要的程序;A sending module 307, configured to send to the extension device the program required for the extension device to start;

同步模块308,用于待所述扩展设备启动后,与所述扩展设备执行状态同步。The synchronization module 308 is configured to perform state synchronization with the expansion device after the expansion device is started.

具体实施时,所述发送模块具体可以用于将预先存储的所述扩展设备启动所需要的程序发送给所述扩展设备,还可以用于从云端下载所述扩展设备启动所需要的程序并在下载成功后将所述扩展设备启动所需要的程序发送给所述扩展设备。During specific implementation, the sending module can specifically be used to send the pre-stored program required for starting the expansion device to the expansion device, and can also be used to download the program required for starting the expansion device from the cloud and send it to the After the download is successful, the program required for starting the expansion device is sent to the expansion device.

本发明实施例中可以在确定所述扩展设备的设备类型后,由启动模块加载驱动并启动相应的服务和应用,发送模块将所述扩展设备启动所需要的程序发送给扩展设备之后,同步模块可以通过总线完成状态同步,实现扩展设备的正常使用。In the embodiment of the present invention, after the device type of the expansion device is determined, the startup module loads the driver and starts the corresponding service and application, and after the sending module sends the program required for starting the expansion device to the expansion device, the synchronization module The status synchronization can be completed through the bus to realize the normal use of the expansion device.

图5示出了本发明实施例中接口检测装置的结构示意图三,如图所示,所述装置可以进一步包括:Fig. 5 shows a schematic structural diagram III of an interface detection device in an embodiment of the present invention. As shown in the figure, the device may further include:

监测模块309,用于监测所述扩展设备的工作状态;A monitoring module 309, configured to monitor the working state of the expansion device;

维护模块310,用于根据所述工作状态对所述扩展设备进行维护。A maintenance module 310, configured to maintain the expansion device according to the working state.

具体实施时,所述监测模块具体可以用于监测所述扩展设备的工作状态,所述扩展设备的工作状态具体可以包括繁忙busy、空闲idle、挂起suspend、休眠standby、关闭down等,还有可能发生异常情况。During specific implementation, the monitoring module can specifically be used to monitor the working state of the expansion device, and the working state of the expansion device can specifically include busy busy, idle idle, suspend, sleep standby, shutdown, etc., and Unusual conditions may occur.

本发明实施例中监测模块可以通过相应的服务程序来监测扩展设备的工作状态,维护模块用于维护扩展设备的状态,例如:在正常插入或未插入扩展设备时通知终端CPU、在插入异常时弹出提示信息、或者在运行过程中进行状态更新和维护等,以确保扩展设备的正常使用。In the embodiment of the present invention, the monitoring module can monitor the working state of the expansion device through the corresponding service program. The maintenance module is used to maintain the state of the expansion device, for example: when the expansion device is inserted normally or not inserted, the terminal CPU is notified; Pop up prompt information, or perform status update and maintenance during operation to ensure the normal use of the extended device.

实施中,所述总线具体可以为串行总线I2C总线,所述挂接模块具体可以用于将所述扩展设备的I2C接口芯片挂到I2C总线上。In implementation, the bus may specifically be a serial bus I2C bus, and the hook-up module may specifically be used to hang the I2C interface chip of the expansion device onto the I2C bus.

具体实施时,所述总线可以为I2C总线或其他总线,挂接模块可以在扩展设备插入终端的接口后将扩展设备中的I2C接口芯片挂到I2C总线上,所述扩展设备的接口芯片可以通过I2C总线与终端的系统建立联系,所述读取模块可以通过I2C总线读取所述扩展设备的设备信息。During specific implementation, the bus can be an I2C bus or other buses, and the hook-up module can hang the I2C interface chip in the expansion device on the I2C bus after the expansion device is inserted into the interface of the terminal, and the interface chip of the expansion device can pass through The I2C bus establishes a connection with the terminal system, and the reading module can read the device information of the expansion device through the I2C bus.

实施中,所述读取模块读取的设备信息还可以包括:制造商信息和/或设备版本。In implementation, the device information read by the reading module may also include: manufacturer information and/or device version.

具体实施时,所述设备信息还可以包括制造商信息、设备版本等信息。所述读取模块具体可以用于读取所述扩展设备的制造商信息、设备版本、设备ID等信息。During specific implementation, the device information may also include manufacturer information, device version and other information. The reading module can be specifically used to read information such as manufacturer information, device version, and device ID of the expansion device.

实施中,所述终端的接口可以为68pin的复合接口。In implementation, the interface of the terminal may be a 68pin composite interface.

具体实施时,本发明实施例中终端的接口可以为复合接口,具体可以为68pin或者其他数量管脚的复合接口。During specific implementation, the interface of the terminal in the embodiment of the present invention may be a composite interface, specifically a composite interface with 68 pins or other numbers of pins.

由于本发明实施例采用的是复合接口,因此,该接口可以支持多种类型的扩展设备,而现有技术中的终端只能支持标准接口的设备,本发明实施例的扩展性更强。Since the embodiment of the present invention adopts a composite interface, the interface can support various types of expansion devices, while terminals in the prior art can only support devices with standard interfaces, and the embodiment of the present invention has stronger expandability.

为了描述的方便,以上所述装置的各部分以功能分为各种模块或单元分别描述。当然,在实施本发明时可以把各模块或单元的功能在同一个或多个软件或硬件中实现。For the convenience of description, each part of the device described above is divided into various modules or units by function and described separately. Of course, when implementing the present invention, the functions of each module or unit can be implemented in one or more pieces of software or hardware.

实施例四、Embodiment four,

图6示出了本发明实施例中手机插入扩展设备的结构示意图,如图所示,本发明实施例以手机作为终端为例进行如下说明。FIG. 6 shows a schematic structural diagram of a mobile phone inserted into an extension device in an embodiment of the present invention. As shown in the figure, the embodiment of the present invention takes a mobile phone as a terminal as an example for the following description.

本发明实施例中的手机设置有扩展接口,用于插入扩展设备。具体实施时,所述手机上的扩展接口可以为公口和/或母口,所述待插入的扩展设备可以既包括公口又包括母口,所述扩展设备的公口和母口可以分别置于所述扩展设备的两个对立面的外侧。The mobile phone in the embodiment of the present invention is provided with an expansion interface for inserting an expansion device. During specific implementation, the expansion interface on the mobile phone can be a male port and/or a female port, and the expansion device to be inserted can include both a male port and a female port, and the male port and the female port of the expansion device can be respectively placed on the outside of the two opposite sides of the expansion device.

假设手机上的扩展接口为公口,所述扩展设备为音乐播放器、投影仪,所述音乐播放器的一个平面外侧设置有母口、另一个对立面外侧设置有公口,所述投影仪的一个平面外侧设置有母口、另一对立面外侧设置有公口。Assume that the expansion interface on the mobile phone is a male port, and the expansion device is a music player and a projector. A female port is provided on the outside of one plane of the music player, and a male port is provided on the outside of the other opposite surface. A female port is provided on the outside of one plane, and a male port is provided on the outside of the other opposite surface.

所述音乐播放器的母口与手机的公口对接,所述投影仪的母口与所述音乐播放器的公口对接,即可实现在手机的背面叠加两个外部扩展设备。所述外部的扩展设备在插入手机后,本发明实施例通过总线的形式,所有外部扩展设备都可以直接挂在总线上,可以分别与手机直接传输数据。The female port of the music player is docked with the male port of the mobile phone, and the female port of the projector is connected with the male port of the music player, so that two external expansion devices can be superimposed on the back of the mobile phone. After the external expansion devices are inserted into the mobile phone, all external expansion devices can be directly connected to the bus in the form of a bus in the embodiment of the present invention, and can directly transmit data with the mobile phone respectively.

手机可以检测手机的公口管脚,如果手机的公口管脚的PLUG_DET_UP和PLUG_DET_Down均为低电平,则说明手机的扩展接口有扩展设备插入;然后手机可以向总线的相应地址发送获取设备信息的请求,所述音乐播放器响应所述请求,响应报文中可以携带自身的设备ID(假设为YYBFQ01)、设备版本号和制造厂家等信息,所述手机获取到所述扩展设备的设备ID后,即可确定所述扩展设备为音乐播放器。The mobile phone can detect the male pins of the mobile phone. If the PLUG_DET_UP and PLUG_DET_Down of the male pins of the mobile phone are both low, it means that there is an expansion device plugged into the expansion interface of the mobile phone; then the mobile phone can send to the corresponding address of the bus to obtain device information The music player responds to the request, and the response message can carry information such as its own device ID (assumed to be YYBFQ01), device version number and manufacturer, and the mobile phone obtains the device ID of the extended device After that, it can be determined that the extended device is a music player.

手机还可以继续检测所述音乐播放器的公口,如果所述音乐播放器的公口管脚的PLUG_DET_UP和PLUG_DET_Down均为低电平,则说明所述音乐播放器的扩展接口有扩展设备插入;然后手机可以向总线的相应地址发送获取设备信息的请求,所述投影仪响应所述请求,响应报文中可以携带自身的设备ID(假设为TYY01)、设备版本号和制造厂家等信息,所述手机获取到所述扩展设备的设备ID后,即可确定所述扩展设备为投影仪。The mobile phone can also continue to detect the public port of the music player, if the PLUG_DET_UP and PLUG_DET_Down of the public port pins of the music player are both low level, it means that the expansion interface of the music player has an expansion device inserted; Then the mobile phone can send a request to obtain device information to the corresponding address of the bus, and the projector responds to the request, and the response message can carry information such as its own device ID (assumed to be TYY01), device version number and manufacturer, so After the mobile phone obtains the device ID of the extension device, it can determine that the extension device is a projector.

本发明实施例在确定扩展设备分别为音乐播放器和投影仪之后,可以分别为音乐播放器和投影仪加载设备驱动以及启动相应的服务程序和应用程序:In the embodiment of the present invention, after determining that the extended devices are respectively a music player and a projector, device drivers can be respectively loaded for the music player and the projector and corresponding service programs and application programs can be started:

加载音乐播放器驱动并启动音乐播放器相应的服务程序和应用程序之后,向音乐播放器发送所述音乐播放器启动所需要的程序,待音乐播放器成功启动后,手机与音乐播放器完成状态同步;After loading the music player driver and starting the corresponding service program and application program of the music player, send the program required for starting the music player to the music player. After the music player is successfully started, the mobile phone and the music player are in a complete state Synchronize;

加载投影仪驱动并启动投影仪相应的服务程序和应用程序之后,向投影仪发送所述投影仪启动所需要的程序,待投影仪成功启动后,手机与投影仪完成状态同步。After loading the projector driver and starting the corresponding service program and application program of the projector, the program required for starting the projector is sent to the projector. After the projector is successfully started, the mobile phone and the projector complete state synchronization.

至此,手机和外部扩展设备音乐播放器、投影仪即可进入正常工作模式,用户可以通过手机实现开着mp3的同时播放幻灯片的目的。At this point, the mobile phone and the external extension equipment music player and projector can enter the normal working mode, and the user can realize the purpose of playing the slide show while turning on the mp3 through the mobile phone.

实施例五、Embodiment five,

下面本发明实施例以智能机器人作为终端为例进行说明。The following embodiments of the present invention will be described by taking an intelligent robot as a terminal as an example.

本发明实施例中的智能机器人设置有扩展接口,用于插入扩展设备,所述扩展设备具体可以为充电宝等。The intelligent robot in the embodiment of the present invention is provided with an expansion interface for inserting an expansion device, and the expansion device may specifically be a power bank or the like.

具体实施时,所述智能机器人上的扩展接口可以为公口,所述充电宝上的接口可以为母口;或者,所述智能机器人上的扩展接口可以为母口,所述充电宝上的接口可以为公口;又或者,所述智能机器人上的扩展接口既包括公口又包括母口,所述充电宝上的接口为公口或者母口、或者既包括公口又包括母口。During specific implementation, the expansion interface on the intelligent robot can be a male port, and the interface on the charging treasure can be a female port; or, the expansion interface on the intelligent robot can be a female port, and the The interface can be a male port; or, the expansion interface on the intelligent robot includes both a male port and a female port, and the interface on the power bank is a male port or a female port, or both.

当所述充电宝的接口与所述智能机器人的扩展接口对接后,所述充电宝直接挂在I2C总线上,可以与所述智能机器人直接传输数据。After the interface of the charging treasure is connected with the expansion interface of the intelligent robot, the charging treasure is directly connected to the I2C bus, and can directly transmit data with the intelligent robot.

所述智能机器人可以检测智能机器人的扩展接口的管脚,如果所述智能机器人的扩展接口的管脚的PLUG_DET_UP和PLUG_DET_Down均为低电平,则说明智能机器人的扩展接口有扩展设备插入;然后所述智能机器人可以向总线的相应地址发送获取设备信息的请求,所述充电宝响应所述请求,响应报文中可以携带自身的设备ID(假设为CDB092)、设备版本号和制造厂家等信息,所述智能机器人获取到所述扩展设备的设备ID后,即可确定所述扩展设备为充电宝(缩写为CDB)。The intelligent robot can detect the pins of the expansion interface of the intelligent robot. If the PLUG_DET_UP and PLUG_DET_Down of the pins of the expansion interface of the intelligent robot are both low level, it means that the expansion interface of the intelligent robot has an expansion device inserted; The intelligent robot can send a request to obtain device information to the corresponding address of the bus, and the power bank responds to the request, and the response message can carry information such as its own device ID (assumed to be CDB092), device version number, and manufacturer. After the intelligent robot acquires the device ID of the extension device, it can determine that the extension device is a power bank (abbreviated as CDB).

本发明实施例在确定扩展设备为充电宝之后,所述智能机器人可以从云端下载充电宝驱动、充电宝启动所需要的服务程序和应用程序等,然后为所述充电宝加载充电宝驱动以及启动相应的服务程序和应用程序,向所述充电宝发送所述充电宝启动所需要的程序,待充电宝成功启动后,所述智能机器人读取充电宝的状态,完成状态同步。In the embodiment of the present invention, after the extended device is determined to be a power bank, the intelligent robot can download the power bank driver from the cloud, the service programs and application programs required for power bank startup, and then load the power bank driver and start the power bank for the power bank. The corresponding service program and application program send the program required for starting the power bank to the power bank. After the power bank is successfully started, the intelligent robot reads the state of the power bank and completes state synchronization.

至此,所述智能机器人与充电宝即可进入正常工作模式,在所述智能机器人执行用户指令的同时,所述充电宝可以为所述智能机器人充电,以确保智能机器人的正常使用。At this point, the intelligent robot and the power bank can enter the normal working mode. While the intelligent robot is executing user instructions, the power bank can charge the intelligent robot to ensure the normal use of the intelligent robot.

实施例六、Embodiment six,

图7示出了本发明实施例中pad插接扩展设备的结构示意图,如图所示,下面本发明实施例以平板电脑(pad)作为终端为例进行说明。FIG. 7 shows a schematic structural diagram of a pad plug-in expansion device in an embodiment of the present invention. As shown in the figure, the embodiment of the present invention will be described below taking a tablet computer (pad) as a terminal as an example.

本发明实施例中的pad设置有扩展接口,可以用于插入扩展设备,所述扩展设备具体可以为平板键盘、电话会议扬声器、打印机等。The pad in the embodiment of the present invention is provided with an expansion interface, which can be used to insert an expansion device, and the expansion device can specifically be a tablet keyboard, a conference call speaker, a printer, and the like.

具体实施时,所述pad上的扩展接口可以为公口或母口,所述扩展设备上的接口可以既包括公口又包括母口。During specific implementation, the expansion interface on the pad may be a male port or a female port, and the interface on the expansion device may include both a male port and a female port.

假设所述pad上的扩展接口为公口,当平板键盘的母口与所述pad的公口插接后,所述平板键盘的接口芯片即被挂在I2C总线上,可以与pad的系统直接传输信息。Assuming that the expansion interface on the pad is a male port, when the female port of the tablet keyboard is plugged into the male port of the pad, the interface chip of the tablet keyboard is hung on the I2C bus, which can be directly connected to the system of the pad. transmit information.

所述pad可以检测扩展接口的管脚,如果所述pad的扩展接口的管脚的PLUG_DET_UP和PLUG_DET_Down均为低电平,则说明pad的扩展接口有扩展设备插入;然后所述pad可以向总线的相应地址发送获取设备信息的请求,所述平板键盘响应所述请求,响应报文中可以携带自身的设备ID(假设为PBJP008)、设备版本号和制造厂家等信息,所述pad获取到所述扩展设备的设备ID后,即可确定所述扩展设备为平板键盘(缩写为PBJP)。The pad can detect the pins of the expansion interface. If the PLUG_DET_UP and PLUG_DET_Down of the pins of the expansion interface of the pad are both low, it means that the expansion interface of the pad has an expansion device inserted; The corresponding address sends a request to obtain device information, the tablet keyboard responds to the request, and the response message can carry information such as its own device ID (assumed to be PBJP008), device version number and manufacturer, and the pad obtains the After the device ID of the extension device, it can be determined that the extension device is a tablet keyboard (abbreviated as PBJP).

所述pad可以预先在pad存储空间内存储有平板键盘启动所需要的服务程序和应用程序等,本发明实施例在确定扩展设备为平板键盘之后,所述pad可以为所述平板键盘加载键盘驱动以及启动相应的服务程序和应用程序,向所述平板键盘发送所述键盘启动所需要的程序,待所述平板键盘成功启动后,所述pad读取平板键盘的状态,完成状态同步。The pad can pre-store the service programs and application programs required for starting the tablet keyboard in the pad storage space. In the embodiment of the present invention, after the expansion device is determined to be a tablet keyboard, the pad can load the keyboard driver for the tablet keyboard. And start the corresponding service program and application program, send the program needed for the keyboard to start to the tablet keyboard, after the tablet keyboard is successfully started, the pad reads the state of the tablet keyboard, and completes the state synchronization.

至此,所述pad与平板键盘即可进入正常工作模式,用户可以在使用pad的同时,通过所述平板键盘实现输入操作。At this point, the pad and the tablet keyboard can enter the normal working mode, and the user can perform input operations through the tablet keyboard while using the pad.

当用户需要进行电话会议时,为了使旁边的其他人也能参与进来、听清会议内容,用户可以在平板键盘的公口插接一个电话会议扬声器(对应电话会议扬声器的母口),所述电话会议扬声器的接口芯片同样被挂在I2C总线上,可以与pad的系统直接传输信息。When the user needs to conduct a conference call, in order to allow other people next to him to participate and hear the content of the conference clearly, the user can insert a conference call speaker (corresponding to the female port of the conference call speaker) into the male port of the tablet keyboard. The interface chip of the conference call speaker is also hung on the I2C bus, which can directly transmit information with the pad system.

由于所述pad的公口与平板键盘的母口插接,所述平板键盘的公口即相当于所述pad的公口,实现扩展功能。所述pad可以检测所述平板键盘的公口的管脚,如果所述公口管脚的PLUG_DET_UP和PLUG_DET_Down均为低电平,则说明有扩展设备插入;然后所述pad可以向总线的相应地址发送获取设备信息的请求,所述电话会议扬声器响应所述请求,响应报文中可以携带自身的设备ID(假设为DHHYYSQ011)、设备版本号和制造厂家等信息,所述pad获取到所述扩展设备的设备ID后,即可确定所述扩展设备为电话会议扬声器(缩写为DHHYYSQ)。Since the male port of the pad is plugged into the female port of the tablet keyboard, the male port of the tablet keyboard is equivalent to the male port of the pad to realize extended functions. The pad can detect the pins of the male port of the tablet keyboard. If the PLUG_DET_UP and PLUG_DET_Down of the male pins are both low, it means that an expansion device is inserted; then the pad can send the corresponding address to the bus. Send a request to obtain device information, the conference call speaker responds to the request, and the response message can carry information such as its own device ID (assumed to be DHHYYSQ011), device version number and manufacturer, and the pad obtains the extended After the device ID of the device is obtained, it can be determined that the extension device is a conference call speaker (abbreviated as DHHYYSQ).

所述pad可以预先在pad存储空间内存储有电话会议扬声器启动所需要的服务程序和应用程序等,本发明实施例在确定扩展设备为电话会议扬声器之后,所述pad可以为所述电话会议扬声器加载扬声器驱动以及启动相应的服务程序和应用程序,向所述电话会议扬声器发送所述扬声器启动所需要的程序,待所述电话会议扬声器成功启动后,所述pad读取电话会议扬声器的状态,完成状态同步。The pad can pre-store the service programs and application programs required for starting the conference call speaker in the pad storage space. In the embodiment of the present invention, after the extension device is determined to be the conference call speaker, the pad can be the conference call speaker Load the speaker driver and start the corresponding service program and application program, send the program required for the speaker to start to the speaker of the conference call, after the speaker of the conference call is successfully started, the pad reads the state of the speaker of the conference call, Complete state synchronization.

至此,所述pad与电话会议扬声器即可进入正常工作模式,用户可以在使用pad的同时,通过所述电话会议扬声器提高电话会议的音量。So far, the pad and the conference call speaker can enter the normal working mode, and the user can increase the volume of the conference call through the conference call speaker while using the pad.

当用户在会议过程中需要打印文档供大家阅读时,可以在电话会议扬声器的公口插接一个打印机(对应打印机的母口),所述打印机的接口芯片同样被挂在I2C总线上,可以与pad的系统直接传输信息。When the user needs to print documents for everyone to read during the meeting, a printer (corresponding to the female port of the printer) can be plugged into the male port of the conference call speaker, and the interface chip of the printer is also hung on the I2C bus, which can communicate with the The pad's system transmits information directly.

由于所述pad的公口与平板键盘的母口插接、所述平板键盘的公口与电话会议扬声器的母口插接,所述电话会议扬声器的公口即相当于所述pad的公口,实现扩展功能。所述pad可以检测所述电话会议扬声器的公口的管脚,如果所述公口管脚的PLUG_DET_UP和PLUG_DET_Down均为低电平,则说明有扩展设备插入;然后所述pad可以向总线的相应地址发送获取设备信息的请求,所述打印机响应所述请求,响应报文中可以携带自身的设备ID(假设为DYJ080)、设备版本号和制造厂家等信息,所述pad获取到所述扩展设备的设备ID后,即可确定所述扩展设备为打印机(缩写为DYJ)。Since the male port of the pad is plugged into the female port of the tablet keyboard, and the male port of the tablet keyboard is plugged into the female port of the conference call speaker, the male port of the conference call speaker is equivalent to the male port of the pad , to achieve extended functionality. The pad can detect the pins of the public port of the conference call speaker. If the PLUG_DET_UP and PLUG_DET_Down of the public port pins are both low, it means that an expansion device is inserted; The address sends a request to obtain device information, the printer responds to the request, and the response message can carry information such as its own device ID (assumed to be DYJ080), device version number, and manufacturer, and the pad obtains the extension device After the device ID of the device, it can be determined that the extended device is a printer (abbreviated as DYJ).

本发明实施例在确定扩展设备为打印机之后,所述pad可以从网络下载打印机启动所需要的服务程序和应用程序等,所述pad可以为所述打印机加载打印机驱动以及启动相应的服务程序和应用程序,向所述打印机发送所述打印机启动所需要的程序,待所述打印机成功启动后,所述pad读取打印机的状态,完成状态同步。In the embodiment of the present invention, after the extended device is determined to be a printer, the pad can download the service program and application program required for starting the printer from the network, and the pad can load the printer driver for the printer and start the corresponding service program and application program. The program sends the program required for starting the printer to the printer, and after the printer is successfully started, the pad reads the status of the printer to complete the status synchronization.

至此,所述pad与打印机即可进入正常工作模式,用户可以在使用pad的同时,通过所述打印机实现文档打印功能。So far, the pad and the printer can enter the normal working mode, and the user can realize the document printing function through the printer while using the pad.

本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.

本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.

尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。While preferred embodiments of the invention have been described, additional changes and modifications to these embodiments can be made by those skilled in the art once the basic inventive concept is appreciated. Therefore, it is intended that the appended claims be construed to cover the preferred embodiment as well as all changes and modifications which fall within the scope of the invention.

Claims (12)

1. a kind of interface detection method, it is characterised in that comprise the following steps:
Detect the interface pin of terminal;
If being the first level for the interface pin for inserting detection, determining the interface of terminal has expansion equipment insertion;It is described to expand The interface chip of exhibition equipment is suspended in bus;
Power-up initializing is carried out to the expansion equipment, the facility information of the expansion equipment is read by bus;The equipment Information includes device identification ID;
The device type of the expansion equipment is determined according to the device id.
2. the method as described in claim 1, it is characterised in that further comprise:
According to the device type of the expansion equipment, loading equipemtn drives and starts corresponding service routine and application program;
The program required for the expansion equipment starts is sent to the expansion equipment;
After after expansion equipment startup, state synchronized is performed with the expansion equipment.
3. method as claimed in claim 2, it is characterised in that further comprise:
Monitor the working condition of the expansion equipment;
The expansion equipment is safeguarded according to the working condition.
4. the method as described in claim 1, it is characterised in that the bus is specially universal serial bus I2C buses, the extension The I2C interface chips that the interface chip of equipment is suspended to the specially expansion equipment in bus are suspended in I2C buses.
5. the method as described in claim 1, it is characterised in that the facility information also includes manufacturer's information and/or equipment Version.
6. the method as described in claim 1, it is characterised in that the interface of the terminal is 68pin compound interface.
7. a kind of interface detection apparatus, it is characterised in that including:
Detection module, the interface pin for detecting terminal;
First determining module, if being the first level for the interface pin for inserting detection, determining the interface of terminal has expansion Open up equipment insertion;
Knock-down module, for the interface chip of the expansion equipment to be suspended into bus;
Read module, for carrying out power-up initializing, the equipment that the expansion equipment is read by bus to the expansion equipment Information;The facility information includes device identification ID;
Second determining module, the device type for determining the expansion equipment according to the device id.
8. device as claimed in claim 7, it is characterised in that further comprise:
Starting module, for the device type according to the expansion equipment, loading equipemtn drives and starts corresponding service routine And application program;
Sending module, for sending the program required for the expansion equipment starts to the expansion equipment;
Synchronization module, for after after expansion equipment startup, state synchronized to be performed with the expansion equipment.
9. device as claimed in claim 8, it is characterised in that further comprise:
Monitoring modular, the working condition for monitoring the expansion equipment;
Maintenance module, for being safeguarded according to the working condition to the expansion equipment.
10. device as claimed in claim 7, it is characterised in that the bus is specially universal serial bus I2C buses, the extension Connection module is specifically for the I2C interface chips of the expansion equipment are suspended in I2C buses.
11. device as claimed in claim 7, it is characterised in that the facility information also includes manufacturer's information and/or equipment Version.
12. device as claimed in claim 7, it is characterised in that the interface of the terminal is 68pin compound interface.
CN201680002678.0A 2016-06-03 2016-06-03 Interface detection method and device Active CN107003974B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/084657 WO2017206161A1 (en) 2016-06-03 2016-06-03 Interface detection method and apparatus

Publications (2)

Publication Number Publication Date
CN107003974A true CN107003974A (en) 2017-08-01
CN107003974B CN107003974B (en) 2020-07-14

Family

ID=59431637

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201680002678.0A Active CN107003974B (en) 2016-06-03 2016-06-03 Interface detection method and device

Country Status (2)

Country Link
CN (1) CN107003974B (en)
WO (1) WO2017206161A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108550253A (en) * 2018-03-28 2018-09-18 宁波三星医疗电气股份有限公司 A kind of interaction control method of meter and digital transmission module
CN109164874A (en) * 2018-08-03 2019-01-08 联想(北京)有限公司 A kind of information processing method and electronic equipment
CN109270342A (en) * 2018-11-13 2019-01-25 江苏斯菲尔电气股份有限公司 Multifunctional electric meter with external expansion module self-identifying technology
CN111897760A (en) * 2020-07-30 2020-11-06 普联技术有限公司 Electronic product, expansion device thereof, control method and control device

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111385320A (en) * 2018-12-28 2020-07-07 深圳市云海物联科技有限公司 Method and device for expanding Internet of things system
CN110212619A (en) * 2019-07-02 2019-09-06 深圳市云充吧科技有限公司 A kind of mobile power source charging terminal with bill printing unit
CN115687215A (en) * 2022-11-03 2023-02-03 深圳市汇川技术股份有限公司 Serial port multiplexing method, device, equipment and storage medium
CN119603188A (en) * 2024-11-29 2025-03-11 浙江正泰仪器仪表有限责任公司 A communication module detection method and terminal

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1811480A (en) * 2005-01-26 2006-08-02 华为技术有限公司 Method and apparatus for real-time monitoring level signal
CN102546869A (en) * 2012-01-06 2012-07-04 海能达通信股份有限公司 USB (Universal Serial Bus) interface multiplexing interphone and control method thereof
CN103544122A (en) * 2013-10-29 2014-01-29 华东师范大学 Port adaptive matching synergetic system and synergetic method thereof
CN104506939A (en) * 2014-12-15 2015-04-08 四川长虹电器股份有限公司 Information reporting method and television terminal
CN105302750A (en) * 2015-09-30 2016-02-03 联想(北京)有限公司 Interface function configuration method and electronic equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1964452A (en) * 2005-11-09 2007-05-16 南靖万利达科技有限公司 A method for TV set identifying automatically extended function module
CN100452003C (en) * 2007-02-16 2009-01-14 北京飞天诚信科技有限公司 Information safety apparatus having multiple interface and capable of being automatically installed and controlling method therefor
US20080265838A1 (en) * 2007-04-24 2008-10-30 Saurabh Garg Battery charging using a USB-ID pin of a USB interface
US8683087B2 (en) * 2011-04-11 2014-03-25 Fairchild Semiconductor Corporation Mobile device auto detection apparatus and method
CN103678237B (en) * 2013-12-19 2018-04-27 华为技术有限公司 The docking calculation and device of transmission equipment satellite interface

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1811480A (en) * 2005-01-26 2006-08-02 华为技术有限公司 Method and apparatus for real-time monitoring level signal
CN102546869A (en) * 2012-01-06 2012-07-04 海能达通信股份有限公司 USB (Universal Serial Bus) interface multiplexing interphone and control method thereof
CN103544122A (en) * 2013-10-29 2014-01-29 华东师范大学 Port adaptive matching synergetic system and synergetic method thereof
CN104506939A (en) * 2014-12-15 2015-04-08 四川长虹电器股份有限公司 Information reporting method and television terminal
CN105302750A (en) * 2015-09-30 2016-02-03 联想(北京)有限公司 Interface function configuration method and electronic equipment

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108550253A (en) * 2018-03-28 2018-09-18 宁波三星医疗电气股份有限公司 A kind of interaction control method of meter and digital transmission module
CN109164874A (en) * 2018-08-03 2019-01-08 联想(北京)有限公司 A kind of information processing method and electronic equipment
CN109164874B (en) * 2018-08-03 2021-09-14 联想(北京)有限公司 Information processing method and electronic equipment
CN109270342A (en) * 2018-11-13 2019-01-25 江苏斯菲尔电气股份有限公司 Multifunctional electric meter with external expansion module self-identifying technology
CN109270342B (en) * 2018-11-13 2024-03-26 江苏斯菲尔电气股份有限公司 Multifunctional ammeter with function expansion module self-identification technology
CN111897760A (en) * 2020-07-30 2020-11-06 普联技术有限公司 Electronic product, expansion device thereof, control method and control device

Also Published As

Publication number Publication date
CN107003974B (en) 2020-07-14
WO2017206161A1 (en) 2017-12-07

Similar Documents

Publication Publication Date Title
CN107003974B (en) Interface detection method and device
TWI733752B (en) System and method for side band communication, and tangible, non-transitory, computer-readable medium
CN107423169B (en) Method and system for testing high speed peripheral device interconnection equipment
US9804859B2 (en) Re-enumeration of USB 3.0 compatible devices
US10733115B2 (en) Information handling system automated wireless pairing of peripheral devices
AU2015271399B2 (en) Super hub system and method thereof
KR102405773B1 (en) Method for communicating multi devices using usb type c interface and electronic device for the same
CN109560581B (en) Charging processing method, charging processing circuit, electronic device and storage medium
CN105048018B (en) The charging method and device of a kind of terminal with data exchanging function
WO2019203797A1 (en) Firmware setup menu options for docking stations
TWM584452U (en) Integrated electronic apparatus for data access, data transmission and power management
US20130217434A1 (en) Method and system for transmitting data and electronic apparatus using the method
EP1965307B1 (en) Adapter apparatus and data transmission system
CN111949103B (en) Integrated electronic device with data access, transmission and power management and method thereof
KR20130003645A (en) Method for establishing connection between external device and mobile terminal docking thereat
CN108777627A (en) A kind of method of supplying power to and device
CN115273445A (en) Sensor access method, device, equipment and computer readable medium
CN108513656A (en) Control method, USB system and electronic device
CN107423242A (en) SD interface and the electronic installation and method of USB interface multiplexing
CN107451067A (en) Download test processing methods and related products
EP3413205A1 (en) Re-enumeration of usb 3.0 compatible devices
CN105068952A (en) SD interface multiplexing apparatus and method and electronic device
CN104932615A (en) Universal serial bus expansion seat and method for charging portable device by using same
CN119226055A (en) Data interface detection method, device, system, program product and electronic equipment
Bachalkar et al. Data transfer between two pendrives without PC

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
PP01 Preservation of patent right
PP01 Preservation of patent right

Effective date of registration: 20251205

Granted publication date: 20200714