CN107003974B - Interface detection method and device - Google Patents

Interface detection method and device Download PDF

Info

Publication number
CN107003974B
CN107003974B CN201680002678.0A CN201680002678A CN107003974B CN 107003974 B CN107003974 B CN 107003974B CN 201680002678 A CN201680002678 A CN 201680002678A CN 107003974 B CN107003974 B CN 107003974B
Authority
CN
China
Prior art keywords
interface
expansion
equipment
bus
expansion 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.)
Active
Application number
CN201680002678.0A
Other languages
Chinese (zh)
Other versions
CN107003974A (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.)
Cloudminds Beijing Technologies Co Ltd
Original Assignee
Cloudminds Beijing Technologies 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 Cloudminds Beijing Technologies Co Ltd filed Critical Cloudminds Beijing Technologies 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

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/10Program control for peripheral devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/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

Abstract

An interface detection method and device, the method comprising: detecting an interface pin (101) of a terminal; if the interface pin for insertion detection is the first level, determining that the expansion interface of the terminal has the insertion of the expansion equipment; an interface chip of the expansion device is hung on a bus (102); the expansion equipment is powered on and initialized, and the equipment information of the expansion equipment is read through a bus; the device information comprises a device ID (103); determining a device type of the extension device from the device ID (104). The method hangs the inserted expansion equipment on the bus, reads the equipment type of the expansion equipment through the bus when the interface pin for insertion detection is at the first level, is suitable for various types of interface detection, and has strong expansibility.

Description

