Device control method and distributed system

Virtual bus driver technology is used to realize direct management between master components and slave components in a distributed system, solving the problems of low communication efficiency and poor versatility in the existing technology, and improving the communication efficiency and management convenience of the system.

CN116016726BActive Publication Date: 2024-09-17MAIPU COMM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310107871.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-07
Publication Date
2024-09-17
Estimated Expiration
2043-02-07

AI Technical Summary

Technical Problem

Information encapsulation and decapsulation between master components and slave components in existing distributed systems needs to be implemented at the application layer, resulting in low communication efficiency and poor versatility, making it difficult to effectively manage and maintain devices with multiple functions.

Method used

Using virtual bus driver technology, the master component communicates with the second virtual bus driver of the slave component through the first virtual bus driver, directly manages the slave device, avoids encapsulation and decapsulation at the application layer, and realizes direct management of the slave component.

Benefits of technology

It improves the communication efficiency and versatility, enabling the main component to directly perform command operation access based on the LINUX standard driver in the user mode, thereby simplifying the management and maintenance of the distributed system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116016726B
    Figure CN116016726B
Patent Text Reader

Abstract

The present application provides a device control method and a distributed system, which relate to the field of communication technology. A first control unit of a main component sends a request message to a second control unit of a target slave component through a first virtual bus driver, so that the second control unit of the target slave component receives the request message through a second virtual bus driver, controls the target slave device corresponding to the request message through the second virtual bus driver, and obtains a response message of the target slave device. The first control unit of the main component receives the response message of the target slave device sent by the second control unit through the second virtual bus driver through the first virtual bus driver, so that the main component can directly manage the slave device of the slave component through the driver layer, does not perceive the function of the slave device, and does not need to encapsulate and decapsulate at the application layer. The main component can directly perform command operation access based on the LINUX standard driver in the user state, thereby improving the efficiency and versatility of communication and facilitating the management and maintenance of the distributed system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a device control method and a distributed system. Background Art

[0002] With the rapid development of technologies such as mobile Internet, cloud, and big data, the embedded field has increasingly higher requirements for distributed systems composed of communication devices or servers. In order to achieve higher reliability and maintainability, distributed systems can adopt dual-chip or multi-chip control and management architecture solutions, with a powerful master component completing the control information collection and processing of the entire distributed system, and at least one lower-performance slave component assisting in completing the control information collection and processing of part of the system.

[0003] The main component in a distributed system needs to manage not only the devices on the bus under the main component, but also the devices on the bus under the slave component. In the prior art, the main component initiates information acquisition from the slave component through the interconnected bus. The slave component initiates device information acquisition at the application layer, and then encapsulates the information and responds to the main component. After obtaining the response information, the main component decapsulates it and extracts the internal data of the device so that the upper-layer business module can obtain the internal data of the device. Among them, the information encapsulation and decapsulation between the main component and the slave component is realized on the basis of the application layer. The disadvantage is that it is necessary to "deeply" understand the functions and meanings provided by each device, that is, there is no universality. If there are devices with multiple functions hanging under the slave component, it is necessary to do multiple types of corresponding information encapsulation at the application layer. The communication efficiency is low and the universality is poor, which is not conducive to the management and maintenance of the distributed system. Summary of the invention

[0004] The object of the present invention is to provide a device control method and a distributed system to address the above-mentioned deficiencies in the prior art, so as to solve the technical problems in the prior art that the communication efficiency of the distributed system with multiple components is low and the versatility is poor.

[0005] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0006] In a first aspect, an embodiment of the present application provides a device control method, which is applied to a first control unit of a master component in a distributed system, wherein the distributed system further includes: at least one slave component, each slave component includes: a second control unit and at least one slave device, and the first control unit is communicatively connected with the second control unit in each slave component; the method includes:

[0007] Sending a request message to a second control unit of a target slave component through a first virtual bus driver, so that the second control unit of the target slave component receives the request message through a second virtual bus driver, and controls a target slave device corresponding to the request message through the second virtual bus driver to obtain a response message from the target slave device;

[0008] A response message of the target slave device sent by the second control unit through the second virtual bus driver is received through the first virtual bus driver.

[0009] Optionally, the request message includes: a target bus identifier;

[0010] Before the request message is sent to the second control unit of the target slave component through the first virtual bus driver, the method further includes:

[0011] The target slave component is determined according to the target bus identifier.

[0012] Optionally, before sending the request message to the second control unit of the target slave component through the first virtual bus driver, the method further includes:

[0013] In response to the service operation, the request message is encapsulated through the first virtual bus driver.

[0014] Optionally, the method further comprises:

[0015] The response message is parsed by the first virtual bus driver to obtain device internal data.

