A method and apparatus for identifying peripheral devices

By obtaining the average power consumption value of peripheral devices through a periodic clock and combining it with the identification number, the problems of hardware resource consumption and inaccurate identification when computer equipment identifies peripheral devices are solved, achieving more efficient and accurate device identification, and improving device compatibility and user experience.

CN120011277BActive Publication Date: 2026-03-06SHANGHAI INNOVATECH INFORMATION TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510087403.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-20
Publication Date
2026-03-06
Estimated Expiration
2045-01-20

AI Technical Summary

Technical Problem

Existing computer equipment suffers from high hardware resource consumption and inaccurate identification when recognizing peripheral devices, resulting in poor device compatibility.

Method used

By establishing a periodic clock, the average power consumption of peripheral devices is obtained, and the device is matched with the identifier and the average power consumption. Preset parameters and a database are used for identification and connection, reducing the dependence on hardware resources.

Benefits of technology

It improves the accuracy and efficiency of peripheral device identification, reduces hardware resource consumption, and enhances device compatibility and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120011277B_ABST
    Figure CN120011277B_ABST
Patent Text Reader

Abstract

This application provides a method and apparatus for identifying peripheral devices. The identification method is used to identify peripheral devices connected to a computer device. The method includes: obtaining the identification number of the peripheral device; establishing a periodic clock; obtaining the average power consumption value of the peripheral device based on the periodic clock; matching the average power consumption value with a first database; if the matching fails, running the peripheral device according to first preset parameters; if the running fails, the peripheral device connection fails; if the matching is successful or the running is successful, the peripheral device connection is successful, and first connection data is stored in a second database. The first database is used to store preset average power consumption values ​​of peripheral devices, and the first connection data includes the average power consumption values ​​of successfully connected peripheral devices. Through the solution of this application, the computer device can quickly and accurately identify and distinguish peripheral devices, enabling the computer device to quickly and accurately connect peripheral devices, improving the accuracy of peripheral device identification, and helping to save hardware resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of embedded systems technology, and more specifically, to a method and apparatus for identifying peripheral devices. Background Technology

[0002] Peripheral Component Interconnect Express (PCIe) is a high-speed serial computer expansion bus standard used to connect computer devices and external devices to achieve various functions. These external devices are called PCIe devices, or peripheral devices. Generally, the PCIe protocol uses a 32-bit PCIe identifier (ID) to identify peripheral devices in the system. The 32 bits include: 16 bits for domain, 8 bits for bus, 5 bits for device, and 3 bits for function, corresponding to an 8-bit bus ID, a 5-bit device ID, and a 3-bit function ID, abbreviated as BDF (bus-device-function). This PCIe identifier can also be called an identification number.

[0003] When a computer device connects multiple peripheral devices via a bus, the device identifies the peripheral devices using internal registers. Since peripheral devices of the same category share the same identifier, different devices within the same category cannot be identified solely by their identifiers. To distinguish between different peripheral devices, existing computer devices rely on general purpose input / output (GPIO) ports to connect to the devices and detect their voltage values ​​during operation, thus differentiating different peripheral devices of the same category. However, this process suffers from issues such as consuming hardware interface resources and inaccurate identification leading to poor device compatibility.

[0004] Therefore, how to provide a method that saves hardware resources and provides accurate identification has become an urgent problem to be solved. Summary of the Invention

[0005] This application provides a method for identifying peripheral devices. Computer devices can distinguish and identify peripheral devices based on their identification numbers and the obtained average power consumption values, thereby improving the efficiency and accuracy of peripheral device connections and enhancing the flexibility of identification and user experience.

[0006] Firstly, a method for identifying peripheral devices is provided, for identifying peripheral devices connected to a computer device, the identification method including:

[0007] Obtain the identification number of the peripheral device;

[0008] Establish a periodic clock;

[0009] The average power consumption of peripheral devices is obtained based on a periodic clock.

[0010] Match the average power consumption value with the first database;

[0011] If the matching fails, the peripheral device will be activated according to the first preset parameters.

[0012] Operation failed; peripheral device connection failed.

[0013] If the matching or operation is successful, the peripheral device is successfully connected, and the first connection data is stored in the second database.

[0014] The first database is used to store the average power consumption values ​​of preset peripheral devices, and the first connection data includes the average power consumption values ​​of successfully connected peripheral devices.

[0015] By measuring and calculating power consumption, computer equipment can identify and distinguish peripheral devices, enabling the computer equipment to connect to peripheral devices quickly and accurately, improving the accuracy of peripheral device identification, and helping to save hardware resources.

[0016] In conjunction with the first aspect, in some implementations of the first aspect, obtaining the average power consumption value of peripheral devices based on a periodic clock includes: performing periodic on and off operations on peripheral devices based on a periodic clock signal to obtain the power consumption value of peripheral devices, and calculating the average power consumption value of peripheral devices per unit time.

[0017] By combining the control of peripheral devices with a periodic clock, the computer equipment can acquire the device's operating data and calculate the average power consumption value, thereby making an accurate judgment on the device data and effectively distinguishing the differences between different devices, thus improving the accuracy of device identification.