Interface detection method and device
Technical Field
The present invention relates to the field of terminal technologies, and in particular, to a method and an apparatus for detecting an interface.
Background
The cloud robot is an intelligent robot which is formed by placing a cognitive system in the cloud, placing a body, a drive and a sensor on a robot body and connecting the body, the drive and the sensor through mobile communication; the cloud robot is the development direction of the intelligent humanoid robot.
With the continuous development of terminal technology, terminal products are becoming more and more diversified, for example: smart phones, computers, pads, etc. Currently, a terminal mostly includes one or more interfaces, and USB, an earphone, or a data line is inserted into the corresponding interfaces to establish a connection with the terminal to implement corresponding functions.
In the prior art, a USB interface can only be plugged into a USB device, an earphone interface can only be plugged into an earphone device, and the like, when the USB device is plugged into the USB interface and the earphone device is plugged into the earphone interface, a terminal usually notifies a system in a hardware interrupt manner, and determines whether the interface is plugged into the device according to a voltage of a pin of the corresponding interface.
The prior art is not enough:
by means of voltage level detection device types, only a very small number of simple devices can be supported, since voltage classification is difficult to control, for example: USB, earphone, etc., and the expansibility is not strong.
Disclosure of Invention
The embodiment of the invention provides an interface detection method and device, which are used for solving the technical problems that in the prior art, the voltage classification is difficult to control, only a few simple devices can be supported and the expansibility is not strong in a mode of detecting the device type through the voltage level.
In one aspect, an embodiment of the present invention provides an interface detection method, including the following steps:
detecting an interface pin of a terminal;
if the interface pin for insertion detection is the first level, determining that the interface of the terminal has the insertion of the expansion equipment; an interface chip of the expansion equipment is hung on a bus;
the expansion equipment is powered on and initialized, and the equipment information of the expansion equipment is read through a bus; the device information includes a device Identification (ID);
and determining the equipment type of the expansion equipment according to the equipment ID.
In another aspect, an embodiment of the present invention provides an interface detection apparatus, including:
the detection module is used for detecting an interface pin of the terminal;
the first determining module is used for determining that the interface of the terminal has the insertion of the expansion equipment if the interface pin for insertion detection is a first level;
the hanging module is used for hanging the interface chip of the expansion equipment on a bus;
the reading module is used for carrying out power-on initialization on the expansion equipment and reading the equipment information of the expansion equipment through a bus; the device information includes a device ID;
and the second determining module is used for determining the equipment type of the expansion equipment according to the equipment ID.
The beneficial effects are as follows:
according to the technical scheme provided by the embodiment of the invention, the interface of the terminal is determined to have the insertion of the expansion equipment when the interface pin for insertion detection is the first level through detecting the interface pin of the terminal, the expansion equipment is hung on a bus, and the equipment type of the expansion equipment can be obtained through reading the bus after the expansion equipment is electrified and initialized.
Drawings
Specific embodiments of the present invention will now be described with reference to the accompanying drawings, in which:
FIG. 1 is a schematic flow chart illustrating an implementation of an interface detection method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating an interface detection process according to an embodiment of the present invention;
FIG. 3 is a first schematic structural diagram of an interface detection apparatus according to an embodiment of the present invention;
FIG. 4 is a second schematic structural diagram of an interface detection apparatus according to an embodiment of the present invention;
FIG. 5 is a third schematic structural diagram of an interface detection apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a mobile phone inserted into an expansion device in the embodiment of the present invention;
fig. 7 shows a schematic structural diagram of pad plugging expansion equipment in an embodiment of the present invention.
Detailed Description
In order to make the technical solutions and advantages of the present invention more apparent, the following further detailed description of exemplary embodiments of the present invention is provided with reference to the accompanying drawings, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and are not exhaustive of all embodiments. And the embodiments and features of the embodiments in the present description may be combined with each other without conflict.
The inventor notices in the process of invention that:
in the prior art, terminals such as a mobile phone and a computer can only inform a system in a hardware interrupt mode, and then the system detects the specific type of equipment through switching and judging the hardware state. When the interruption is detected, the pin voltage of a standard interface on the mobile phone or the computer is obtained, and whether the standard interface is inserted into the equipment corresponding to the interface is determined according to the comparison of the pin voltage and the preset voltage.
The system detects through a mode of high and low voltage, only the type of the equipment can be simply detected, and information such as specific version, manufacturer and the like of the equipment cannot be obtained; furthermore, existing device detection can only support a very small number of simple devices, such as: standard interface devices such as USB and UART, which generally have only few pins (e.g. 3 pins) and can only determine whether to insert a corresponding device by obtaining the voltage of the pin and according to the value of the voltage (e.g. VBUS reaching 5v indicates that USB is inserted, etc.), have limited usage scenarios and low expandability, and cannot be applied to complex interface devices with complex functions (e.g. 68 pins).
In view of the above disadvantages, embodiments of the present invention provide an interface detection method and apparatus, which load a corresponding driver and start a corresponding service and application by presetting a device ID and reading the type of an extension device by using a bus technology, so that a terminal can detect an interface state without interruption, and the method and apparatus are applicable to a complex interface device with complex functions, and have a very strong extensibility and a wide application.
For the convenience of implementing the present application, the following describes an interface detection method and apparatus proposed in the present application with reference to specific embodiments.
The first embodiment,
Fig. 1 shows a schematic flowchart of an implementation of an interface detection method according to an embodiment of the present invention, where as shown in the figure, the interface detection method may include the following steps:
step 101, detecting an interface pin of a terminal;
step 102, if the interface pin for insertion detection is a first level, determining that an interface of the terminal has an expansion device inserted; an interface chip of the expansion equipment is hung on a bus;
103, performing power-on initialization on the expansion equipment, and reading equipment information of the expansion equipment through a bus; the device information includes a device Identification (ID);
and step 104, determining the device type of the expansion device according to the device ID.
In specific implementation, if the expansion device is installed under the condition that the terminal is powered off, the embodiment of the invention can detect the interface pin of the terminal after the terminal is powered on; if the expansion device is plug-and-play, the embodiment of the invention can detect the interface pin of the terminal through interruption.
The interface pins of the terminal may be many, and may include interface pins for insertion detection, for example, P L UG DET UP and P L UG DET Down, and it may be determined that the interface of the terminal has the extension device inserted if the interface pins for insertion detection are at a first level when detecting, for example, detecting the interface pins to the terminal, and it may be determined that the interface of the terminal has the extension device inserted if both of P L UG DET UP and P L UG DET Down are at a low level.
After the expansion device is inserted into the interface of the terminal, the interface chip of the expansion device is hung on the bus, and the system of the terminal can read the device information of the expansion device through the bus. The Bus (Bus) is a public communication trunk line for transmitting information among various functional components of the computer, each component of the system in the embodiment of the invention can be connected through the Bus, the external expansion equipment can be connected with the Bus through a corresponding interface chip, a plurality of expansion equipment can be connected to one Bus, and the expansion equipment can respectively transmit equipment information to the system of the terminal.
The device information of the expansion device may include a device type, and the device type of the expansion device may be obtained by reading the device information of the expansion device in a bus form in the embodiment of the present invention. The device type is a device classification, one type of expansion device may have a plurality of different devices, and the device ID is an ID uniquely identifying the expansion device. For example: there are many expansion devices of this type, and an ID a01 is a specific device of the power bank.
The embodiment of the invention is characterized in that the expansion equipment is inserted into the terminal and then is hung on the bus, the terminal determines whether the expansion equipment is inserted or not by detecting the interface pins, the equipment type of the expansion equipment can be read through the bus after the expansion equipment is determined to be inserted, and the insertion and detection of various types of expansion equipment can be realized through one interface; in addition, one interface of the terminal in the prior art can only be connected with one standard interface device, but the embodiment of the invention adopts a bus form, can support the insertion of a plurality of extension devices at the same time, has stronger expansibility, and solves the problems that the device type is detected in a voltage high-low mode, only the standard interface device can be detected, and the like in the prior art.
In practice, the method may further comprise:
loading a device driver and starting a corresponding service program and an application program according to the device type of the extension device;
sending a program required by starting of the expansion equipment to the expansion equipment;
and after the expansion equipment is started, synchronizing the execution state of the expansion equipment with the execution state of the expansion equipment.
In specific implementation, if it is determined that the interface of the terminal has the extension device inserted, the detection (probe) of the extension device may be specifically: and carrying out power-on initialization operation on the expansion equipment, and then reading the equipment information of the expansion equipment through a bus. The device information may include a device type, and load a corresponding driver according to the device type of the extension device, and start a corresponding service and application.
In any case, in the specific implementation, the CPU of the terminal needs to start programs such as related drivers and services, and some expansion devices need the CPU of the terminal to send related programs to the expansion device. The specific starting process may be: initializing an interface bus, sending a related program to the expansion equipment, starting the expansion equipment, synchronizing the state of the HOST end of the terminal and the state of the two ends of the expansion equipment, and entering a normal working mode. The state synchronization at the two ends may be to read the state of the expansion device after the connection is established, the state of the expansion device may include the state of the expansion device when the expansion device is powered off last time, and the terminal may control the expansion device to be powered on/off.
The program required by starting the expansion device and sent to the expansion device can be stored in advance for the terminal, or can be downloaded from the cloud end for the terminal and then transmitted to the expansion device.
The device type of the extension device may be a computer cat (common name of modem) or an application device, and the application device may be specifically a charger, a heart rate meter, a projector, and the like.
The embodiment of the invention can load the drive and start the corresponding service and application after determining the equipment type of the expansion equipment, and can complete state synchronization through the bus to realize normal use of the expansion equipment.
In practice, the method may further comprise:
monitoring the working state of the expansion equipment;
and maintaining the expansion equipment according to the working state.
In specific implementation, after the initialization normal operation is completed, the operating state of the extension device may be dynamically changed, for example: busy → idle → suspend → sleep standby → close down, etc., and there is a possibility that an abnormal situation may occur.
The embodiment of the invention can monitor the working state of the extension equipment and maintain the state of the extension equipment through corresponding service programs, such as: the method comprises the steps of notifying a terminal CPU when the expansion equipment is normally inserted or not inserted, popping up prompt information when abnormal insertion occurs, or carrying out state updating and maintenance in the operation process, so as to ensure the normal use of the expansion equipment.
In an implementation, the bus may be a serial bus I2C bus, and the interface chip of the expansion device is attached to the bus, and may be an I2C interface chip of the expansion device is attached to the I2C bus.
In specific implementation, the bus may be an I2C bus or other bus, an I2C interface chip in the expansion device is hung on the I2C bus after the expansion device is inserted into an interface of the terminal, the interface chip of the expansion device may establish contact with a system of the terminal through the I2C bus, and the system of the terminal may read device information of the expansion device through the I2C bus.
The reading and writing of the I2C bus typically has a fixed format, and the general order may be: address (read/write) → register address → data, and this order may be adopted by the embodiment of the present invention to finally acquire the device information of the expansion device, and in specific implementation, a group of addresses (for example, 2, 4, or 8) may be preset by the embodiment of the present invention as addresses of the expansion device.
The implementation of the I2C bus is performed by taking the I2C bus as an example, because these methods are relatively common and mainstream and are easy to use/understand by those skilled in the art; however, in theory, other manners are also possible, as long as the purpose of hanging external expansion equipment can be achieved, and the I2C bus is only used for teaching the person skilled in the art how to implement the invention specifically, but does not mean that only the I2C bus can be used, and the implementation process can be determined according to practical needs.
In an implementation, the device information may further include: manufacturer information and/or device version.
In specific implementation, the device information may further include manufacturer information, device version, and other information.
In the prior art, the type of the device can only be simply detected by detecting the voltage level, and information such as a specific version and a manufacturer of the device cannot be obtained.
In implementation, the interface of the terminal may be a composite interface of 68 pins.
In specific implementation, the interface of the terminal in the embodiment of the present invention may be a composite interface, and specifically may be a composite interface with 68 pins or other number of pins.
Because the embodiment of the invention adopts the composite interface, the interface can support various types of expansion equipment, while the terminal in the prior art can only support equipment with a standard interface, and the embodiment of the invention has stronger expansibility.
Example II,
The embodiments of the present invention are described with reference to a specific example.
Fig. 2 is a schematic diagram illustrating an interface detection process in an embodiment of the present invention, where as shown in the figure, the interface detection process may include the following steps:
step 201, detecting Plug _ DET _ UP and Plug _ DET _ Down of interface pins;
step 202, judging whether the two pins are both low level;
if yes, go to step 203;
if not, go to step 207;
step 203, determining the insertion of the expansion equipment;
step 204, starting expanded equipment detection;
step 205, acquiring the device ID through I2C;
step 206, reporting the type of the extended device, and ending;
step 207, judging whether the two pins are both high level;
if yes, determining that no expansion equipment is inserted, and ending;
if not, prompting the expansion equipment to insert the connection problem, and ending.
In a specific implementation, the device type may be determined according to the device ID, for example: assuming that the device ID of the expansion device is a0123, the device type of the expansion device may be a.
The embodiment of the invention can detect pins Plug _ DET _ UP and Plug _ DET _ Down of the interface for insertion detection, if the two pins are both low level, the insertion of the expansion equipment can be determined, and then the equipment detection is carried out, the equipment ID is acquired through the I2C bus, the equipment type is reported and other operations are carried out; if the two pins are both high level, it indicates that no expansion device is inserted; if one pin is in high level and the other pin is in low level, the problem of the insertion of the expansion equipment and the abnormal connection are shown, the user can be prompted to insert the connection problem, and the detection operation is carried out again after the user reinserts the connection problem.
Example III,
Based on the same inventive concept, the embodiment of the present invention further provides an interface detection apparatus, and since the principle of solving the problem of these devices is similar to that of an interface detection method, the implementation of these devices may refer to the implementation of the method, and the repeated parts are not described again.
Fig. 3 is a schematic structural diagram of an interface detection apparatus according to an embodiment of the present invention, as shown in the drawing, the interface detection apparatus may include:
a detection module 301, configured to detect an interface pin of a terminal;
a first determining module 302, configured to determine that an interface of the terminal has an expansion device inserted therein if the interface pin for insertion detection is at a first level;
a hanging module 303, configured to hang an interface chip of the expansion device on a bus;
a reading module 304, configured to perform power-on initialization on the expansion device, and read device information of the expansion device through a bus; the device information includes a device Identification (ID);
a second determining module 305, configured to determine the device type of the extension device according to the device ID.
In specific implementation, the detection module may detect the interface pin of the terminal after the terminal is powered on, or may detect the interface pin of the terminal in an interrupt manner at regular time or at irregular time.
The first level may be a low level or a high level, the first determining module may be specifically configured to determine that the interface of the terminal has the insertion of the expansion device if the interface pin for insertion detection is a low level, the interface pins of the terminal may be many and may include interface pins for insertion detection, such as P L UG _ DET _ UP and P L UG _ DET _ Down, and the first determining module may be specifically configured to determine that the interface of the terminal has the insertion of the expansion device if the interface pins P L UG _ DET _ UP and P L UG _ DET _ Down are both low levels.
The hooking module can be specifically used for hooking an interface chip of the expansion equipment to a bus after the expansion equipment is inserted into an interface of the terminal, a plurality of expansion equipment can be connected to one bus, the hooking module can be used for respectively hooking the interface chips of the plurality of expansion equipment to the bus, and the expansion equipment can directly transmit data with a system of the terminal.
In the embodiment of the invention, after the extension equipment is inserted into a terminal interface, the hooking module hooks the extension equipment to a bus, the detection module can determine whether the extension equipment is inserted or not by detecting a pin of the terminal interface, and the reading module can read the equipment type of the extension equipment through the bus after the extension equipment is determined to be inserted; in addition, one interface of the terminal in the prior art can only be connected with one standard interface device, but the embodiment of the invention adopts a bus form, can support the insertion of a plurality of extension devices at the same time, has stronger expansibility, and solves the problems that the device type is detected in a voltage high-low mode, only the standard interface device can be detected, and the like in the prior art.
Fig. 4 shows a schematic structural diagram of an interface detection apparatus according to an embodiment of the present invention, as shown in the drawing, the apparatus may further include:
a starting 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;
a sending module 307, configured to send a program required for starting the expansion device to the expansion device;
a synchronization module 308, configured to perform state synchronization with the extension device after the extension device is started.
In specific implementation, the sending module may be specifically configured to send a pre-stored program required for starting the expansion device to the expansion device, and may also be configured to download the program required for starting the expansion device from a cloud and send the program required for starting the expansion device to the expansion device after the download is successful.
In the embodiment of the invention, after the device type of the expansion device is determined, the starting module loads the driver and starts the corresponding service and application, and after the sending module sends the program required by the starting of the expansion device to the expansion device, the synchronization module can complete state synchronization through the bus, thereby realizing the normal use of the expansion device.
Fig. 5 shows a schematic structural diagram three of an interface detection apparatus in an embodiment of the present invention, as shown in the drawing, the apparatus may further include:
a monitoring module 309, configured to monitor a working state of the expansion device;
a maintenance module 310, configured to perform maintenance on the expansion device according to the working state.
In a specific implementation, the monitoring module may be specifically configured to monitor a working state of the extension device, where the working state of the extension device may specifically include busy, idle, suspend, sleep standby, shutdown, and the like, and an abnormal condition may also occur.
In the embodiment of the present invention, the monitoring module may monitor the operating state of the extension device through a corresponding service program, and the maintenance module is configured to maintain the state of the extension device, for example: the method comprises the steps of notifying a terminal CPU when the expansion equipment is normally inserted or not inserted, popping up prompt information when abnormal insertion occurs, or carrying out state updating and maintenance in the operation process, so as to ensure the normal use of the expansion equipment.
In an implementation, the bus may be a serial bus I2C bus, and the hooking module may be configured to hook an I2C interface chip of the expansion device to an I2C bus.
In specific implementation, the bus may be an I2C bus or other buses, the hooking module may hook an I2C interface chip in the expansion device to the I2C bus after the expansion device is inserted into the interface of the terminal, the interface chip of the expansion device may establish contact with a system of the terminal through the I2C bus, and the reading module may read the device information of the expansion device through the I2C bus.
In an implementation, the device information read by the reading module may further include: manufacturer information and/or device version.
In specific implementation, the device information may further include manufacturer information, device version, and other information. The reading module may be specifically configured to read information such as manufacturer information, device version, and device ID of the expansion device.
In implementation, the interface of the terminal may be a composite interface of 68 pins.
In specific implementation, the interface of the terminal in the embodiment of the present invention may be a composite interface, and specifically may be a composite interface with 68 pins or other number of pins.
Because the embodiment of the invention adopts the composite interface, the interface can support various types of expansion equipment, while the terminal in the prior art can only support equipment with a standard interface, and the embodiment of the invention has stronger expansibility.
For convenience of description, each part of the above-described apparatus is separately described as being functionally divided into various modules or units. Of course, the functionality of the various modules or units may be implemented in the same one or more pieces of software or hardware in practicing the invention.
Example four,
Fig. 6 is a schematic structural diagram illustrating a mobile phone inserted into an expansion device in an embodiment of the present invention, and as shown in the drawing, the embodiment of the present invention takes a mobile phone as an example for description as follows.
The mobile phone in the embodiment of the invention is provided with an expansion interface for inserting expansion equipment. In specific implementation, the expansion interface on the mobile phone may be a male port and/or a female port, the expansion device to be inserted may include both the male port and the female port, and the male port and the female port of the expansion device may be respectively disposed at outer sides of two opposite surfaces of the expansion device.
Assuming that an expansion interface on the mobile phone is a male port, the expansion device is a music player and a projector, a female port is arranged on the outer side of one plane of the music player, a male port is arranged on the outer side of the other opposite surface, a female port is arranged on the outer side of one plane of the projector, and a male port is arranged on the outer side of the other opposite surface of the projector.
The female port of the music player is in butt joint with the male port of the mobile phone, and the female port of the projector is in butt joint with the male port of the music player, so that two external expansion devices can be superposed on the back of the mobile phone. After the external expansion device is inserted into the mobile phone, all the external expansion devices can be directly hung on the bus in a bus mode in the embodiment of the invention and can respectively directly transmit data with the mobile phone.
The mobile phone can detect a male pin of the mobile phone, if the P L UG _ DET _ UP and P L UG _ DET _ Down of the male pin of the mobile phone are both low level, it indicates that an expansion device is inserted into an expansion interface of the mobile phone, then the mobile phone can send a request for obtaining device information to a corresponding address of a bus, the music player responds to the request, and responds to a message that the message can carry information of own device ID (if the message is YYBFQ01), a device version number, a manufacturer and the like, and after the mobile phone obtains the device ID of the expansion device, the mobile phone can determine that the expansion device is the music player.
The mobile phone can also continuously detect the male port of the music player, if the pins P L UG _ DET _ UP and P L UG _ DET _ Down of the male port of the music player are both low level, it is indicated that an expansion device is inserted into the expansion interface of the music player, then the mobile phone can send a request for obtaining device information to a corresponding address of a bus, the projector responds to the request, a response message can carry information such as own device ID (supposing TYY01), device version number and manufacturer, and after the mobile phone obtains the device ID of the expansion device, the expansion device can be determined to be the projector.
After determining that the extension devices are respectively a music player and a projector, the embodiment of the invention can respectively load device drivers for the music player and the projector and start corresponding service programs and application programs:
after loading a music player drive and starting a corresponding service program and an application program of the music player, sending a program required by starting the music player to the music player, and after the music player is successfully started, synchronizing the completion states of the mobile phone and the music player;
and after loading a projector drive and starting a corresponding service program and an application program of the projector, sending a program required by starting the projector to the projector, and after the projector is successfully started, synchronizing the states of the mobile phone and the projector.
Therefore, the music player and the projector of the mobile phone and the external expansion equipment can enter a normal working mode, and a user can play a slide while opening the mp3 through the mobile phone.
Example V,
The following embodiments of the present invention take an intelligent robot as an example of a terminal.
The intelligent robot in the embodiment of the invention is provided with an expansion interface for inserting expansion equipment, and the expansion equipment can be a charger and the like.
In specific implementation, the expansion interface on the intelligent robot can be a male port, and the interface on the power bank can be a female port; or the expansion interface on the intelligent robot may be a female port, and the interface on the power bank may be a male port; and or, the expansion interface on the intelligent robot comprises a male port and a female port, and the interface on the charger baby is the male port or the female port, or comprises the male port and the female port.
When the interface of the charger baby is in butt joint with the expansion interface of the intelligent robot, the charger baby is directly hung on the I2C bus and can directly transmit data with the intelligent robot.
The intelligent robot can detect pins of an expansion interface of the intelligent robot, if the pins P L UG _ DET _ UP and P L UG _ DET _ Down of the pins of the expansion interface of the intelligent robot are both low level, it is indicated that expansion equipment is inserted into the expansion interface of the intelligent robot, then the intelligent robot can send a request for obtaining equipment information to a corresponding address of a bus, the charger responds to the request, a response message can carry information such as self equipment ID (assumed to be CDB092), equipment version number and manufacturer, and after the intelligent robot obtains the equipment ID of the expansion equipment, the intelligent robot can determine that the expansion equipment is the charger (abbreviated as CDB).
After the expansion device is determined to be the charger, the intelligent robot can download a charger driver, a service program and an application program required by the start of the charger and the like from a cloud end, then load the charger driver and start the corresponding service program and application program for the charger, send the program required by the start of the charger to the charger, and after the charger is started successfully, the intelligent robot reads the state of the charger and completes state synchronization.
Therefore, intelligent robot and treasured that charges can get into normal operating mode when intelligent robot carries out user instruction, the treasured that charges can do intelligent robot charges to ensure intelligent robot's normal use.
Example six,
Fig. 7 is a schematic structural diagram of a pad plugging expansion device in an embodiment of the present invention, and as shown in the drawing, a tablet computer (pad) is taken as an example for description in the following embodiment of the present invention.
The pad in the embodiment of the invention is provided with an expansion interface, and can be used for inserting expansion equipment, wherein the expansion equipment can be a flat keyboard, a telephone conference loudspeaker, a printer and the like.
In 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 the male port and the female port.
Assuming that the expansion interface on the pad is a male port, after the female port of the tablet keyboard is plugged with the male port of the pad, the interface chip of the tablet keyboard is hung on the I2C bus, and can directly transmit information with the system of the pad.
The pad can detect a pin of an expansion interface, if the pins P L UG _ DET _ UP and P L UG _ DET _ Down of the expansion interface of the pad are both low level, it is indicated that an expansion device is inserted into the expansion interface of the pad, then the pad can send a request for obtaining device information to a corresponding address of a bus, the flat keyboard responds to the request and responds to information that a message can carry a device ID (assumed to be PBJP008), a device version number, a manufacturer and the like, and after the pad obtains the device ID of the expansion device, the expansion device can be determined to be the flat keyboard (abbreviated as PBJP).
The pad may store a service program and an application program required for starting the tablet keyboard in a pad storage space in advance, and after determining that the extension device is the tablet keyboard, the pad may load a keyboard driver and start the corresponding service program and application program for the tablet keyboard, send the program required for starting the keyboard to the tablet keyboard, and after the tablet keyboard is successfully started, the pad reads the state of the tablet keyboard to complete state synchronization.
Therefore, the pad and the flat keyboard can enter a normal working mode, and a user can realize input operation through the flat keyboard while using the pad.
When a user needs to perform a teleconference, in order to enable other people nearby to participate in the teleconference and listen to the content of the teleconference, the user can plug a teleconference speaker (corresponding to the female port of the teleconference speaker) into the male port of the tablet keyboard, and an interface chip of the teleconference speaker is also hung on the I2C bus and can directly transmit information with the system of the pad.
The pad can detect a pin of the male port of the flat keyboard, if both P L UG _ DET _ UP and P L UG _ DET _ Down of the pin of the male port are low level, it indicates that an extension device is inserted, then the pad can send a request for obtaining device information to a corresponding address of a bus, the teleconference speaker responds to the request, a self device ID (assumed to be DHHYYSQ011), a device version number, a manufacturer and other information can be carried in a response message, and after the pad obtains the device ID of the extension device, the extension device can be determined to be the teleconference speaker (abbreviated as DHHYYSQ).
The method includes that a pad can store service programs and application programs and the like required by starting a conference call loudspeaker in a pad storage space in advance, after the fact that an extension device is the conference call loudspeaker is determined, the pad can load a loudspeaker driver for the conference call loudspeaker, start corresponding service programs and application programs, send the programs required by starting the loudspeaker to the conference call loudspeaker, and after the conference call loudspeaker is started successfully, the pad reads the state of the conference call loudspeaker to complete state synchronization.
Therefore, the pad and the conference call loudspeaker can enter a normal working mode, and a user can use the pad and simultaneously improve the volume of a conference call through the conference call loudspeaker.
When a user needs to print a document for reading by people in a conference, a printer (corresponding to a female port of the printer) can be plugged in a male port of a conference call loudspeaker, an interface chip of the printer is also hung on an I2C bus, and information can be directly transmitted with a system of a pad.
The pad can detect a pin of the public port of the conference call speaker, if P L UG _ DET _ UP and P L UG _ DET _ Down of the pin of the public port are both low level, it indicates that an extended device is inserted, then the pad can send a request for obtaining device information to a corresponding address of a bus, the printer responds to the request and can carry information of own device ID (supposing DYJ080), device version number, manufacturer and the like in a response message, and after the pad obtains the device ID of the extended device, the extended device can be determined to be a printer (abbreviated as DYJ).
After determining that the extension device is a printer, the pad may download a service program, an application program and the like required for starting the printer from a network, load a printer driver for the printer, start the corresponding service program and application program, send the program required for starting the printer to the printer, and after the printer is successfully started, the pad reads the state of the printer to complete state synchronization.
Therefore, the pad and the printer can enter a normal working mode, and a user can use the pad and realize a document printing function through the printer.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may 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, and the like) 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 will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.