[0016] In a second aspect, an embodiment of the present application provides a device control method, which is applied to a second control unit of any slave component in a distributed system, wherein the distributed system further comprises: a master component, wherein a first control unit in the master component is communicatively connected with a second control unit in the slave component; the method comprises:

[0017] Receiving, through the second virtual bus driver, a request message sent by the first control unit through the first virtual bus driver;

[0018] By driving the second virtual bus, the target slave device corresponding to the request message is controlled to obtain a response message from the target slave device;

[0019] The response message of the target slave device is sent to the first control unit through the second virtual bus driver, so that the first control unit receives the response message through the first virtual bus driver.

[0020] Optionally, the controlling, through the second virtual bus driving, the target slave device corresponding to the request message and obtaining a response message from the target slave device includes:

[0021] Decapsulating the request message through the second virtual bus driver to obtain request data;

[0022] By driving the second virtual bus, according to the request data, the target slave device corresponding to the request data is controlled to obtain response data of the target slave device;

[0023] The response data is encapsulated by the second virtual bus driver to generate the response message.

[0024] Optionally, the request data includes: a target bus identifier and a device address, and before the second virtual bus driver controls the target slave device corresponding to the request message and obtains a response message from the target slave device, the method further includes:

[0025] The target slave device is determined according to the target bus identifier and the device address.

[0026] Optionally, the request data further includes: a command type and a command parameter; and the controlling, through the second virtual bus driving and according to the request data, a target slave device corresponding to the request data includes:

[0027] The target slave device is controlled to perform data operations corresponding to the command type according to the command parameters through the second virtual bus driver.

[0028] In a third aspect, an embodiment of the present application provides a distributed system, comprising a master component and at least one slave component, wherein the master component is communicatively connected with each of the slave components;

[0029] The main component comprises a first control unit and at least one main device;

[0030] A first virtual bus driver is pre-integrated in the first control unit, and the first control unit is used to execute the device control method executed by the first virtual bus driver described in any one of the first aspects through the first virtual bus driver.

[0031] Optionally, each of the slave components comprises a second control unit and at least one slave device;

[0032] A second virtual bus driver is pre-integrated in the second control unit, and the second control unit is used to execute the device control method executed by the second virtual bus driver described in any one of the second aspects through the second virtual bus driver.

[0033] Compared with the prior art, this application has the following beneficial effects:

[0034] The present application provides a device control method and a distributed system, wherein a first control unit of a main component sends a request message to a second control unit of a target slave component through a first virtual bus driver, so that the second control unit of the target slave component receives the request message through a second virtual bus driver, and controls the target slave device corresponding to the request message through the second virtual bus driver to obtain a response message from the target slave device, and the first control unit of the main component receives the response message of the target slave device sent by the second control unit through the second virtual bus driver through the first virtual bus driver, so that the main component can directly manage the slave device of the slave component through the driver layer, without having to care about the function of the slave device, and without having to encapsulate or decapsulate at the application layer, etc. The main component can directly perform command operation access based on the LINUX standard driver in the user state, thereby improving the efficiency and versatility of communication. At the same time, at the user state level, the upper-layer business basically does not perceive the change or difference, is completely decoupled from the upper-layer business module, has high independence, and is conducive to the management and maintenance of the distributed system. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0036] Figure 1 A schematic diagram of the structure of a distributed system provided in an embodiment of the present application;

[0037] Figure 2 A schematic diagram of the structure of another distributed system provided in an embodiment of the present application;

[0038] Figure 3 A schematic diagram of the structure of another distributed system provided in an embodiment of the present application;

[0039] Figure 4 A schematic diagram of a flow chart of a device control method provided in an embodiment of the present application;

[0040] Figure 5 A schematic diagram of a flow chart of a device control method provided in an embodiment of the present application;

[0041] Figure 6 A schematic flow chart of another device control method provided in an embodiment of the present application;

[0042] Figure 7A schematic diagram of a device control apparatus provided in an embodiment of the present application;

[0043] Figure 8 A schematic diagram of a device control apparatus provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0045] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for protection, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.

[0046] In the description of the present invention, the terms “first”, “second”, etc., if used, are only used to distinguish the descriptions and should not be understood as indicating or implying relative importance.

[0047] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.

[0048] With the rapid development of mobile Internet, cloud, big data and other related technologies, the embedded field has higher and higher requirements for data center servers and communication equipment. In particular, for the sake of reliability and maintainability, servers and communication equipment have basically abandoned the traditional single-chip control architecture and adopted dual-chip or multi-chip control and management architecture solutions; usually, a powerful main control chip completes the control information collection and processing of the entire distributed system, and one or more other lower-performance sub-control chips assist in completing the control information collection and processing of part of the system. On the one hand, it plays a role in sharing the pressure of the main control chip, and on the other hand, it collaborates with the main control chip to play functions and roles that a single chip cannot complete.