[0018] In conjunction with the first aspect, in some implementations of the first aspect, the first preset parameter includes the average power consumption value of multiple peripheral devices, and the first preset parameter is used to run peripheral devices that fail to match.

[0019] By using preset parameters and operating on peripheral devices that fail to match, some peripheral devices that fail to match can still connect to the computer equipment, thereby reducing the connection failure rate and improving the efficiency and performance of recognition.

[0020] In conjunction with the first aspect, in some implementations of the first aspect, the second database is used to store the current identifier and average power consumption value of the peripheral device after the peripheral device is successfully connected.

[0021] In conjunction with the first aspect, in some implementations of the first aspect, the second database is also used for matching with the identifier and / or average power consumption value.

[0022] Optionally, when at least one peripheral device successfully connects to the computer device, a second database is built in the device, and the current data of the peripheral device is stored in the second database. The stored data includes the identifier and average power consumption value of the peripheral device, and may also include the status of the device and / or equipment. In this computer device, after the second database is built, when the peripheral device connects, in addition to matching with the first database, it can also refer to the data in the second database. If the data in the second database can match, the peripheral device can also connect to the computer device, and the data in the second database can be updated after the connection is completed; that is, the second database is mutable.

[0023] By leveraging the second database, devices that have already been connected can be quickly matched and connected, thereby improving the efficiency of peripheral device identification and making it more adaptable to user habits, thus enhancing the user experience.

[0024] In conjunction with the first aspect, in some implementations of the first aspect, the periodic clock has a period of at least 50 Hz.

[0025] In conjunction with the first aspect, in some implementations of the first aspect, the identification method also includes:

[0026] Obtain register information from peripheral devices;

[0027] The system matches the identification numbers of peripheral devices with a third database.

[0028] If the matching fails, activate the peripheral device according to the second preset parameter.

[0029] If the matching or activation is successful, the peripheral device is successfully connected. The second connection data is stored in the second database, and the peripheral device is initialized.

[0030] Activation failed; peripheral device connection failed.

[0031] The third database is used to store the identifiers of preset peripheral devices, and the second connection data includes the identifiers of successfully connected peripheral devices.

[0032] Through the embodiments of this application, the computer device can obtain the register information of the peripheral device through the bus, and identify the peripheral device according to the preset information. It can quickly identify devices of the same category based on the identifier of the peripheral device, improve the efficiency and performance of identification, and improve the connection success rate.

[0033] In conjunction with the first aspect, in some implementations of the first aspect, the register information includes the identifier, the operating status of the peripheral devices, and the compensation parameters of the peripheral devices.

[0034] In conjunction with the first aspect, in some implementations of the first aspect, the second preset parameter includes the identifiers of multiple peripheral devices, and the second preset parameter is used to activate peripheral devices that failed to match.

[0035] By using the second preset parameter to attempt a second connection to peripheral devices that failed to match, some peripheral devices can be connected to computer devices, thereby improving the connection success rate and enhancing the efficiency and user experience of device connection.

[0036] In conjunction with the first aspect, in some implementations of the first aspect, initialization includes at least one of power management, clock configuration, register configuration of peripheral devices, communication interface configuration of peripheral devices, and performance and / or functionality testing of peripheral devices.

[0037] In a second aspect, a chip is provided, including at least one processing core for executing an identification method as described in any of the implementations in the first aspect.

[0038] Optionally, the chip is provided with a chip system, which can be used in the chip, and the chip system includes at least one processor and at least one interface circuit for cooperating with each other to execute instructions.

[0039] Thirdly, a computer system is provided, including: a chip as described in the second aspect.

[0040] Fourthly, a computer program product is provided, comprising computer program code for running on a computer system and executing an identification method as described in any of the implementations of the first aspect.

[0041] Fifthly, a computer-readable storage medium is provided, including a computer program for running on a computer system and causing a processing module in the computer system to perform the identification method as described in any implementation of the first aspect. Attached Figure Description

[0042] Figure 1 This is a schematic diagram of the structure of a computer device 100 provided in an embodiment of this application;

[0043] Figure 2 This is a schematic flowchart of an identification method 200 provided in an embodiment of this application;

[0044] Figure 3This is a schematic flowchart of an identification method 300 provided in an embodiment of this application;

[0045] Figure 4 This is a schematic diagram of the structure of a chip system 400 provided in an embodiment of this application;

[0046] Figure 5 This is a conceptual partial view of a computer program product 500 provided in an embodiment of this application. Detailed Implementation

[0047] The technical solutions in this application will now be described with reference to the accompanying drawings.

[0048] This application relates to a processor in a computer device accessing the configuration space of an external device. The computer device can be a server or a terminal, and the terminal includes, but is not limited to, user systems such as desktop computers, laptops, and smartphones. For ease of understanding, the structure of the computer device is described below.

[0049] Figure 1 A schematic diagram of the structure of a computer device 100 provided in an embodiment of this application is shown.

