CN112698875A - Hardware type identification method and device, computer equipment and storage medium - Google Patents

Hardware type identification method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112698875A
CN112698875A CN202110017993.3A CN202110017993A CN112698875A CN 112698875 A CN112698875 A CN 112698875A CN 202110017993 A CN202110017993 A CN 202110017993A CN 112698875 A CN112698875 A CN 112698875A
Authority
CN
China
Prior art keywords
state
output port
universal input
working
hardware type
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110017993.3A
Other languages
Chinese (zh)
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.)
Fibocom Wireless Inc
Original Assignee
Fibocom Wireless Inc
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 Fibocom Wireless Inc filed Critical Fibocom Wireless Inc
Priority to CN202110017993.3A priority Critical patent/CN112698875A/en
Publication of CN112698875A publication Critical patent/CN112698875A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4411Configuring for operating with peripheral devices; Loading of device drivers
    • 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
    • G06F13/102Program control for peripheral devices where the programme performs an interfacing function, e.g. device driver

Abstract

The application relates to a hardware type identification method, a hardware type identification device, computer equipment and a storage medium. The method comprises the following steps: setting a working mode of a universal input/output port, reading a level state of the universal input/output port in the working mode, and determining a working state of the universal input/output port according to the level state, wherein the working state comprises a high level state, a low level state and a suspended high-resistance state; obtaining a state identifier corresponding to the working state based on the working state, and determining the hardware type according to the state identifier; and loading and operating a driver corresponding to the hardware type according to the determined hardware type. By adopting the method, the driver corresponding to the hardware type can be loaded and operated based on the determined hardware type, so that one set of software is adaptive to a plurality of sets of hardware types.

Description