[0049] The distributed system where the server or communication equipment with dual control chips is located usually adopts the structure of CPU (Central Processing Unit) + BMC (Baseboard Management Controller), or CPU + CMM (Chassis Management Module), that is, the CPU is the main control chip, and the BMC or CMM is the secondary control chip. In addition to being responsible for data calculation and communication forwarding control, the main control chip is also responsible for obtaining system basic information from the secondary control chip and issuing control commands. The secondary control chip is mainly responsible for obtaining and managing system basic information, for example, temperature acquisition, fan control, power supply status acquisition and control, etc. In general, a low-speed CPU or MCU (Microcontroller Unit) is used on the secondary control chip, and a bus is used to manage devices or modules such as temperature, fan, and power supply. The bus can be an I2C (Inter-Integrated Circuit) bus. The main control chip and the secondary control chip usually use an Ethernet bus based on a LAN (Local Area Network) for communication. The distributed system of servers with multiple control chips or multi-board communication equipment usually adopts the structure of a main control card (including CPU) + line card (including CPU) + switch card (including CPU). Here, the distributed system is composed of multiple board communication devices, and the boards can be located in the same communication device or in different communication devices.

[0050] In the prior art, there is a distributed system with multiple control chips and multiple boards. The distributed system includes: a master component and at least one slave component. Figure 1 A schematic diagram of a distributed system structure provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the distributed system includes two components: component A and component B.

[0051] Each component has a bus and a device connected thereto. In the embodiment of the present application, the bus may be an I2C bus.

[0052] Under normal circumstances, each component can manage its own I2C bus and at least one device (I2C-dev). However, from the perspective of the entire distributed system, one of the multiple components is the control core of the entire distributed system, that is, the master component. The master component is responsible for providing global services to the upper-level business modules. Therefore, the master component not only needs to obtain relevant information about the component, but also needs to obtain relevant information about the slave components.

[0053] exist Figure 1In the embodiment, component A can be a master component, and component B can be one of the slave components. The master component includes a first control unit and at least one master device, and the first control unit is connected to each master device via an I2C bus ( Figure 1 Each I2C-dev in the middle component A) is used to control each master device. The first control unit may be a CPU or the like.

[0054] Each slave component includes a second control unit and at least one slave device, and the second control unit is connected to each slave device in the slave component via an I2C bus ( Figure 1 Each I2C-dev in the middle component B) is used to control each slave device in the slave component. The second control unit may be a CPU, an MCU, etc.

[0055] The first control unit in the master component is connected to the second control unit of each slave component to achieve communication between the master component and the slave component, wherein the communication connection can be achieved through a bus such as IPMI (Intelligent Platform Management Interface), UART (Universal Asynchronous Receiver-Transmitter), Ethernet, etc.

[0056] When the master component obtains the relevant information of the slave component, it usually implements the communication interaction of information through the IPMI communication interface or the serial port (UART) communication interface or the Ethernet communication interface. For example, Figure 2 A schematic diagram of another distributed system structure provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the main component (component A) initiates information acquisition to a slave component (component B) through the interconnection bus, and the slave component initiates information acquisition of the slave device in the slave component at the application layer, and then encapsulates the information and responds to the main component, so that the main component decapsulates the response message after obtaining it, and extracts the corresponding internal data of the device, so that the upper-layer business module obtains the internal data of the device.

[0057] However, the information encapsulation and decapsulation between the master component and the slave component in the above-mentioned prior art is realized on the basis of the application layer, which belongs to the communication management mode based on the application layer (communication between the master component application layer and the slave component application layer). The disadvantage is that it is necessary to "deeply" understand the functions and meanings provided by each device, which is basically not universal. As a result, when there are devices with multiple functions hanging under the slave component, it is necessary to do multiple types of corresponding data encapsulation at the application layer, that is, it is necessary to do data encapsulation based on the function of the device. For example, if the second control unit in the slave component is an RTC chip, the user state needs to understand / encapsulate / decapsulate the data related to the "real-time clock"; if the slave component is a PSU power module, the user state needs to understand / encapsulate / decapsulate the parameters and status data related to the "modular power supply"; if the second control unit in the slave component is a voltage / current / temperature sensor chip, the user state needs to understand / encapsulate / decapsulate various "voltage / current / temperature" related parameters and status data. If the slave component has a new functional meaning of the slave device, the corresponding new / expanded design of the new functional meaning is required. Therefore, the communication efficiency of this method is low and its versatility is poor, which is not conducive to the management and maintenance of distributed systems.

[0058] In order to solve this technical problem, the present application proposes a communication management method based on the bus driver layer (communication between the master component bus driver layer and the slave component bus driver layer), and performs data encapsulation based on the I2C bus access protocol to solve the technical problems existing in the prior art.