[0050] See Figure 1 The computer device 100 includes a main processor 101, input / output devices (I / O devices) 102, memory 103, cache 104, memory management unit (MMU) 105, input / output memory management unit (IOMMU) 106, and bus 107. The main processor 101 includes at least one core. This core is also called a computing engine. Each core can independently execute tasks. When the main processor 101 includes multiple cores, tasks from applications can be divided, allowing applications to fully utilize multiple cores and execute more tasks within a specific timeframe. In this embodiment, the main processor 101 can be a main processor, such as a central processing unit (CPU).

[0051] Input / output device 102 refers to a hardware device capable of inputting and / or outputting data. Input / output device 102 can be divided into input devices and output devices. Input devices include, for example, a mouse, keyboard, joystick, stylus, microphone, etc., while output devices include, for example, a monitor, speakers, etc.

[0052] Memory 103, also known as internal memory or main memory, is used to temporarily store the computational data in the main processor 101. Furthermore, memory 103 is also used to temporarily store data exchanged with external memory. Memory 103 can typically be implemented using storage media such as dynamic random access memory (DRAM) or static random access memory (SRAM).

[0053] Cache 104 is a component used to reduce the average time required for the main processor 101 to access memory 103; it can refer to the processor cache, such as the CPU cache. See also Figure 1 In the pyramid-shaped storage system, cache 104 is located in the second layer from the top, second only to the registers of the main processor 101 (not shown in the figure), and above memory 103 (memory 103 is located in the third layer from the top). Typically, the capacity of cache 104 is much smaller than that of memory 103, but its access speed can approach the frequency of the main processor 101.

[0054] The memory management unit 105 is a type of computer hardware used to process data access requests. Specifically, the memory management unit 105 maps virtual addresses (VAs) in data access requests. Specifically, the memory management unit 105 can intercept data access requests issued by the core of the main processor 101, and map or translate the virtual addresses in the data access requests into physical addresses (PAs) so that memory 103 can be accessed based on those physical addresses.

[0055] The input / output memory management unit 106 is essentially a memory management unit. Similar to the memory management unit 105, which maps the virtual address visible to the main processor 101 to the physical address, the input / output memory management unit 106 is used to map the virtual address (also called the device address or I / O address) visible to the input / output device 102 to the physical address.

[0056] Bus 107 is used to connect the various functional components of computer device 100. Bus 107 is a common communication trunk for transmitting information between the various functional components of computer device 100. Bus 107 can be a transmission line bundle formed by wires. Depending on the connection objects, bus 107 can also be divided into internal bus and external bus. The internal bus uses an internal bus protocol to transmit information. The internal bus protocol includes a bus protocol for accessing the memory space of computer device 100. The external bus uses an external bus protocol to transmit information. The external bus protocol includes a bus protocol for accessing the external storage space of computer device 100. Here, memory space refers to the address space of memory, and external storage space refers to the address space of external storage.

[0057] Computer device 100 can also be connected to secondary storage, also known as external memory or auxiliary storage, which is typically used for persistent data storage. For example, secondary storage can persistently store computational data from the main processor 101. Even in the event of a power failure, data already written to this secondary storage can still be preserved, preventing data loss. In specific implementations, secondary storage includes at least one non-volatile memory 1. When secondary storage includes multiple non-volatile memories, these multiple non-volatile memories can be of the same type or different types. For example, in... Figure 1 In the example, external storage can include two types of non-volatile memory, such as storage class memory (SCM) and solid state drive (SSD).

[0058] In some embodiments, the internal bus protocol includes, but is not limited to, the Peripheral Component Interconnect (PCI) bus, the Peripheral Component Interconnect High Speed ​​Protocol, the Intel™ Quick Path Interconnect (QPI) protocol, and the Universal Bus protocol. The external bus protocol includes, but is not limited to, the Small Computer System Interface (SCSI) protocol or the Serial Attached SCSI (SAS) protocol.

[0059] In some possible implementations, the external storage of computer device 100 can also be local external storage, and other components of computer device 100, such as the main processor 101, can be connected to the aforementioned local external storage via bus 107. In other possible implementations, computer device 100 may include both remote external storage and local external storage. Furthermore, the embodiments of this application can be applied to centralized storage or distributed storage scenarios, and this embodiment does not limit them.

[0060] For example Figure 1 Taking the computer device 100 shown as an example, the computer device 100 can connect to multiple peripheral devices, such as... Figure 1The input / output device 102 shown can distinguish peripheral devices of the same category from each other by using a voltage identification method based on GPIO. Specifically, each peripheral device needs to have a pin connected to the GPIO of the computer device chip. The analog-to-digital converter (ADC) function of the chip is used to read the status of the GPIO port through the GPIO register, convert the analog voltage of the GPIO port into a digital value, and then determine the voltage level based on the digital value. Different voltage data are recorded to distinguish different peripheral devices.

[0061] In the above methods, the voltage identification method based on GPIO relies on the chip interface and functions of the computer device, and the peripheral device needs to be set up with an output pin connected to the computer device. The connected GPIO port will be occupied by the peripheral device, which reduces the utilization rate of the computer device's hardware resources. At the same time, the peripheral device being detected should support the function of voltage output, and may need to add an extra output pin to realize the connection, thereby increasing the manufacturing cost of the peripheral device.