Hardware type identification method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for identifying a hardware type, a computer device, and a storage medium.
Background
With the development of communication technology, devices of the same model can support hardware designs of different mainboards, and for convenience of management, different hardware types can be driven by designing a set of software, wherein the software automatically loads and runs a driver related to the hardware types based on the identified hardware types.
At present, the schemes commonly used for hardware type identification include an analog-digital conversion interface and a general input/output port, however, when the hardware type identification is performed by using the analog-digital conversion interface and the general input/output port, because the resources of the analog-digital conversion interface and the general input/output port are limited by a hardware platform, the resources of the analog-digital conversion interface and the general input/output port can be generally used for hardware type identification, and the resources of the analog-digital conversion interface and the general input/output port cannot meet the situation that the hardware types are more.
Disclosure of Invention
In view of the above, it is necessary to provide a hardware type identification method, apparatus, computer device and storage medium capable of improving the utilization rate of the general purpose input/output port.
A hardware type identification method, the method comprising:
setting a working mode of a universal input/output port, reading a level state of the universal input/output port in the working mode, and determining a working state of the universal input/output port according to the level state, wherein the working state comprises a high level state, a low level state and a suspended high-resistance state;
obtaining a state identifier corresponding to the working state based on the working state, and determining the hardware type according to the state identifier;
and loading and operating a driver corresponding to the hardware type according to the determined hardware type.
In one embodiment, the determining the operating state of the gpio output port according to the level state of the gpio output port in the operating mode includes:
when the set working mode is internal resistance pull-up, if the read level state of the general input/output port is a low level, directly determining that the working state of the general input/output port is a low level state;
otherwise, resetting the working mode as internal resistance pull-down, and determining the current state of the universal input/output port based on the resistance pull-down mode;
in one embodiment, the determining the operating state of the gpio output port according to the level state of the gpio output port in the operating mode includes:
when the set working mode of the universal input/output port is internal resistance pull-down, if the read state of the universal input/output port is a high level, directly determining that the working state of the universal input/output port is a high level state;
otherwise, resetting the working mode as internal resistance pull-up, and determining the current state of the universal input/output port based on the internal resistance pull-up mode.
In one embodiment, resetting the operating mode to be an internal resistance pull-down mode, and determining the current state of the gpio based on the internal resistance pull-down mode includes:
when the working mode is reset to be internal resistance pull-down, if the read state of the universal input/output port is a high level, determining that the working state of the universal input/output port is a suspended high-resistance state;
if the read level state corresponding to the state identifier of the universal input/output port is a low level, determining that the working state of the universal input/output port is a high level state;
in one embodiment, resetting the operating mode to be an internal resistance pull-up mode, and determining the current state of the gpio based on the internal resistance pull-up mode includes:
when the working mode of the universal input/output port is reset to be internal resistance pull-up, if the read level state of the universal input/output port is a high level, determining that the working state of the universal input/output port is a high level state;
and if the read level state of the general input/output port is a low level state, determining that the working state of the general input/output port is a suspended high-resistance state.
In one embodiment, the determining a hardware type according to the status identifier includes:
acquiring a mapping relation between the state identifier and the hardware type;
and determining the hardware type based on the mapping relation.
In one embodiment, the obtaining the mapping relationship between the state identifier and the hardware type includes:
acquiring the number of the universal input/output ports;
and acquiring the mapping relation between the state identification and the hardware type based on the number of the universal input/output ports.
In one embodiment, the mapping relationship comprises a first mapping relationship and a second mapping relationship; the first mapping relation represents that the state identifier corresponds to the hardware type, and the second mapping relation represents that the combined state identifier corresponds to the hardware type after the state identifiers of the universal input/output ports are combined.
In one embodiment, the step of combining the status identifiers of the universal input/output ports includes:
and combining the state identifications according to the acquired sequence according to the acquired state identifications of the universal input/output ports to acquire the combined state identifications.
A hardware type identification apparatus, the apparatus comprising:
the working state determining module is used for setting a working mode of a universal input/output port, reading a level state of the universal input/output port in the working mode, and determining a working state of the universal input/output port according to the level state, wherein the working state comprises a high level state, a low level state and a suspended high-resistance state;
the hardware type determining module is used for obtaining a state identifier corresponding to the working state based on the working state and determining the hardware type according to the state identifier;
and the hardware driving module is used for loading and operating a driving program corresponding to the hardware type according to the determined hardware type.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the method of any one of claims 1 to 7 when executing the computer program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
According to the hardware type identification method, the hardware type identification device, the computer equipment and the storage medium, a working mode of a universal input/output port is set, a level state of the universal input/output port in the working mode is read, and the working state of the universal input/output port is determined according to the level state, wherein the working state comprises a high level state, a low level state and a suspended high-resistance state; obtaining a state identifier corresponding to the working state based on the working state, and determining the hardware type according to the state identifier; and loading and operating a driver corresponding to the hardware type according to the determined hardware type, wherein the level state of the universal input/output port in the working mode is read based on the set working mode of the universal input/output port, so that the working state of the universal input/output port can be determined, the hardware type is determined based on the state identifier corresponding to the working state, and the driver corresponding to the hardware type is loaded and operated, so that one set of software can be adapted to a plurality of sets of hardware types by the method.
Drawings
FIG. 1 is a flow diagram illustrating a method for hardware type identification in one embodiment;
FIG. 2 is a flowchart illustrating a hardware type identification method according to one embodiment;
FIG. 3 is a block diagram showing the structure of a hardware type identification device according to an embodiment;
FIG. 4 is a diagram illustrating an internal structure of a computer device according to an embodiment;
fig. 5 is an internal structural view of a computer device in another embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The hardware type identification method can be applied to the terminal. Setting a working mode of a universal input/output port, reading a level state of the universal input/output port in the working mode by a bootstrap program in a terminal, and determining a working state of the universal input/output port according to the level state, wherein the working state comprises a high level state, a low level state and a suspended high-resistance state; obtaining a state identifier corresponding to the working state based on the working state, and determining the hardware type according to the state identifier; and loading and operating a driver corresponding to the hardware type according to the determined hardware type. Optionally, the method may also be applied in a server. The terminal can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server can be implemented by an independent server or a server cluster formed by a plurality of servers.
In an embodiment, as shown in fig. 1, a hardware type identification method is provided, which is described by taking an example that the method is applied to a terminal, and includes the following steps:
102, setting a working mode of a general input/output port, reading a level state of the general input/output port in the working mode, and determining a working state of the general input/output port according to the level state, wherein the working state comprises a high level state, a low level state and a suspended high-resistance state.
The universal input/output port refers to a pin for data interaction between the controller and the external device. The working mode of the general purpose input/output port may be an input mode, and the input mode includes a floating input mode, an analog input mode, an internal resistance pull-up mode, an internal resistance pull-down mode, and the like, where the working mode of the general purpose input/output port may be set by a register, and when the working mode of the general purpose input/output port is set by the register as the input mode, reading the register may know whether the level state of the corresponding pin is a high level or a low level, and specifically, the level state of the general purpose input/output port in one of the working modes may be read by a BOOT program, for example, the BOOT program may be U-BOOT (embedded system BOOT loader), BIOS (basic input/output system BOOT program), and the like.
When the working mode of the general input/output port is set to be the output mode by the register, writing the corresponding bit of the register can enable the pin to output high level or low level. In the embodiment of the present application, only the pin status of the gpio needs to be read, so that the working mode of the gpio is set as the input mode.
The working state of the general input/output port can be determined according to the level state of the general input/output port in the corresponding working mode, and the working state of the general input/output port comprises a high level state, a low level state and a suspension high-resistance state, wherein the high level state refers to the state that the external hardware of the general input/output port is designed into the high level state, the low level state refers to the state that the external hardware of the general input/output port is designed into the low level state, and the suspension high-resistance state refers to the state that the external hardware of the general input/output port is designed into the.
And 204, obtaining a state identifier corresponding to the working state based on the working state, and determining the hardware type according to the state identifier.
Wherein, after confirming the operating condition of general IO, can be according to the state sign that operating condition corresponds, confirm the hardware type, wherein, the state sign that the operating condition of general IO corresponds can have multiple different settings, for example, can use letter mark general IO's operating condition, it is specific, when general IO's operating condition is high level state, then can set up the state sign that high level state corresponds and be A, when general IO's operating condition is low level state, then can set up the state sign that low level state corresponds and be B, when general IO's operating condition is unsettled high resistance state, then can set up the state sign that unsettled high resistance state corresponds and be C. Optionally, an arabic number may also be used to identify the operating state of the general input/output port, for example, specifically, when the operating state of the general input/output port is a high level state, the state identifier corresponding to the high level state may be set to 1, when the operating state of the general input/output port is a low level state, the state identifier corresponding to the low level state may be set to 2, and when the operating state of the general input/output port is a suspended high-resistance state, the state identifier corresponding to the suspended high-resistance state may be set to 3. In the following embodiments, a state flag corresponding to a high state is set to 1.
In one embodiment, two general input/output ports (general input/output port 1 and general input/output port 2) are used to form a general input/output port group, the working states of the general input/output port 1 and the general input/output port are read to obtain a state identifier corresponding to the working state, and the hardware type is determined based on the state identifier. For example, if the operating state of the general purpose input/output port 1 is determined to be the high level state, the corresponding state flag is 1, if the operating state of the general purpose input/output port 2 is determined to be the low level state, the corresponding state flag is 0, and the hardware type is determined based on the determined state flag 10.
And step 206, loading and operating a driver corresponding to the hardware type according to the determined hardware type.
After the hardware type is determined, the driver corresponding to the hardware type can be loaded and operated through the hardware type. For example, when the state identifier of the hardware is determined to be 00, the hardware type corresponding to the state identifier 00 may be determined.
In one embodiment, the mobile device of the same model can correspond to different frequency bands, domestic frequency bands, european frequency bands, ramen frequency bands and the like, wherein the frequency bands of different countries correspond to different hardware types, the hardware type of the domestic frequency band can be defined as 00, the hardware type of the domestic frequency band is 01, the hardware type of the domestic frequency band is 02, based on the defined hardware types, two universal input/output ports can be selected to form a universal input/output port group, by giving three working states of the universal input/output ports, a high level state, a low level state and a hanging high-resistance state, setting the state identifier of the high level state as 1, setting the state identifier of the low level state as 0, setting the state identifier of the hanging high-resistance state as 2, when the working state of one universal input/output port is determined to be the low level state and the working state of the other universal input/output port is determined to, then, according to the state identifier corresponding to the operating state, if the state identifier of the low level state is 0, and the state identifier corresponding to the high level state is 1, it may be determined that the hardware type corresponding to 01 is a domestic frequency band, and a driver for operating the hardware type of the domestic frequency band is loaded.
In the hardware type identification method, the level state of a general input/output port in the working mode is read by setting the working mode of the general input/output port, and the working state of the general input/output port is determined according to the level state, wherein the working state comprises a high level state, a low level state and a suspended high resistance state; obtaining a state identifier corresponding to the working state based on the working state, and determining the hardware type according to the state identifier; and loading and operating a driver corresponding to the hardware type according to the determined hardware type. Thus, different hardware designs can be driven by one set of software through the method.
In one embodiment, the determining the operating state of the gpio output port according to the level state of the gpio output port in the operating mode includes:
when the set working mode is internal resistance pull-up, if the read level state of the general input/output port is a low level, directly determining that the working state of the general input/output port is a low level state;
otherwise, resetting the working mode as internal resistance pull-down, and determining the current state of the universal input/output port based on the internal resistance pull-down mode;
in one embodiment, the determining the operating state of the gpio output port according to the level state of the gpio output port in the operating mode includes:
when the set working mode of the universal input/output port is internal resistance pull-down, if the read state of the universal input/output port is a high level, directly determining that the working state of the universal input/output port is a high level state;
otherwise, resetting the working mode as internal resistance pull-up, and determining the current state of the universal input/output port based on the internal resistance pull-up mode.
The working state of the general input/output port is determined by reading the level state of the general input/output port under the set working mode, specifically, the working mode of the general input/output port can be set to be pulled up by an internal resistor and can also be set to be pulled down by the internal resistor, when the working mode is set to be pulled up by the internal resistor, when the level state of the read general input/output port is low level, the general input/output port can read low level only when external hardware is set to be pulled down by the resistor, and at the moment, the working state of the general input/output port can be directly determined to be low level state. When the read level state of the general input/output port is a high level, the external hardware of the general input/output port may be the high level read by the external hardware in a pull-up mode, or may be the high level read by the external hardware in a suspended high-resistance state, when the high level is read, the working mode of the general input/output port is reset, and the current state of the general input/output port is determined based on the reset working mode. Similarly, the hardware design of the universal input/output port can also be judged based on the level state of the universal input/output port read in the resistance pull-down mode by setting the working mode of the universal input/output port as resistance pull-down. Therefore, the working state of the current universal input/output port can be determined by the method.
In one embodiment, resetting the operating mode to be an internal resistance pull-down mode, and determining the current state of the gpio based on the internal resistance pull-down mode includes:
when the working mode is reset to be internal pull-down, if the read state of the general input/output port is a high level, determining that the working state of the general input/output port is a suspended high-resistance state;
and if the read level state corresponding to the state identifier of the universal input/output port is a low level, determining that the working state of the universal input/output port is a high level state.
In one embodiment, resetting the operating mode to be an internal resistance pull-up mode, and determining the current state of the gpio based on the internal resistance pull-up mode includes:
when the working mode of the universal input/output port is reset to be internal resistance pull-up, if the read level state of the universal input/output port is a high level, determining that the working state of the universal input/output port is a high level state;
and when the read level state of the general input/output port is a low level state, determining that the working state of the general input/output port is a suspended high-resistance state.
When the working state of the universal input/output port which is set for the first time cannot be determined, the working mode of the universal input/output port is reset, and the working state of the universal input/output port is determined based on the reset working mode.
In one implementation, the determining a hardware type according to the status identifier includes:
acquiring a mapping relation between the state identifier and the hardware type;
and determining the hardware type based on the mapping relation.
After the state identifier is determined, the mapping relation between the state identifier and the hardware type can be obtained, and the hardware type is determined based on the mapping relation. For example, if the status flag is 00, based on the mapping relationship between the status flag and the hardware type, the hardware type corresponding to the status flag 00 may be determined. Thus, the hardware type can be directly determined based on the state identification through the method.
In one embodiment, the obtaining the mapping relationship between the state identifier and the hardware type includes:
acquiring the number of the universal input/output ports;
and determining and acquiring the mapping relation between the state identifier and the hardware type based on the number of the universal input/output ports.
When the mapping relation between the state identifier and the hardware type is obtained, the number of the universal input/output ports is judged; and acquiring the mapping relation between the state identification and the hardware type based on the number of the universal input/output ports.
In one embodiment, the mapping relationship comprises a first mapping relationship and a second mapping relationship; the first mapping relation represents that the state identifier corresponds to the hardware type, and the second mapping relation represents that the combined state identifier corresponds to the hardware type after the state identifiers of the universal input/output ports are combined.
The mapping relation represents the association relation between the hardware type and the state identifier. For example, when the number of the universal input/output ports is 1, the state identifier has a first mapping relation with the hardware type; and when the number of the universal input/output ports is greater than 1, the state identifier has a second mapping relation with the hardware type.
In one embodiment, the step of combining the status identifiers of the universal input/output ports includes:
and combining the state identifications according to the acquired sequence according to the acquired state identifications of the universal input/output ports to acquire the combined state identifications.
When a plurality of universal input/output ports exist, the sequence of reading the level states of the universal input/output ports in the working mode can be set, for example, the time sequence, and after the state identifier is determined, the state identifiers are combined according to the time sequence of obtaining the state identifier to obtain the combined state identifier. By the method, the mapping relation between the state identification and the hardware type can be orderly and accurately acquired.
In one embodiment, as shown in FIG. 2, a flowchart of a hardware type identification method in one embodiment is shown.
The method includes the steps of identifying the working state of a universal input/output port arranged on a mainboard based on a BOOT program in a terminal, wherein the BOOT program can be U-BOOT (embedded system BOOT loader), BIOS (basic input/output system BOOT program) and the like, for example, selecting the BOOT program as U-BOOT, and reading the level state of the universal input/output port based on the set working mode of the universal input/output port, wherein the working mode of the universal input/output port can be resistance pull-up input, resistance pull-down input and the like.
For example, the operation mode of the general purpose input/output port may be set as a resistance pull-up input, in the operation mode of the resistance pull-up input, the level state of the general purpose input/output port is read, and when the read level state of the general purpose input/output port is a low level, the general input output port can read the low level only when the external hardware is set to be in a resistance pull-down state, the working state of the general input output port can be directly determined to be in a low level state at the moment, when the read level state of the general input output port is in a high level state, the external hardware of the gpio port may be read high due to the external hardware pulling up, or may be read high due to the external hardware being in a floating high impedance state, and when the high level is read, resetting the working mode of the universal input/output port, and determining the current state of the universal input/output port based on the reset working mode.
Specifically, the working mode of the general input/output port may be reset to be a resistance pull-down input, and in the resistance pull-down input mode, the level state of the general input/output port is read, and if the level state of the general input/output port read at this time is a high level state, it is determined that the working state of the general input/output port is the high level state, and if the level state of the general input/output port read at this time is a low level state, it is determined that the working state of the general input/output port at this time is a suspended high-impedance state. The working mode of the universal input/output port can be adjusted according to actual conditions.
In one embodiment, the mobile devices of the same model may correspond to different frequency bands, domestic frequency bands, european frequency bands, and ramen frequency bands, and the different frequency bands may correspond to different hardware types, and 00 may be defined to correspond to the domestic frequency band, 01 to correspond to the european frequency band, and 02 to correspond to the ramen frequency band. Based on the defined mapping relation between the hardware type and the state identification, two universal input/output ports are used to form a universal input/output port group to identify the hardware type, wherein based on three working states of the universal input/output ports: high level state, low level state and suspended high impedance state, which can adopt 1 to represent high level state, 0 to represent low level state and 2 to represent suspended high impedance state, then 9 different state identifications can be formed: 00/01/02/10/11/12/20/21/22.
Based on the defined mapping relation between the hardware type and the state identification, the working state of the universal input/output port can be respectively in a high level state, a low level state and a high resistance state by an external pull-up resistor, an external pull-down resistor or a resistor in an NC (suspension) state, specifically, two universal input/output ports (universal input/output port 1 and universal input/output port 2) are selected to be combined to identify the hardware type, when the hardware type identification of the domestic frequency band is carried out, namely, the working state of the universal input/output port 1 is designed to be a low level state, the working state of the universal input/output port 2 is designed to be a low level state, after determining the operational status of the gpio 1 and gpio 2 based on the boot program, and determining the hardware type based on the state identifier corresponding to the working state, and loading a driver corresponding to the hardware type.
It should be understood that although the various steps in the flow charts of fig. 1-2 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 1-2 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps.
In one embodiment, as shown in fig. 3, there is provided a hardware type identification apparatus including: the device comprises a working state determining module of a universal input/output port, a hardware type determining module and a hardware driving module, wherein:
the working state determining module 302 is configured to set a working mode of a general input/output port, read a level state of the general input/output port in the working mode, and determine a working state of the general input/output port according to the level state, where the working state includes a high level state, a low level state, and a suspended high resistance state.
A hardware type determining module 304, configured to obtain a state identifier corresponding to the working state based on the working state, and determine a hardware type according to the state identifier.
And the hardware driving module 306 is configured to load and run a driver corresponding to the hardware type according to the determined hardware type.
In one embodiment, the operating state determining module is further configured to: when the set working mode is that the internal resistor is pulled up by software, if the read level state of the universal input/output port is a low level, directly determining that the working state of the universal input/output port is a low level state;
otherwise, resetting the working mode as software pull-down internal resistance pull-down, and determining the current state of the universal input/output port based on the software pull-down internal resistance pull-down mode.
In one embodiment, the working state determining module is further configured to, when the set working mode of the general purpose input/output port is software pull-down internal resistance pull-down, directly determine that the working state of the general purpose input/output port is a high level state if the read state of the general purpose input/output port is a high level state;
otherwise, resetting the working mode as software pull-up internal resistance pull-up, and determining the current state of the universal input/output port based on the software pull-up internal resistance pull-up mode.
In one embodiment, the operating state determining module is further configured to: resetting the working mode to be internal resistance pull-down, determining the current state of the universal input/output port in the internal resistance pull-down mode, and comprising the following steps:
when the working mode is reset to be the internal resistance software pull-up and pull-down mode, if the read state of the universal input/output port is a high level, the working state of the universal input/output port is determined to be a suspended high-resistance state; when the read level state corresponding to the state identifier of the universal input/output port is a low level, determining that the working state of the universal input/output port is a high level state;
in one embodiment, the operating state determining module is further configured to:
resetting the working mode to be internal resistance pull-up, and determining the current state of the universal input/output port based on the internal resistance pull-up mode, wherein the method comprises the following steps:
when the working mode of the universal input/output port is reset to be internal resistance pull-up, and when the read level state of the universal input/output port is a high level, determining that the working state of the universal input/output port is a high level state; and when the read level state of the general input/output port is a low level state, determining that the working state of the general input/output port is a suspended high-resistance state.
In one embodiment, the hardware type determination module further comprises: the mapping relation between the state identification and the hardware type is obtained; and determining the hardware type based on the mapping relation.
In one embodiment, the method further comprises the following steps:
the mapping relation processing module is used for acquiring the number of the universal input/output ports; and determining and acquiring the mapping relation between the state identifier and the hardware type based on the number of the universal input/output ports. The first mapping relation represents that the state identifier corresponds to the hardware type, and the second mapping relation represents that the combined state identifier corresponds to the hardware type after the state identifiers of the universal input/output ports are combined.
In one embodiment, the mapping relation processing module is further used for
For the specific definition of the hardware type identification device, reference may be made to the above definition of the hardware type identification method, which is not described herein again. The respective modules in the hardware type identification apparatus described above may be wholly or partially implemented by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 4. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used to store hardware drivers. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a hardware type identification method.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 5. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a hardware type identification method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the configurations shown in fig. 4 and 5 are block diagrams of only some of the configurations relevant to the present disclosure, and do not constitute a limitation on the computing devices to which the present disclosure may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory in which a computer program is stored and a processor which, when executing the computer program, carries out the steps of the above-mentioned method.
In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of the above-mentioned method.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for identifying hardware types, the method comprising:
setting a working mode of a universal input/output port, reading a level state of the universal input/output port in the working mode, and determining a working state of the universal input/output port according to the level state, wherein the working state comprises a high level state, a low level state and a suspended high-resistance state;
obtaining a state identifier corresponding to the working state based on the working state, and determining the hardware type according to the state identifier;
and loading and operating a driver corresponding to the hardware type according to the determined hardware type.
2. The method according to claim 1, wherein the determining the operating status of the gpio output port according to the level status of the gpio output port in the operating mode comprises:
when the set working mode is internal resistance pull-up, if the read level state of the general input/output port is a low level, directly determining that the working state of the general input/output port is a low level state;
otherwise, resetting the working mode as internal resistance pull-down, and determining the current state of the universal input/output port based on the internal resistance pull-down mode;
or the like, or, alternatively,
when the set working mode of the universal input/output port is internal resistance pull-down, if the read state of the universal input/output port is a high level, directly determining that the working state of the universal input/output port is a high level state;
otherwise, resetting the working mode as internal resistance pull-up, and determining the current state of the universal input/output port based on the internal resistance pull-up mode.
3. The method of claim 2, wherein resetting the operating mode to internal resistance pulldown, and wherein determining the current state of the universal input output port based on the internal resistance pulldown mode comprises:
when the working mode is reset to be internal resistance pull-down, if the read state of the universal input/output port is a high level, determining that the working state of the universal input/output port is a suspended high-resistance state;
if the read level state corresponding to the state identifier of the universal input/output port is a low level, determining that the working state of the universal input/output port is a high level state;
or the like, or, alternatively,
resetting the working mode to be internal resistance pull-up, and determining the current state of the universal input/output port based on the internal resistance pull-up mode, wherein the method comprises the following steps:
when the working mode of the universal input/output port is reset to be internal resistance pull-up, if the read level state of the universal input/output port is a high level, determining that the working state of the universal input/output port is a high level state;
and if the read level state of the general input/output port is a low level state, determining that the working state of the general input/output port is a suspended high-resistance state.
4. The method of claim 1, wherein determining the hardware type according to the status identifier comprises:
acquiring a mapping relation between the state identifier and the hardware type;
and determining the hardware type based on the mapping relation.
5. The method of claim 4, wherein the obtaining the mapping relationship between the status identifier and the hardware type comprises:
acquiring the number of the universal input/output ports;
and acquiring the mapping relation between the state identification and the hardware type based on the number of the universal input/output ports.
6. The method of claim 5, wherein the mapping comprises a first mapping, a second mapping; the first mapping relation represents that the state identifier corresponds to the hardware type, and the second mapping relation represents that the combined state identifier corresponds to the hardware type after the state identifiers of the universal input/output ports are combined.
7. The method of claim 6, wherein the step of combining the status identifiers of the universal input/output ports comprises:
and combining the state identifications according to the acquired sequence according to the acquired state identifications of the universal input/output ports to obtain the combined state identifications.
8. An apparatus for identifying hardware type, the apparatus comprising:
the working state determining module is used for setting a working mode of a universal input/output port, reading a level state of the universal input/output port in the working mode, and determining a working state of the universal input/output port according to the level state, wherein the working state comprises a high level state, a low level state and a suspended high-resistance state;
the hardware type determining module is used for obtaining a state identifier corresponding to the working state based on the working state and determining the hardware type according to the state identifier;
and the hardware driving module is used for loading and operating a driving program corresponding to the hardware type according to the determined hardware type.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110017993.3A 2021-01-07 2021-01-07 Hardware type identification method and device, computer equipment and storage medium Pending CN112698875A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110017993.3A CN112698875A (en) 2021-01-07 2021-01-07 Hardware type identification method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110017993.3A CN112698875A (en) 2021-01-07 2021-01-07 Hardware type identification method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112698875A true CN112698875A (en) 2021-04-23