[0059] This application provides a distributed system. Figure 3 A schematic diagram of another distributed system structure provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, without modifying the hardware architecture design of the distributed system, considering the performance and versatility, the interconnection bus between the master component and the slave component is an Ethernet bus. The distributed system includes: a master component and at least one slave component. Both the master component and the slave component can be devices or boards with computing and processing functions.

[0060] The master component includes a first control unit and at least one master device, and the first control unit is connected to the at least one master device via a bus, and each slave component includes a second control unit and at least one slave device, and the second control unit is connected to the at least one slave device via a bus. In an embodiment of the present application, the bus may be an I2C bus.

[0061] The master component is communicatively connected to at least one slave component, specifically, a first control unit in the master component is communicatively connected to a second control unit in each slave component.

[0062] On this basis, a first virtual bus driver is pre-integrated in the first control unit in the master component, and a second virtual bus driver is pre-integrated in the second control unit in the slave component. Through message interaction between the first virtual bus driver and the second virtual bus driver, at least one virtual bus is added under the framework of the master component, which does not physically exist on the master component but exists logically in software. The at least one virtual bus indirectly points to the bus of at least one slave component.

[0063] In the embodiment of the present application, since the master component and the slave component are connected via the I2C bus, the virtual bus is also called a virtual I2C bus. The virtual bus itself is implemented in the Ethernet bus (UDP message), so it can also be called a virtual bus of I2C-Overlay-LAN. Specifically, Figure 3 As shown, when there is one slave component, a virtual I2C bus is added under the framework of the master component, pointing to the I2C bus of the slave component. If there are multiple slave components in the distributed system, multiple virtual I2C buses are added under the framework of the master component, pointing to the I2C buses of multiple slave components respectively.

[0064] Through the virtual bus, the main component can directly access commands based on the LINUX standard driver in user state, and directly load the chip driver of the device of the slave component (provided by the kernel), so that it can be directly accessed locally in user state, thereby realizing that the devices on the slave component are directly managed by the main component. The main component realizes direct management of the devices of the slave component through the driver level, without having to worry about the functions of the slave device, nor doing encapsulation, decapsulation, etc. in the application layer, thereby improving the efficiency and versatility of communication. At the same time, at the user state level, the upper-layer business basically does not perceive the changes or differences.

[0065] Optionally, if there are other types of buses (CAN, UART, SPI, etc.) in the master component and the slave component, a corresponding virtual bus (virtual CAN bus, virtual UART bus, virtual SPI bus, etc.) can be set according to the type of bus.

[0066] In the above Figure 3 Based on the embodiment of the distributed system, a device control method is also provided in the solution of the present application. The device control method provided in the embodiment of the present application is explained through specific examples as follows. Figure 4 A schematic diagram of a device control method provided in an embodiment of the present application. Figure 4 As shown, this method is applied to the above Figure 3The first control unit of the master component in the distributed system shown, the distributed system also includes: at least one slave component, each slave component includes: a second control unit and at least one slave device, the first control unit is communicatively connected with the second control unit in each slave component. In an embodiment of the present application, the first control unit and the second control unit are communicatively connected via an Ethernet bus. The method includes:

[0067] S401: Send a request message to a second control unit of a target slave component through a first virtual bus driver.

[0068] The first control unit of the master component sends a request message to the second control unit of the target slave component through the first virtual bus driver, wherein the request message is used to control the target slave device of the target slave component, and can be a data read or write operation on the target slave device.

[0069] In an embodiment of the present application, a request message is sent to a target slave device via an Ethernet bus to request the target slave device to perform a read or write operation on the target slave device.

[0070] After the master component sends the request message, the second control unit of the target slave component receives the request message through the second virtual bus driver, and after decapsulating the request message, determines the target slave device corresponding to the request message and the control information of the target slave device, and then can control the target slave device corresponding to the request message through the second virtual bus driver to obtain a response message from the target slave device.

[0071] Optionally, the first virtual bus driver needs to register with the kernel standard bus framework in the LINUX kernel and apply for / allocate a corresponding bus identifier or bus number. In an embodiment of the present application, the kernel standard bus framework is a kernel standard I2C bus framework, and the bus identifier or bus number is an I2C bus identifier or an I2C bus number.

[0072] S402: Receive, through the first virtual bus driver, a response message from the target slave device that is sent by the second control unit through the second virtual bus driver.

[0073] The second virtual bus driver controls the target slave device corresponding to the request message, and after obtaining the response message of the target slave device, the second virtual bus driver can send the response message to the first virtual bus driver of the master component to feedback the request message.

[0074] The first control unit of the master component receives the response message of the target slave device sent by the second control unit through the second virtual bus driver through the first virtual bus driver, and then parses the internal data of the device in the response message.