[0062] To address the aforementioned issues, this application proposes a peripheral device identification method. By establishing a periodic clock and operating the peripheral devices based on the clock signal of the periodic clock, the average power consumption of the peripheral devices per unit time is obtained. The peripheral devices are distinguished based on their identification number and average power consumption value. This method can effectively and accurately identify different peripheral devices with the same identification number, improving the identification accuracy and efficiency. Furthermore, it does not require additional hardware resources, which is beneficial for improving the utilization rate of computer equipment hardware resources and reducing manufacturing costs.

[0063] Figure 2 A schematic flowchart of an identification method 200 provided in an embodiment of this application is shown. As an example, this method can be used for, for example... Figure 1 The computer device 100 shown, more specifically, can be executed by the main processor 101.

[0064] The method includes the following steps:

[0065] S201, Obtain the identification number of the peripheral device;

[0066] S202, establish a periodic clock;

[0067] S203 obtains the average power consumption of peripheral devices based on a periodic clock.

[0068] S204, Match the average power consumption value with the first database;

[0069] S205, matching failed, run peripheral devices according to preset parameters;

[0070] S206, Operation failed, peripheral device connection failed;

[0071] S207, if the match is successful or the operation is successful, store the first connection data in the second database.

[0072] The first database is used to store the average power consumption values ​​of preset peripheral devices, and the first connection data includes the average power consumption values ​​of successfully connected peripheral devices.

[0073] In this embodiment of the application, by measuring and calculating the power consumption value, the computer device can identify and distinguish peripheral devices, enabling the computer device to quickly and accurately connect peripheral devices, improving the accuracy of peripheral device identification, and helping to save hardware resources.

[0074] In step S201, when the computer device starts running, or when a peripheral device is connected to the device, the computer device reads the registers of the peripheral device via the bus to obtain the identifier of the peripheral device.

[0075] Alternatively, the bus can be, for example, such as Figure 1 The computer device 100 shown uses bus 107 to read peripheral device information via a serial communication protocol, such as SPI (serial peripheral interface) or I2C (inter-integrated circuit), also known as IIC.

[0076] In step S202, the device establishes a periodic clock in the processor, which may be, for example, a... Figure 1 The computer device 100 shown contains a main processor 101. A periodic clock refers to a clock system that repeats a clock signal at a fixed frequency and period. The generated signal is called a periodic clock signal or periodic signal, a square wave signal with a fixed period, used to measure time intervals and indicate the sequence of specific events, and to synchronize the operation of various components in digital circuits. Optionally, a periodic clock can be used, for example, to synchronize various components in a control circuit so that they operate according to the correct time sequence, and can also be used to synchronize transmitters and receivers during data transmission to ensure accurate data transmission.

[0077] Optionally, the periodic clock can be generated by a clock generator and is built into a hardware module inside the processor, such as a timer or a watchdog timer. The periodic clock can generate a clock signal with a fixed frequency and period to synchronize and control the operation of various hardware components, ensuring they operate according to the correct time sequence. For example, the periodic clock can be used for... Figure 1 Various timed and synchronized tasks in the computer device 100 shown.

[0078] In step S203, after establishing a periodic clock, the device controls the peripheral devices. Based on the clock signal of the periodic clock, the peripheral devices are repeatedly turned on and off, and the power consumption value of the peripheral devices is periodically obtained to calculate the average power consumption value of the peripheral devices per unit time.

[0079] After initializing its peripheral devices, the computer can control their operation. Based on a periodic clock, the computer repeatedly turns the peripheral devices on and off, with the cycle corresponding to the clock signal, to monitor changes in power consumption. When a peripheral device changes from on to off, or vice versa, its internal voltage and current fluctuate. The device detects these fluctuations, records them, and calculates the corresponding power consumption. After this cycle, the device records multiple power consumption values ​​and calculates the average power consumption of the peripheral devices based on the recorded data.

[0080] By combining the control of peripheral devices with a periodic clock, the computer equipment can acquire the device's operating data and calculate the average power consumption value, thereby making an accurate judgment on the device data and effectively distinguishing the differences between different devices, thus improving the accuracy of device identification.

[0081] Optionally, the periodic clock period may be at least 50Hz, meaning it undergoes 50 periodic changes per second, or the computer device may measure the power consumption of peripheral devices 200 times. This application does not specifically limit the exact period setting.

[0082] In step S204, the average power consumption value of the acquired peripheral device is matched with data in the first database. The first database records information on peripheral devices that can be connected to the device, as well as the average power consumption value of each device, for peripheral device identification. After acquiring the peripheral device information, including its identification number, the identification number is first matched in the first database. Once the device corresponding to the identification number is confirmed, it is matched against the corresponding average power consumption value already saved. If the same average power consumption value is matched, the match is successful, meaning the peripheral device identification is successful. If no corresponding average power consumption value is matched in the first database, the match fails, meaning the peripheral device identification fails.