Family

ID=75514983

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110017993.3A Pending CN112698875A (en) 2021-01-07 2021-01-07 Hardware type identification method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112698875A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101695088A (en) * 2009-10-19 2010-04-14 深圳华为通信技术有限公司 Module identification method and terminal
CN104298635A (en) * 2014-09-26 2015-01-21 福建联迪商用设备有限公司 Method and device for recognizing equipment version information through GPIO port line
CN105975289A (en) * 2015-07-06 2016-09-28 乐视致新电子科技(天津)有限公司 Method and device for obtaining hardware version information
CN108415863A (en) * 2018-02-01 2018-08-17 广东欧珀移动通信有限公司 The hardware compatibility implementation method and Related product of electronic device
CN108768379A (en) * 2018-05-31 2018-11-06 华勤通讯技术有限公司 Polymorphic recognition methods, system and terminal
CN109753470A (en) * 2019-01-16 2019-05-14 Oppo广东移动通信有限公司 A kind of control method, micro-control unit and computer storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101695088A (en) * 2009-10-19 2010-04-14 深圳华为通信技术有限公司 Module identification method and terminal
CN104298635A (en) * 2014-09-26 2015-01-21 福建联迪商用设备有限公司 Method and device for recognizing equipment version information through GPIO port line
CN105975289A (en) * 2015-07-06 2016-09-28 乐视致新电子科技(天津)有限公司 Method and device for obtaining hardware version information
CN108415863A (en) * 2018-02-01 2018-08-17 广东欧珀移动通信有限公司 The hardware compatibility implementation method and Related product of electronic device
CN108768379A (en) * 2018-05-31 2018-11-06 华勤通讯技术有限公司 Polymorphic recognition methods, system and terminal
CN109753470A (en) * 2019-01-16 2019-05-14 Oppo广东移动通信有限公司 A kind of control method, micro-control unit and computer storage medium