[0075] In the embodiment of the present application, the message transmission and reception of the request message and the response message are based on the kernel socket communication mechanism, using the UDP (User Datagram Protocol) protocol. Among them, the first virtual bus driver can implement the standard I2C read and write hook function through message transmission and reception to read the information of the target slave device or write data into the target slave device.

[0076] This method is applicable to the multi-small system solution of box-type equipment, the distributed system solution of rack-mounted equipment, and the virtualization of other low-speed buses (SPI / CAN / UART, etc.), thereby realizing a more general virtual bus technology with a wider range of applications. Since low-speed buses and devices are mainly oriented to controllers or sensors, this method can be applied to larger, complex, and cross-network sensor cluster control and data acquisition scenario solutions, that is, the edge sensor control and data acquisition unit is only responsible for raw data collection, and the data center server obtains data through virtual bus technology and performs general driver analysis. Therefore, this method has high versatility.

[0077] A device control method provided by the present application is applied to a first control unit of a main component, the first control unit sends a request message to a second control unit of a target slave component through a first virtual bus driver, so that the second control unit of the target slave component receives the request message through the second virtual bus driver, and controls the target slave device corresponding to the request message through the second virtual bus driver to obtain a response message from the target slave device, the first control unit of the main component receives the response message of the target slave device sent by the second control unit through the second virtual bus driver through the first virtual bus driver, so that the main component realizes direct management of the slave device of the slave component through the driver level, without having to care about the function of the slave device, and without having to perform encapsulation, decapsulation, etc. at the application level, the main component can directly perform command operation access based on the LINUX standard driver in the user state, thereby improving the efficiency and versatility of communication, and at the same time, at the user state level, the upper-layer business basically does not perceive the change or difference, is completely decoupled from the upper-layer business module, has high independence, and is conducive to the management and maintenance of the distributed system.

[0078] Furthermore, in the above Figure 4 Based on the device control method shown, the embodiment of the present application also provides another implementation method of the device control method. Optionally, the request message includes: a target bus identifier, which is the I2C bus number of the target slave component, used to determine the target slave component corresponding to the request message.

[0079] The method S401, before sending the request message to the second control unit of the target slave component through the first virtual bus driver, further includes:

[0080] Determine the target slave component based on the target bus identifier.

[0081] Before the master component controls the target slave device in the target slave component by sending and receiving messages, it is necessary to determine to which slave component the request message should be sent. Therefore, before sending the request message, it is necessary to first determine the target slave component based on the target bus identifier in the request message, and then the request can be sent to the second control unit of the target slave component through the first virtual bus driver.

[0082] Each bus identifier can identify a unique bus, and in the embodiment of the present application, the bus is an I2C bus with a physical structure. For example, the target bus identifier can be an identifier of an I2C bus in a target slave component for connecting to a target slave device.

[0083] The first control unit may pre-store the correspondence between the bus identifier and the slave component. In the embodiment of the present application, if each slave component has only one physical I2C bus, the I2C bus identifier and the slave component are in a one-to-one correspondence. If each slave component has multiple physical I2C buses, the corresponding only slave component can be determined according to the I2C bus identifier.

[0084] An embodiment of the present application provides a device control method, in which a request message includes: a target bus identifier. Before the request message is sent to the second control unit of the target slave component through the first virtual bus driver, the target slave component is determined based on the target bus identifier, and then a request message can be sent to the target slave device to control the target slave device in the target slave component.

[0085] Furthermore, based on the above embodiment, the embodiment of the present application also provides another implementation method of the device control method. Optionally, the above method S401, before sending the request message to the second control unit of the target slave component through the first virtual bus driver, further includes:

[0086] In response to the service operation, the encapsulation request message is driven by the first virtual bus.

[0087] The first virtual bus driver responds to the service operation of the upper layer service module and encapsulates the information of the control target slave component, target slave device and the like corresponding to the service operation into a request message. In the embodiment of the present application, the request message is a UDP message, specifically, an L4-UDP message.

[0088] Optionally, when the first virtual bus driver can implement a standard I2C read / write hook function through message reception and transmission, the I2C read / write hook function is encapsulated in a request message.

[0089] The request message includes: message payload format, destination port and source port.

[0090] Among them, the message payload format may include: I2C bus number (target bus identifier), command type, device address, command parameters, among which the command parameters may include: offset, length, device internal data, etc. The command type can be a read command or a write command, and the device address is the address information of the target slave device.

[0091] The source port can be a HASH value of the I2C bus number, command type, device address, command parameters, etc. in the payload part of the message. The hash-based VXLAN inner layer message can support load balancing through the source port in the case of multiple Ethernet links (there are multiple Ethernet channels between the master component and the target slave component).