[0083] For example, peripheral devices of the same category with the same identification number may have different modules. These devices with the same identification number but different modules exhibit differences in power consumption during operation. The different modules can refer to various aspects, such as module type and function, including differences in communication modules and their functions. The more complex the module's function and the more integrated circuits and components, the higher its power consumption. Furthermore, differences in hardware design processes also affect device power consumption, including chip and circuit design. Differences in internal circuit routing and the materials used in components will lead to variations in operating power consumption. These differences in modules result in differences in current and / or voltage during operation, thus leading to differences in average power consumption.

[0084] Optionally, the data in the first database is set before the computer device is operated or used, and is immutable or unmodifiable, meaning that the data in the first database will not change with the working state of the computer device or its connected peripheral devices.

[0085] By measuring the average power consumption, computer equipment can quickly detect the differences between various components, effectively identifying peripheral devices with the same identification number but different modules. This improves the accuracy and precision of peripheral device identification. Furthermore, by using preset parameters and running the program on peripheral devices that fail to match, some of these peripheral devices can still be connected to the computer equipment, thereby reducing the connection failure rate and improving identification efficiency.

[0086] In step S205, since the device identifier is first ensured to match the device before matching the average power consumption value, in order to reduce the failure rate of peripheral device connection to the device, when the average power consumption value of the peripheral device fails to match the first database, the peripheral device is run according to preset parameters to try to retain the connection of the peripheral device.

[0087] Specifically, based on the average power consumption values ​​of peripheral devices recorded in the first database, after a successful matching of a peripheral device, the device selects the corresponding instruction to run the peripheral device according to the corresponding device information. In this embodiment, if the average power consumption value fails to match data in the first database, the device cannot find a preset instruction to run the peripheral device. In this case, the device searches for device information corresponding to a similar average power consumption value in the first database according to the average power consumption value of the peripheral device, and uses the corresponding instructions of these devices to run the peripheral device.

[0088] This method can effectively increase the likelihood and success rate of connecting peripheral devices to computer equipment, and improve the connection efficiency of the devices.

[0089] In step S206, after the peripheral device fails to operate according to the method described in step S205, the peripheral device connection fails, meaning that the device cannot be controlled and operated by the computer device. At this time, the computer device issues a prompt, for example, by displaying a dialog box or pop-up window through the interactive function of the display component to inform the user that the peripheral device connection has failed. The prompt may include information such as the current status of the peripheral device, device information including the identification number, and the reason for the connection failure, so that the user can retry the connection or disconnect the peripheral device.

[0090] In step S207, after successful matching of the aforementioned peripheral devices, or successful operation of peripheral devices that failed to match based on the first database, the peripheral devices connect to the computer device and record data in the second database, recording relevant information and data for subsequent operations. The second database is built within the computer device and records the identifiers and current average power consumption values ​​of the peripheral devices connected to the device. When at least one peripheral device successfully connects to the computer device, the device builds the second database and stores the current peripheral device data in it. The stored data includes the identifiers and average power consumption values ​​of the peripheral devices, and may also include the device and / or equipment status. In this computer device, after the second database is built, when connecting, the peripheral devices can refer to the data in the second database in addition to matching with the first database. If the data in the second database matches, the peripheral device can also connect to the computer device, and the data in the second database can be updated after the connection is completed; that is, the second database is variable.

[0091] By leveraging the second database, devices that have already been connected can be quickly matched and connected, thereby improving the efficiency of peripheral device identification and making it more adaptable to user habits, thus enhancing the user experience.

[0092] In such Figure 2In the identification method 200 shown, the computer device obtains the identification number of the peripheral device and detects the average power consumption value. Prior to this, the method shown in the embodiments of this application also includes matching the identification number, which will be discussed below. Figure 3 Please provide an explanation of this content.

[0093] Figure 3 A schematic flowchart of another identification method 300 provided in an embodiment of this application is shown. (Note: The last part, "as in...", is omitted.) Figure 2 The same steps are used in the identification method 200 shown.

[0094] like Figure 3 As shown, the identification method also includes:

[0095] S301, obtain register information of peripheral devices;

[0096] S302, matches the peripheral device identification number with the third database;

[0097] S303, matching failed. Activate peripheral devices according to the second preset parameters.

[0098] S304, matching or activation successful, peripheral device connection successful, store the second connection data in the second database, and initialize the peripheral device;

[0099] S305, activation failed, peripheral device connection failed.

[0100] The third database is used to store the identifiers of preset peripheral devices, and the second connection data includes the identifiers of successfully connected peripheral devices.

[0101] Through the embodiments of this application, the computer device can obtain the register information of the peripheral device through the bus, and identify the peripheral device according to the preset information. It can quickly identify devices of the same category based on the identifier of the peripheral device, improve the efficiency and performance of identification, and improve the connection success rate.

[0102] In step S301, after powering on, the computer device performs its own initialization. Then, based on the current connection status, it reads the registers internally set by the peripheral devices connected to the device via the bus to obtain the register information of the peripheral devices. Optionally, the register information of the peripheral devices read by the device may include, in addition to the device's identification number, the current operating status of the peripheral devices, current configuration settings, such as sampling rate, resolution, operating mode, and other parameters, as well as compensation parameters that the corresponding devices may contain, such as temperature compensation parameters, pressure compensation parameters, etc.