Claims (10)

1. An interface detection method is characterized by comprising the following steps:
detecting an interface pin of a terminal; the interface of the terminal is a composite interface supporting different types of expansion equipment;
if the interface pin for insertion detection is the first level, determining that the interface of the terminal has the insertion of the expansion equipment; an interface chip of the expansion equipment is hung on a bus;
the expansion equipment is powered on and initialized, and the equipment information of the expansion equipment is read through a bus; the device information includes a device Identification (ID);
determining the equipment type of the expansion equipment according to the equipment ID;
further comprising:
loading a device driver and starting a corresponding service program and an application program according to the device type of the extension device;
sending a program required by starting of the expansion equipment to the expansion equipment;
and after the expansion equipment is started, synchronizing the execution state of the expansion equipment with the execution state of the expansion equipment.
2. The method of claim 1, further comprising:
monitoring the working state of the expansion equipment;
and maintaining the expansion equipment according to the working state.
3. The method of claim 1, wherein the bus is a serial bus I2C bus, and wherein the interface chip of the expansion device is hung onto the bus, and wherein the I2C interface chip of the expansion device is hung onto the I2C bus.
4. The method of claim 1, wherein the device information further comprises manufacturer information and/or a device version.
5. The method of claim 1, wherein the interface of the terminal is a composite interface of 68 pins.
6. An interface detection apparatus, comprising:
the detection module is used for detecting an interface pin of the terminal; the interface of the terminal is a composite interface supporting different types of expansion equipment;
the first determining module is used for determining that the interface of the terminal has the insertion of the expansion equipment if the interface pin for insertion detection is a first level;
the hanging module is used for hanging the interface chip of the expansion equipment on a bus;
the reading module is used for carrying out power-on initialization on the expansion equipment and reading the equipment information of the expansion equipment through a bus; the device information includes a device Identification (ID);
a second determining module, configured to determine a device type of the extension device according to the device ID;
further comprising:
the starting module is used for loading the equipment drive and starting the corresponding service program and application program according to the equipment type of the expansion equipment;
a sending module, configured to send a program required for starting the expansion device to the expansion device;
and the synchronization module is used for synchronizing the execution state of the expansion equipment after the expansion equipment is started.
7. The apparatus of claim 6, further comprising:
the monitoring module is used for monitoring the working state of the expansion equipment;
and the maintenance module is used for maintaining the expansion equipment according to the working state.
8. The apparatus of claim 6, wherein the bus is specifically a serial bus I2C bus, and the hooking module is specifically configured to hook an I2C interface chip of the expansion device to an I2C bus.
9. The apparatus of claim 6, wherein the device information further comprises manufacturer information and/or a device version.
10. The apparatus of claim 6, wherein the interface of the terminal is a composite interface of 68 pins.
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 CN107003974A (en) 2017-08-01
CN107003974B true 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)