[0092] The destination port may be a fixed special value, which represents the type of the virtual bus, such as a virtual I2C bus, to ensure that the virtual I2C bus driver can listen to and receive UDP messages.

[0093] The sending and receiving of UDP messages between the master component and the slave device can be achieved through the source port, destination port and message payload format.

[0094] A device control method provided by an embodiment of the present application, before sending a request message to a second control unit of a target slave component through a first virtual bus driver, the first control unit responds to a business operation and encapsulates the request message through the first virtual bus driver, so that the request message includes a source port, a destination port and a message payload format, thereby realizing the sending of the request message.

[0095] Furthermore, in the above Figure 4 Based on the device control method shown, the embodiment of the present application also provides another method for implementing the device control method. Optionally, the method further includes:

[0096] The response message is parsed by the first virtual bus driver to obtain the internal data of the device.

[0097] After receiving the response message of the target slave device sent by the second control unit through the second virtual bus driver through the first virtual bus driver, the first virtual bus driver parses the UDP response message and extracts the internal data of the device. The internal data of the device can be the register data of the device, which is used by the LINUX kernel standard driver of the device, and the LINUX kernel standard driver is responsible for parsing and processing.

[0098] The upper layer service module can obtain the relevant information after parsing from the LINUX kernel standard driver through a standard interface or command.

[0099] Specifically, if the upper-layer business operation needs to read the relevant information of the target slave device, after the target slave component receives and parses the request message, it can initiate a call to the standard open read access interface to read the relevant information of the target slave device. After the information is read, it is encapsulated into a response message. After the main component receives the response message, it parses the internal data of the target slave device. The upper-layer business module can obtain the relevant information after parsing from the LINUX kernel standard driver through a standard interface or command to complete the information reading of the target slave device.

[0100] A device control method provided in an embodiment of the present application parses a UDP response message through a first virtual bus driver to obtain internal data of the device, so that an upper-layer business module can obtain relevant information after parsing from a LINUX kernel standard driver through a standard interface or command to complete information docking with the upper-layer business module.

[0101] On the basis of the above-mentioned embodiments, a device control method is further provided in the solution of the present application. The device control method provided in the embodiment of the present application is explained as follows through a specific example. Figure 5 A schematic diagram of a device control method provided in an embodiment of the present application. Figure 5 As shown, this method is applied to the above Figure 3 The second control unit of any slave component in the distributed system shown, the distributed system also includes: a master component, the first control unit in the master component is communicatively connected to the second control unit in the slave component. In an embodiment of the present application, the first control unit and the second control unit are communicatively connected via an Ethernet bus. The method includes:

[0102] S501: Receive, through a second virtual bus driver, a request message sent by a first control unit through a first virtual bus driver.

[0103] The second control unit receives the request message sent by the first control unit through the first virtual bus driver through the second virtual bus driver. In the distributed system, the request message is initiated by the first virtual bus driver in the master component, and the second virtual bus driver in the slave component cannot actively initiate a request, but can only respond to the request message sent by the master component, that is, the second virtual bus driver in the slave component can only send a response message of the request message to the first virtual bus driver in the master component, therefore, the second virtual bus driver in the slave component can also be called a second virtual bus proxy driver.

[0104] S502 , controlling the target slave device corresponding to the request message through the second virtual bus driver, and obtaining a response message from the target slave device.

[0105] After the second virtual bus driver receives the request message sent by the first control unit through the first virtual bus driver, it controls the corresponding target slave device according to the request message. The control may be to read the relevant information of the target slave device or to write part of the data into the target slave device. After the execution is completed, the response message of the target slave device is obtained.

[0106] For example, if the request message is a read request operation, the response message includes the read data of the target slave device and other parameters.

[0107] S503: Send a response message of the target slave device to the first control unit through the second virtual bus driver.

[0108] The first control unit receives the response message through the first virtual bus driver, and then parses the response message to obtain the internal data of the device.

[0109] A device control method provided by the present application is applied to a second control unit in a slave device, wherein the second control unit receives a request message sent by the first control unit through the first virtual bus driver through the second virtual bus driver, controls the target slave device corresponding to the request message through the second virtual bus driver, obtains a response message of the target slave device, and sends the response message of the target slave device to the first control unit through the second virtual bus driver, so that the first control unit receives the response message through the first virtual bus driver, and the master device reads and writes the slave device according to the I2C standard, which is only related to the I2C bus access protocol. The second control unit in the slave component does not need to perceive the function and logic of the slave device, because at the driver level, it is only necessary to read and write the target slave device according to the information in the request message, and the transmitted message is a message based on the I2C standard bus, and there is no need to encapsulate or decapsulate at the application layer, thereby improving the efficiency and versatility of communication, simplifying the complexity of distributed system design, and improving system stability and maintainability.