[0103] For example, the process of obtaining information may include the following:

[0104] First, the computer device initializes the bus. Bus initialization includes configuring the bus interface, which may involve setting parameters such as the bus clock frequency, data width, and communication protocol to ensure correct communication with peripheral devices. After bus initialization, the computer device connects to the peripheral devices, ensuring correct physical connections and that the bus signal lines are connected correctly. Optionally, the bus signal lines may include data lines, address lines, and control lines.

[0105] After confirming the physical connection with the peripheral device, the computer device sends the address code of the peripheral device via the address lines to select the current device to be read. The address code usually consists of multiple bits and is used to uniquely identify each peripheral device in the computer device system. After sending the address of the peripheral device, the computer device sends the register address of the peripheral device to be read and the read instruction. The register address specifies the specific location of the data stored inside the device, and the read instruction is used to instruct the peripheral device to prepare to send the data in the register back to the device.

[0106] After the above process is completed, the computer device transmits data. Specifically, after receiving the read command, the peripheral device reads the data from the specified register and places it in the data output register. The computer device receives the data from the peripheral device through the data line. The timing and format of the data transmission are specified by the bus protocol.

[0107] After data is transmitted to the computer device, the device receives the data from the peripheral devices and stores it in an internal buffer or register. Based on pre-set instructions or operational requirements, the computer device processes the read data, performing operations such as numerical conversion, status checks, and data storage. Optionally, data verification can be performed during data transmission between the computer device and the peripheral devices to ensure the integrity and accuracy of the acquired data.

[0108] In step S302, the computer device uses the acquired identifier of the peripheral device to match it with the third database to confirm whether the current device belongs to a preset range. The third database stores the identifiers corresponding to preset peripheral devices. This preset identifier data is set inside the computer device before the peripheral device is connected, and it can record whether the computer device can be connected, so as to facilitate quick matching during connection.

[0109] Optionally, both the third database and the first database are preset data. The two databases can share a storage space, be stored independently, or partially share data; this application embodiment does not specifically limit this. Furthermore, similar to the first database, the data in the third database is immutable, meaning it will not change with the operating status of the computer device or connected peripheral devices.

[0110] In some possible implementations, the first database and the third database can reuse data. That is, the data in the two databases can be set in different computer devices at the same time while remaining unchanged, and used as a reference for the connection and operation of preset peripheral devices. This setting method can provide a convenient connection method for the devices and facilitate the connection of multiple devices in the computer device.

[0111] Optionally, before the computer equipment is put into use, the database data can be modified based on the existing connection conditions, for example, by referring to... Figure 2 The data stored in the second database in the identification method 200 shown is adjusted in combination with the preset data after the device is actually connected to the device, so as to realize the adaptive change of user habits, improve the success rate of peripheral device connection to computer device, and help improve the flexibility of device connection and user experience.

[0112] In step S303, after the peripheral device's identifier fails to match the data in the third database, the computer device activates the peripheral device according to preset parameters. Specifically, the third database records the identifiers of peripheral devices that the current computer device can connect to, enabling quick matching and generation of corresponding instructions to run the peripheral device. If the matching fails, it means that the peripheral device does not belong to the preset range included in the database. At this time, the computer device attempts to activate the peripheral device according to second preset parameters. These second preset parameters can be set in multiple groups according to different device types. During the connection process, the device selects similar or possible parameters based on the current identifier and generates existing instructions to activate the current peripheral device. If activation is successful, the peripheral device is similar in type to the device type corresponding to its running instructions, and the instructions can be used to match the peripheral device.

[0113] By using the second preset parameter to attempt a second connection to peripheral devices that failed to match, some peripheral devices can be connected to computer devices, thereby improving the connection success rate and enhancing the efficiency and user experience of device connection.

[0114] In step S304, after the identification number of the peripheral device is successfully matched with the data in the third database, or after successful activation according to the method in step S303, the computer device records the relevant data of the peripheral device in the second database and initializes the peripheral device to control and operate the device.

[0115] The second database is built within the current computer device, specifically after at least one peripheral device is successfully connected to the computer device. For example, unlike the first and third databases, the second database is independently located within the computer device and cannot be directly transferred to other devices. Furthermore, it is updated in real time; that is, data is stored and updated after each peripheral device's identifier and average power consumption value are successfully matched.

[0116] For example, the second database can also be used for matching when connecting peripheral devices. That is, after obtaining the identification number of the peripheral device, in addition to matching with the third database, it can also be matched with the second database to quickly match and connect when the current device has been connected, thereby improving the efficiency of peripheral device identification and making it more suitable for users' usage habits.