Similar Documents

Publication Publication Date Title
US11579714B2 (en) Apparatus and method for providing memo function
AU2015229883A1 (en) Dynamic resource management for multi-process applications
CN102073514A (en) Method for updating basic input/output system
CN110928739A (en) Process monitoring method and device and computing equipment
CN109451098A (en) FPGA accelerator card MAC Address configuration method, device and accelerator card
CN109271255A (en) Resource regulating method, system and electronic equipment and storage medium
CN113504918A (en) Equipment tree configuration optimization method and device, computer equipment and storage medium
CN112148337A (en) Firmware upgrading method and device
CN115454512A (en) Chip drive loading configuration method, device, equipment and storage medium
US10599444B2 (en) Extensible input stack for processing input device data
CN112698875A (en) Hardware type identification method and device, computer equipment and storage medium
CN115509618A (en) Drive control method, device, apparatus, storage medium, and program product
US7577814B1 (en) Firmware memory management
WO2019139738A1 (en) Extensible input stack for processing input device data
CN113377458B (en) Plug-in management method and device, electronic equipment and storage medium
CN112650513B (en) Program upgrading method, device, computer equipment and storage medium
US9479565B2 (en) Selecting a network connection for data communications with a networked device
CN115792582B (en) Chip testing method, device and equipment
US7702890B2 (en) Information processing apparatus and program
CN114003516B (en) Method, system, equipment and storage medium for setting BIOS as default value
CN114579198B (en) Memory chip starting method and device, computer equipment and storage medium
CN113408845B (en) Processing method and device of production flow, computer equipment and storage medium
CN106648751A (en) Method for rapidly upgrading embedded software and embedded device
CN114416471A (en) Startup log control method and device, computer equipment and storage medium
CN106325994B (en) A kind of method and terminal device for controlling write request

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