[0110] Furthermore, in the above Figure 5 Based on the device control method shown, the embodiment of the present application also provides another implementation method of the device control method. Optionally, Figure 6 A schematic diagram of another device control method provided in an embodiment of the present application. Figure 6 As shown, the method S502, through the second virtual bus driver, controls the target slave device corresponding to the request message to obtain the response message of the target slave device, including:

[0111] S601, decapsulate the request message through the second virtual bus driver to obtain request data.

[0112] The message transmission and reception of the second virtual bus driver is based on the kernel socket communication mechanism and uses the UDP (User Datagram Protocol) protocol.

[0113] The second virtual bus driver decapsulates the UDP request message and extracts request data, which may include: command type, command parameters, etc.

[0114] S602 , driving through the second virtual bus, according to the request data, controlling the target slave device corresponding to the request data, and obtaining response data of the target slave device.

[0115] Specifically, the request data includes: command type, command parameters, and the second virtual bus driver controls the target slave device to perform data operations corresponding to the command type according to the command parameters. The command type is a read command or a write command, and the command parameters include information such as offset, length, and device internal data.

[0116] The second virtual bus driver initiates read and write data access to the target slave device corresponding to the request data through the kernel standard I2C read or write function according to the request data to obtain response data of the target slave device, and the response data may be internal data of the device.

[0117] S603: Encapsulate the response data through the second virtual bus driver to generate a response message.

[0118] The second virtual bus driver encapsulates the response data and other information to obtain a response message, which is a response of the target slave component to the request message.

[0119] A device control method provided in an embodiment of the present application decapsulates a request message through a second virtual bus driver to obtain request data, controls a target slave device corresponding to the request data through the second virtual bus driver according to the request data, obtains response data of the target slave device, encapsulates the response data through the second virtual bus driver to generate a response message, and then sends the response message to a main component, thereby realizing direct access of the main component to the target slave device in the target slave component.

[0120] Furthermore, in the above Figure 6 Based on the device control method shown, the embodiment of the present application also provides another method for implementing the device control method. Optionally, the request data includes: a target bus identifier and a device address. In the above method S502, the target slave device corresponding to the request message is controlled by the second virtual bus driver. Before obtaining a response message from the target slave device, the method further includes:

[0121] Determine the target slave device based on the target bus identification and device address.

[0122] Before controlling the target slave device, the slave component needs to determine which target slave device needs to be controlled according to the request data. Therefore, the target slave component needs to be determined first according to the target bus identifier and device address in the request data.

[0123] The target bus identifier is used to determine the corresponding bus, and the device address is used to determine the target slave device on the bus. In the embodiment of the present application, if the slave component contains multiple I2C buses, the target bus identifier is used to determine the only corresponding I2C bus in the slave component as the target I2C bus. On this basis, the only corresponding slave device on the I2C bus can be determined as the target slave device through the device address.

[0124] Therefore, the second virtual bus driver initiates read and write data access to the target slave device determined by the target I2C bus and the device address through the kernel standard I2C read or write function according to the request data to obtain response data of the target slave device.

[0125] A device control method provided by an embodiment of the present application, wherein request data includes: a target bus identifier, a device address, and a target slave device corresponding to the request message is controlled through a second virtual bus driver. Before obtaining a response message from the target slave device, the target slave device is determined based on the target bus identifier and the device address, and data access to the target slave device can be initiated.

[0126] The following is a description of a device control apparatus provided by the present application for execution. The specific implementation process and technical effects thereof are as mentioned above and will not be repeated below.

[0127] Figure 7 A schematic diagram of a device control device provided in an embodiment of the present application, such as Figure 7 As shown, the device control device includes:

[0128] The first sending module 701 is used to send a request message to the second control unit of the target slave component through the first virtual bus driver, so that the second control unit of the target slave component receives the request message through the second virtual bus driver, and controls the target slave device corresponding to the request message through the second virtual bus driver to obtain a response message from the target slave device.

[0129] The first receiving module 702 is configured to receive, through the first virtual bus driver, a response message from a target slave device that is sent by the second control unit through the second virtual bus driver.

[0130] Optionally, the first sending module 701 is further configured to request that the message include: a target bus identifier; and before sending the request message to the second control unit of the target slave component through the first virtual bus driver, further include: determining the target slave component according to the target bus identifier.

[0131] Optionally, the first sending module 701 is further configured to respond to a service operation and drive an encapsulation request message through the first virtual bus.

[0132] The parsing module 703 is used to parse the response message through the first virtual bus driver to obtain the internal data of the device.

[0133] Figure 8 A schematic diagram of a device control device provided in an embodiment of the present application, such as Figure 8 As shown, the device control device includes:

[0134] The second receiving module 801 is configured to receive, through the second virtual bus driver, a request message sent by the first control unit through the first virtual bus driver.