[0117] Optionally, initialization may include one or more operations, such as at least one of power management, clock configuration, peripheral device register configuration, peripheral device communication interface configuration, and peripheral device performance and / or functionality testing. Power management includes power-on reset and power stability check. Power-on reset ensures that the peripheral device is reset upon power-on, clearing all registers and status bits to bring it to a known initial state. Power stability check verifies that the power supply voltage and current are within specified ranges to ensure the peripheral device operates under stable power conditions. Clock configuration includes setting a suitable operating clock source and frequency for the peripheral device to ensure its normal operation. Configuring registers includes configuring control registers, status registers, and data registers. Configuring control registers includes setting parameters such as the peripheral device's operating mode, data transfer rate, and interrupt enable. Configuring status registers includes checking the current state of the peripheral device to ensure it is in normal operating condition. Configuring data registers also includes clearing or setting initial values ​​within the peripheral device to prepare for data transfer. Configuring the communication interface of peripheral devices includes bus configuration, i.e., configuring the bus connected to the peripheral device, such as data lines, address lines, and control lines; configuring the communication interface also includes configuring the communication protocol, i.e., setting communication protocol parameters, such as data bits, stop bits, parity, etc., to ensure the correctness of data transmission; configuring the communication interface also includes interrupt configuration, i.e., setting interrupt priority and interrupt handlers, so that the peripheral device can respond to interrupt requests in a timely manner. Testing the performance and / or functionality of peripheral devices includes, for example, read / write operations, interrupt response, data transfer rate testing, latency testing, etc., to ensure that the basic functions of the peripheral devices are normal and that their performance meets requirements.

[0118] It should be understood that the above initialization operations are only examples, and other initialization operations performed on peripheral devices are also within the scope of protection of the embodiments of this application.

[0119] In step S305, after the connection fails according to the method described in step S303, the connection between the peripheral device and the computer device fails, and the peripheral device can no longer be controlled or operated by the computer device. Optionally, the computer device can issue a prompt to the user, for example, by displaying a dialog box or pop-up window through the interactive function of the display component to inform the user of the peripheral device connection failure. Furthermore, as an example, the computer device can also store relevant information about the peripheral device in a second database, such as the device's average power consumption and the computer device's operating status during connection, for reference and processing by researchers when handling device information.

[0120] Based on the above implementation, the computer device can distinguish and identify peripheral devices based on the identification number and the acquired average power consumption value, including peripheral devices of different categories with different identification numbers, as well as peripheral devices of the same category with the same identification number but different modules. It can flexibly process according to the actual device situation, improve the efficiency and accuracy of peripheral device connection, and help improve the identification performance and user experience.

[0121] Figure 4 This illustration shows a schematic diagram of a chip system 400 according to an embodiment of this application. The chip system 400 can be used in a chip, which includes at least one processing core for performing tasks such as... Figure 2 or Figure 3 The identification method 200 or identification method 300 shown.

[0122] like Figure 4 As shown, the chip system 400 includes at least one processor and at least one interface circuit. As an example, when the chip system 400 includes one processor and one interface circuit, the processor can be... Figure 4 The processor 410 shown in the solid box or the processor 410 shown in the dashed box, this interface circuit can be Figure 4 The interface circuit 420 is shown in either the solid box or the dashed box.

[0123] When the chip system 400 includes two processors and two interface circuits, then the two processors include Figure 4 The processor 410 shown in the solid box and the processor 410 shown in the dashed box, these two interface circuits include Figure 4 The interface circuit 420 shown in the solid box and the interface circuit 420 shown in the dashed box are not specifically limited in this application. The processor 410 and the interface circuit 420 can be interconnected via lines. For example, the interface circuit 420 can be used to receive signals, such as instructions stored in memory. For another example, the interface circuit 420 can also be used to send signals to other devices such as the processor 410.

[0124] For example, the interface circuit 420 can read instructions stored in the memory and send the instructions to the processor 410. When the processor 410 executes the instructions, it can cause the chip to perform the various steps in the above embodiments. Of course, the chip system 400 may also include other discrete devices, and this application embodiment does not specifically limit this.

[0125] Figure 5This illustration shows a conceptual partial view of a computer program product 500 provided in an embodiment of this application. The computer program product 500 includes computer program code for running on a computer system and performing actions such as... Figure 2 or Figure 3 The identification method 200 or identification method 300 shown. The computer program product 500 includes a computer-readable storage medium 512, a computer-recordable medium 513, and / or a communication medium 514, and one or more program instructions 511 in response to the foregoing portion, the program instructions 511 being used to provide various operations, functions, or actions.

[0126] like Figure 5 As shown, the computer program product 500 is provided using a signal carrying medium 510. This signal carrying medium 510 may include one or more program instructions 511, which, when executed by one or more processors, can provide the above-mentioned... Figure 2 or Figure 3 The identification method 200 or identification method 300 described herein may contain functions or parts thereof. Therefore, for example, referring to one or more steps in identification method 200 or identification method 300, these steps may be performed by one or more instructions associated with the signal carrying medium 510.

[0127] For example, the signal carrying medium 510 may include a computer-readable storage medium 512, which includes a computer program for running on a computer system to perform actions such as... Figure 2 or Figure 3 The identification method 200 or identification method 300 shown. The computer-readable storage medium 512 may include, for example, a hard disk drive, a digital versatile disc (DVD), a digital magnetic tape, a memory, read-only memory (ROM), or random access memory (RAM), etc.