Families Citing this family (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
CN109164874B (en) * 2018-08-03 2021-09-14 联想(北京)有限公司 Information processing method and electronic equipment
CN109270342B (en) * 2018-11-13 2024-03-26 江苏斯菲尔电气股份有限公司 Multifunctional ammeter with function expansion module self-identification technology
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
CN111897760A (en) * 2020-07-30 2020-11-06 普联技术有限公司 Electronic product, expansion device thereof, control method and control device

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

Also Published As

Publication number Publication date
CN107003974A (en) 2017-08-01
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
AU2015271399B2 (en) Super hub system and method thereof
US9747237B2 (en) Methods and apparatus for reliable detection and enumeration of devices
TW201606518A (en) Port disconnect charging function for USB hub
CN103645975B (en) A kind of method of abnormal restoring and serial bus transmission device
CN109478176B (en) Method, device and system for identifying opposite terminal equipment by USB Type-C port equipment
US10733115B2 (en) Information handling system automated wireless pairing of peripheral devices
US10042800B2 (en) Active USB device and switching method for operating mode thereof
CN112799985B (en) USB interface control method, USB control circuit and intelligent networking equipment mainboard
US20210048850A1 (en) Firmware setup menu options for docking stations
CN102073602B (en) Computer system, connection control device as well as connecting and disconnecting method
CN112310756A (en) Electronic device for preventing USB device from being damaged and operation method thereof
CN110970970A (en) Processing method and device of terminal charger
KR101504654B1 (en) Method for Establishing Connection Between External Device and Mobile Terminal Docking Thereat
CN106774769B (en) Terminal working mode switching method and device and handheld terminal
EP1965307B1 (en) Adapter apparatus and data transmission system
CN104850512B (en) No ID pin does the method and device of USB OTG function
WO2015154690A1 (en) Charging socket and mobile terminal processing method based on charging socket
US20180322768A1 (en) Wearable Electronic Device Alerts
CN107423242A (en) SD interface and the electronic installation and method of USB interface multiplexing
KR101485156B1 (en) Mobile terminal docking with external device and controlling method thereof
CN104932615A (en) Universal serial bus expansion seat and method for charging portable device by using same
CN214540750U (en) USB control circuit, intelligent networking equipment mainboard and electronic equipment
CN115913800A (en) Communication connection control method, vehicle-mounted device, communication system, and storage medium

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