[0135] The control module 802 is used to control the target slave device corresponding to the request message through the second virtual bus driver, and obtain the response message of the target slave device.

[0136] The second sending module 803 is used to send a response message of the target slave device to the first control unit through the second virtual bus driver, so that the first control unit receives the response message through the first virtual bus driver.

[0137] The control module 802 is specifically used to decapsulate the request message through the second virtual bus driver to obtain request data; control the target slave device corresponding to the request data according to the request data through the second virtual bus driver to obtain response data of the target slave device; and encapsulate the response data through the second virtual bus driver to generate a response message.

[0138] The control module 802 is also used to request data including: target bus identifier, device address, and control the target slave device corresponding to the request message through the second virtual bus driver. Before obtaining the response message of the target slave device, it also includes: determining the target slave device according to the target bus identifier and the device address.

[0139] The control module 802 is specifically used to request data further including: a command type and command parameters; and controls the target slave device to perform data operations corresponding to the command type according to the command parameters through the second virtual bus driver.

[0140] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0141] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0142] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for causing the component to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (English: Read-Only Memory, referred to as: ROM), a random access memory (English: Random Access Memory, referred to as: RAM), a disk or an optical disk, and other media that can store program codes.

[0143] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A device control method, characterized in that: A first control unit applied to a master component in a distributed system, the distributed system further comprising: at least one slave component, each slave component comprising: a second control unit and at least one slave device, the first control unit being communicatively connected with the second control unit in each slave component; the method comprising: Sending a request message to a second control unit of a target slave component through a first virtual bus driver, so that the second control unit of the target slave component receives the request message through a second virtual bus driver, and controls the target slave device corresponding to the request message through the second virtual bus driver to obtain a response message from the target slave device, wherein the virtual bus points to a bus of a slave component; A response message of the target slave device sent by the second control unit through the second virtual bus driver is received through the first virtual bus driver.

2. The device control method according to claim 1, characterized in that: The request message includes: a target bus identifier; Before the request message is sent to the second control unit of the target slave component through the first virtual bus driver, the method further includes: The target slave component is determined according to the target bus identifier.

3. The device control method according to claim 1 or 2, characterized in that: Before sending the request message to the second control unit of the target slave component through the first virtual bus driver, the method further includes: In response to the service operation, the request message is encapsulated through the first virtual bus driver.

4. The device control method according to claim 1, characterized in that: The method further comprises: The response message is parsed by the first virtual bus driver to obtain device internal data.

5. A device control method, characterized in that: A second control unit applied to any slave component in a distributed system, the distributed system further comprising: a master component, the first control unit in the master component being communicatively connected with the second control unit in the slave component; the method comprising: Receiving, by means of a second virtual bus driver, a request message sent by the first control unit through the first virtual bus driver, wherein the second virtual bus driver is pre-integrated in the second control unit; By driving the second virtual bus, the target slave device corresponding to the request message is controlled to obtain a response message from the target slave device; The response message of the target slave device is sent to the first control unit through the second virtual bus driver, so that the first control unit receives the response message through the first virtual bus driver.

6. The device control method according to claim 5, characterized in that: The controlling, through the second virtual bus driving, the target slave device corresponding to the request message and obtaining a response message from the target slave device comprises: Decapsulating the request message through the second virtual bus driver to obtain request data; By driving the second virtual bus, according to the request data, the target slave device corresponding to the request data is controlled to obtain response data of the target slave device; The response data is encapsulated by the second virtual bus driver to generate the response message.

7. The device control method according to claim 6, characterized in that: The request data includes: a target bus identifier and a device address. Before the second virtual bus driver controls the target slave device corresponding to the request message and obtains a response message from the target slave device, the method further includes: The target slave device is determined according to the target bus identifier and the device address.

8. The device control method according to claim 6, characterized in that: The request data further includes: a command type and command parameters; the driving through the second virtual bus, according to the request data, controlling the target slave device corresponding to the request data, includes: The target slave device is controlled to perform data operations corresponding to the command type according to the command parameters through the second virtual bus driver.

9. A distributed system, characterized in that: comprising a master component and at least one slave component, the master component being communicatively connected with each of the slave components; The main component comprises a first control unit and at least one main device; A first virtual bus driver is pre-integrated in the first control unit, and the first control unit is used to execute the device control method executed by the first virtual bus driver according to any one of claims 1 to 4 through the first virtual bus driver.

10. A distributed system, characterized in that: The method comprises a master component and at least one slave component, wherein the master component is communicatively connected with each of the slave components, and each of the slave components comprises a second control unit and at least one slave device; A second virtual bus driver is pre-integrated in the second control unit, and the second control unit is used to execute the device control method executed by the second virtual bus driver according to any one of claims 5 to 8 through the second virtual bus driver.