[0128] In some possible implementations, the signal carrying medium 510 may include a computer-recordable medium 513, including but not limited to memory, read / write DVDs, etc. The signal carrying medium 510 may also include a communication medium 514, such as, but not limited to, digital and / or analog communication media, for example, fiber optic cables, waveguides, wired communication links, wireless communication links, etc. The signal carrying medium 510 may be transmitted by a wireless communication medium 514. One or more program instructions may be, for example, computer-executable instructions or logically implemented instructions.

[0129] The computer instructions can be stored in, for example, a computer-readable storage medium 512, or transmitted from one computer-readable storage medium 512 to another. For instance, computer instructions can be transmitted from one website, computer, server, or data center to another via wired or wireless means. Wired means include, for example, coaxial cable, fiber optic cable, digital subscriber line (DSL), etc., while wireless means include, for example, infrared, wireless, microwave, etc. The computer-readable storage medium 512 can be any available medium that a computer can access, or it can contain one or more data storage devices such as servers or data centers that can be integrated with media. Available media can be magnetic media such as floppy disks, hard disks, magnetic tapes, optical media, or semiconductor media such as solid-state drives, etc.

[0130] It should be understood that the arrangements described herein are for illustrative purposes only. Therefore, those skilled in the art will understand that other arrangements and other elements, such as machines, interfaces, functions, sequences, and functional groups, can be used instead, and some elements may be omitted depending on the desired outcome. Furthermore, many of the described elements are functional entities that can be implemented as discrete or distributed components, or in any suitable combination and location with other components.

[0131] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, it can be implemented, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When executed on a computer and when the computer execution instructions are executed, all or part of the processes or functions according to the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.

[0132] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0133] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0134] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0135] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0136] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0137] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.

[0138] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A peripheral device identification method for identifying a peripheral device connected to a computer device, characterized by, The identification method comprises: acquiring an identification number of the peripheral device; establishing a periodic clock; acquiring an average power consumption value of the peripheral device based on the periodic clock; matching the average power consumption value with a first database; if the matching fails, running the peripheral device according to a first preset parameter; if the running fails, the peripheral device fails to connect; if the matching succeeds or the running succeeds, the peripheral device successfully connects, and first connection data is stored in a second database; matching the identification number of the peripheral device with a third database; if the matching fails, activating the peripheral device according to a second preset parameter; if the matching succeeds or the activating succeeds, the peripheral device successfully connects, second connection data is stored in the second database, and the peripheral device is initialized; if the activating fails, the peripheral device fails to connect. The first database is used to store preset average power consumption values of the peripheral device, the first connection data comprises the average power consumption value of the peripheral device that successfully connects, the third database is used to store preset identification numbers of the peripheral device, and the second connection data comprises the identification number of the peripheral device that successfully connects.

2. The identification method according to claim 1, characterized in that, The acquiring of the average power consumption value of the peripheral device based on the periodic clock comprises: based on a clock signal of the periodic clock, periodically turning on and off the peripheral device, acquiring a power consumption value of the peripheral device, and calculating the average power consumption value of the peripheral device in a unit time.

3. The identification method according to claim 2, characterized in that, The first preset parameter comprises average power consumption values of a plurality of peripheral devices, and is used to run the peripheral device that fails to match.

4. The identification method according to any one of claims 1 to 3, characterized in that, The second database is used to store the identification number and the average power consumption value of the current peripheral device after the peripheral device successfully connects.

5. The identification method according to any one of claims 1 to 3, characterized in that, The second database is also used to match the identification number and / or the average power consumption value.

6. The identification method according to any one of claims 1 to 3, characterized in that, The period of the periodic clock is at least 50 Hz.

7. The identification method according to any one of claims 1 to 3, characterized in that, The identification method further comprises: acquiring a working state of the peripheral device and a compensation parameter of the peripheral device; The identification number, the working state of the peripheral device, and the compensation parameter of the peripheral device belong to register information of the peripheral device.

8. The identification method according to claim 7, characterized in that, The second preset parameter comprises identification numbers of a plurality of peripheral devices, and is used to activate the peripheral device that fails to match.

9. The identification method according to claim 8, characterized in that, The initialization comprises at least one of power management, clock configuration, register configuration of the peripheral device, communication interface configuration of the peripheral device, performance testing, and / or function testing of the peripheral device.

10. A chip, characterized by The chip comprises at least one processing core, and the processing core is used to execute the identification method according to any one of claims 1 to 9.

11. A computer system, characterized by The chip comprises: The chip according to claim 10.

12. A computer program product, characterised in that, The computer program product comprises computer program code used to run on a computer system and execute the identification method according to any one of claims 1 to 9.

13. A computer-readable storage medium, characterized in that, The computer program comprises a computer program for running on a computer system and causing a processing module in the computer system to perform the identification method as claimed in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Data transfer between host and peripheral devices

    CN108885598A

  • Device comprising peripheral interface and method of operating device

    CN114116561A