A universal serial bus device function drive control method and product
By obtaining and updating the configuration information and function drivers of the universal serial bus device in the substrate management controller, the problem of difficulty in dynamic loading and unloading of USB Gadget driver functions in BMC is solved, and flexible functions are achieved and hardware costs are reduced.
Patent Information
- Application Number
- CN202411140009.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-08-20
AI Technical Summary
In the Baseboard Management Controller (BMC), there are difficulties in dynamically loading or unloading each USB Gadget driver feature, resulting in increased hardware costs.
By obtaining the configuration information of the target universal serial bus device, determining its target function, and adding corresponding function drivers to the driver function link list, updating the driver function link list in response to loading or unloading operations, enabling the universal serial bus device controller to achieve Dynamic loading or unloading functions.
Dynamic loading or unloading driven by USB device functions based on a single USB device controller is realized, reducing the hardware cost of BMC.
Smart Images

Figure CN118656132B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of computers, and in particular, to a universal serial bus device function drive control method and product. Background Art
[0002] The Baseboard Management Controller (BMC) can virtualize the mouse, keyboard, network card, and virtual media devices through KVM technology, which can improve the operation and maintenance efficiency of the server.
[0003] BMC usually provides a USB (Universal Serial Bus) connection interface to the host to implement the USB device function. The USB device function means that the board can be used as a USB device after being driven. The function of USBDevice depends on the installation and configuration of its driver. In the actual implementation process, a USB device can have multiple functions. With the rich usage scenarios of BMC's KVM technology and virtual media functions, the functions of these USB devices also need to be flexibly loaded and unloaded.
[0004] The USB device controller, or UDC, is responsible for attaching a USB device to a USB host controller. However, when the BMC includes only one UDC, all USB device driver functions are mounted under the same UDC at the same time, making it difficult to dynamically load or unload the functions of each USB gadget driver.
[0005] The current solution is to integrate a virtual hub of USB hardware in the BMC, which supports 1 hub device port and N downstream device ports. The BMC's USB driver can enumerate a Hub function, and the Hub's N downstream ports can enumerate multiple UDC functions. Each USB device driver function can be mounted on a UDC, and then by controlling the enabling and disabling of each UDC, each USB device driver function can be loaded and unloaded separately. However, this method of integrating a virtual hub in an integrated BMC will increase costs. Summary of the invention
[0006] The embodiments of the present application provide a universal serial bus device function drive control method and product, aiming to reduce the hardware cost of the BMC.
[0007] In a first aspect, an embodiment of the present application provides a universal serial bus device function drive control method, which is applied to a baseboard management controller, and the method includes:
[0008] After startup, obtain the configuration information of the target universal serial bus device;
[0009] According to the configuration information of the target universal serial bus device, determine that a function driver corresponding to a target function of the target universal serial bus device is added to a driver function linked list, wherein the driver function linked list is used by a host to enumerate the target functions of the target universal serial bus device;
[0010] In response to a loading operation or an unloading operation for any target function of the target universal serial bus device, the universal serial bus device controller in the baseboard management controller is stopped, the driver function linked list is updated to obtain an updated driver function linked list, and the universal serial bus device controller is enabled so that the host re-enumerates the target functions of the target universal serial bus device after loading or unloading according to the updated driver function linked list.
[0011] Optionally, after startup, the configuration information of the target universal serial bus device is obtained, including:
[0012] According to the current service, the configuration information of the target universal serial bus device is determined, wherein the configuration information includes the configuration of the target function of the target universal serial bus device and the interface identifier corresponding to the target function.
[0013] Optionally, after startup, the configuration information of the target universal serial bus device is obtained, including:
[0014] In response to a function selection operation of a user, configuration information of the target universal serial bus device is determined, wherein the configuration information includes a configuration of a target function of the target universal serial bus device and an interface identifier corresponding to the target function.
[0015] Optionally, determining, according to the configuration information of the target universal serial bus device, that a function driver corresponding to a target function of the target universal serial bus device is added to a driver function linked list includes:
[0016] According to the first configuration information of the target universal serial bus device, a human-machine interface device driver is used as a function driver corresponding to the target function of the target universal serial bus device and is added to the driver function linked list.
[0017] Optionally, determining, according to the configuration information of the target universal serial bus device, that a function driver corresponding to a target function of the target universal serial bus device is added to a driver function linked list includes:
[0018] According to the second configuration information of the target universal serial bus device, a memory driver is used as a function driver corresponding to the target function of the target universal serial bus device and is added to the driver function linked list.
[0019] Optionally, determining, according to the configuration information of the target universal serial bus device, that a function driver corresponding to a target function of the target universal serial bus device is added to a driver function linked list includes:
[0020] According to the third configuration information of the target universal serial bus device, a network device driver is used as a function driver corresponding to the target function of the target universal serial bus device and is added to the driver function linked list.
[0021] Optionally, after determining, according to the configuration information of the target universal serial bus device, that a function driver corresponding to the target function of the target universal serial bus device is added to the driver function linked list, the method further comprises:
[0022] For a function driver corresponding to any target function in the driver function chain list, an interface configuration data structure is added to the function driver corresponding to the target function, wherein the interface configuration data structure includes each interface identifier corresponding to the target function.
[0023] Optionally, in response to a loading operation or an unloading operation for any function of the target universal serial bus device, stopping the universal serial bus device controller in the baseboard management controller, updating the driver function linked list to obtain an updated driver function linked list, and enabling the universal serial bus device controller, including:
[0024] In response to a loading operation of any target function, stopping a universal serial bus device controller in the baseboard management controller;
[0025] Get the configuration information corresponding to the target function to be loaded;
[0026] According to the configuration information corresponding to the target function to be loaded, the function driver corresponding to the target function to be loaded is added to the driver function linked list to obtain the updated driver function linked list;
[0027] The universal serial bus device controller is enabled so that the host loads the target function to be loaded of the target universal serial bus device after re-enumeration according to the updated driver function linked list.
[0028] Optionally, according to the configuration information corresponding to the target function to be loaded, after adding the function driver corresponding to the target function to be loaded to the driver function linked list and obtaining the updated driver function linked list, the method further includes:
[0029] According to the configuration information corresponding to the target function to be loaded, an interface configuration data structure is added in the driver function linked list for the function driver corresponding to the target function to be loaded, wherein the interface configuration data structure includes each interface identifier corresponding to the target function to be loaded.
[0030] Optionally, in response to a loading operation of any target function, stopping a universal serial bus device controller in the baseboard management controller includes:
[0031] In response to a load operation for any target function of the target USB device, stop configuration information is sent to a register of the USB device controller, wherein the stop configuration information is used to cause the USB device controller to stop pulling up a data positive line corresponding to the target USB device.
[0032] Optionally, enabling the universal serial bus device controller includes:
[0033] When the updated driver function linked list is detected, enable configuration information is sent to the register of the universal serial bus device controller, and the enable configuration information is used to enable the universal serial bus device controller to pull up the data positive line corresponding to the target universal serial bus device.
[0034] Optionally, in response to a load operation or an unload operation for any target function of the target universal serial bus device, stopping the universal serial bus device controller in the baseboard management controller, updating the driver function linked list to obtain an updated driver function linked list, and enabling the universal serial bus device controller, including:
[0035] In response to an uninstallation operation of any target function, stopping a universal serial bus device controller in the baseboard management controller and determining a target function to be uninstalled;
[0036] Deleting the function driver corresponding to the target function to be uninstalled from the driver function chain list to obtain an updated driver function chain list;
[0037] The universal serial bus device controller is enabled so that the host can unload the target function to be loaded of the target universal serial bus device after re-enumeration according to the updated driver function linked list.
[0038] Optionally, after deleting the function driver corresponding to the target function to be uninstalled from the driver function linked list, the method further includes:
[0039] In the driver function linked list, the interface configuration data structure of the function driver corresponding to the target function to be uninstalled is deleted.
[0040] Optionally, stopping a universal serial bus device controller in the baseboard management controller includes:
[0041] In response to an uninstall operation on any target function of the target USB device, stop configuration information is sent to a register of the USB device controller, wherein the stop configuration information is used to cause the USB device controller to stop pulling up a data positive line corresponding to the target USB device.
[0042] Optionally, enabling the universal serial bus device controller includes:
[0043] When the updated driver function linked list is detected, enable configuration information is sent to the register of the universal serial bus device controller, and the enable configuration information is used to enable the universal serial bus device controller to pull up the data positive line corresponding to the target universal serial bus device.
[0044] Optionally, in response to a load operation or an unload operation for any target function of the target universal serial bus device, stopping a universal serial bus device controller in the baseboard management controller, the method further comprises:
[0045] In response to a load operation or an unload operation for any target function of the target universal serial bus device, monitoring a data transmission state of the target universal serial bus device;
[0046] When the target universal serial bus device is in a data transmission state, after monitoring that the target universal serial bus device completes current data transmission, the universal serial bus device controller in the baseboard management controller is stopped.
[0047] In a second aspect, an embodiment of the present application provides a server, the server comprising a baseboard management controller and a host, the baseboard management controller comprising a universal serial bus device controller, the baseboard management controller being used to execute the universal serial bus device function drive control method described in the first aspect of the embodiment.
[0048] In a third aspect, an embodiment of the present application provides a computer device, comprising: at least one processor, and a memory, wherein the memory stores a computer program that can be run on the processor, wherein when the processor executes the computer program, the universal serial bus device function drive control method described in the first aspect of the embodiment is executed.
[0049] In a fourth aspect, an embodiment of the present application provides a non-volatile readable storage medium, wherein the non-volatile readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the universal serial bus device function drive control method described in the first aspect of the embodiment is executed.
[0050] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the universal serial bus device function drive control method described in the first aspect of the embodiment.
[0051] Beneficial effects:
[0052] The method is applied to a baseboard management controller, which obtains configuration information of a target universal serial bus device after startup; according to the configuration information of the target universal serial bus device, determines that a function driver corresponding to a target function of the target universal serial bus device is added to a driver function linked list, and the driver function linked list is used by a host to enumerate the target functions of the target universal serial bus device, and then a universal serial bus controller on the host side enumerates the functions of the target universal serial bus device according to the driver function linked list.
[0053] In response to a loading operation or an unloading operation for any target function of the target universal serial bus device, the universal serial bus device controller in the baseboard management controller is stopped, the driver function linked list is updated to obtain an updated driver function linked list, and the universal serial bus device controller is enabled so that the host re-enumerates the target function of the target universal serial bus device after loading or unloading according to the updated driver function linked list, so that the function driver of the USB device can be dynamically loaded or unloaded based on a USB device controller, and compared with the method of integrating a virtual hub in the BMC, the hardware cost of the BMC can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art.
[0055] Figure 1 A flowchart showing the steps of a universal serial bus device function drive control method provided by an embodiment of the present application is shown;
[0056] Figure 2 A schematic diagram of a drive function chain table provided in an embodiment of the present application is shown;
[0057] Figure 3 A diagram showing the execution steps of a loading function driver provided in an embodiment of the present application is shown;
[0058] Figure 4 A diagram showing the execution steps of the uninstall function driver provided in an embodiment of the present application is shown;
[0059] Figure 5 A schematic diagram of a server provided in an embodiment of the present application is shown;
[0060] Figure 6 A functional module diagram of a universal serial bus device function drive control device provided by an embodiment of the present application is shown;
[0061] Figure 7 A schematic diagram of a computer device provided in an embodiment of the present application is shown;
[0062] Figure 8 A schematic diagram of a non-volatile readable storage medium provided in an embodiment of the present application is shown;
[0063] Fig. 9 A schematic diagram of a computer program product provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0064] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0065] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, each embodiment of the present application will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in each embodiment of the present application, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can also be implemented. The division of the following embodiments is for the convenience of description, and the specific implementation of the present application should not constitute any limitation, and the various embodiments can be combined with each other and referenced to each other without contradiction.
[0066] CPU: Central Processing Unit, central processing unit;
[0067] Linux: The full name is GNU / Linux, which is a Unix-like operating system that can realize multi-user, multi-tasking, multi-threading and multi-CPU operating system;
[0068] OS: Operating System, which is the core software in the computer system. It is responsible for managing and controlling the computer's hardware and software resources and providing an efficient operating environment for users and applications.
[0069] BMC: Baseboard Management Controller, an embedded computer subsystem, usually integrated into servers, network equipment, and industrial control systems, responsible for managing and monitoring hardware resources and providing remote management capabilities;
[0070] USB: Universal Serial Bus, is a serial bus standard and also a technical specification for input and output interfaces.
[0071] UDC: USB Device Controller, USB device controller;
[0072] USB Gadget: USB device driver, which can be configured according to USB specifications and device types to make it a variety of general USB devices, such as keyboard, mouse (HID Class), U disk (Mass Storage) and network card (CDCEthernet);
[0073] BMC can virtualize mouse, keyboard, network card and virtual media devices through KVM technology. BMC usually provides a USB connection interface to the host Host to realize the USB Device function. The USB Device function means that after the driver is installed, the board can be used as a USB mobile device, similar to a USB flash drive. The function of USB Device depends on the installation and configuration of its driver. When the device is correctly identified and the corresponding driver is installed, it can be connected to the computer as a mobile device to read and write data, including but not limited to data transmission, audio transmission, video transmission, etc., so that external devices can interact with the computer conveniently, expand the computer's functions and improve its ease of use. For example, a commonly used smartphone, when it is connected to a computer and works in device mode, the smartphone can be regarded as a USB flash drive, and the computer can operate the storage space of the phone.
[0074] Specifically, the USB connection interface provided by BMC to the host Host can enumerate different external devices on the Host side through the USB device driver, including HID devices, Mass Storage devices and CDC devices. HID devices include keyboards and mice, etc.; Mass Storage devices such as CD-Rom and HD-Disk; CDC devices such as network cards; These devices are used to support necessary BMC functions such as KVM and virtual media. A USB device can have multiple functions, and with the rich usage scenarios of BMC's KVM technology and virtual media functions, these USB device functions also need to be flexibly loaded and unloaded.
[0075] The Linux system driver framework provides the Configfs function to flexibly configure and load USB device drivers (USBGadget drivers). USB device drivers, namely USB Gadget drivers, include two major parts: UDC drivers and function drivers, namely Gadget Function drivers. The UDC driver is responsible for data transmission between the UDC and the host-side USB controller; the GadgetFunction driver is responsible for the device's functions. For example, if a USB device is used as a U disk and file storage function is required, a File Storage driver is required, which is also called a Function driver.
[0076] UDC is responsible for attaching a USB device to a USB host controller. However, when the BMC includes only one UDC, all USB device driver functions are mounted under the same UDC, which makes it difficult to dynamically load or unload the functions of each USBGadget driver.
[0077] The current solution is to integrate the virtual hub function of USB hardware in BMC. Virtual Hub supports 1 hub device port and N downstream device ports. The USB driver of BMC can enumerate a Hub function, and the N downstream ports of Hub can enumerate multiple UDC functions. Then, the function of each USB device driver can be mounted on a UDC. Then, by controlling the enabling and disabling of each UDC, the function driver of each USB device can be loaded and unloaded separately. However, this method of integrating the virtual hub in the integrated BMC will increase the cost.
[0078] Therefore, in order to reduce the hardware cost of the BMC, an embodiment of the present application provides a USB device function driver control method.
[0079] Reference Figure 1 , shows a flowchart of a method for controlling a function drive of a universal serial bus device provided in an embodiment of the present application, the method is applied to a baseboard management controller, and the method may include the following steps:
[0080] S101: After startup, obtain configuration information of the target universal serial bus device.
[0081] The configuration of any target USB device, that is, how to use the target USB device, can be a custom setting in the functions of the target USB. For example, the target USB device A can be used as a storage device, or as a human-machine interface device such as a mouse.
[0082] When a baseboard management controller (BMC) is in a system, such as after a server is started, the BMC obtains configuration information of a target USB device, and determines a function driver of a target function that needs to be loaded by the target USB device according to the configuration information of the target USB device.
[0083] In a feasible implementation manner, obtaining the configuration information of the target USB device includes: determining the configuration information of the target USB device according to the current service, wherein the configuration information includes the configuration of the target function of the target USB device and the interface identifier corresponding to the target function.
[0084] In another feasible implementation, obtaining the configuration information of the target USB device includes: responding to a function selection operation of the user, determining the configuration information of the target USB device, wherein the configuration information includes the configuration of the target function of the target USB device and an interface identifier corresponding to the target function.
[0085] That is, the BMC can determine the configuration information of the target USB device according to the current business executed by the system, so that the function of the target USB device can meet the business requirements of the system, and the user can also customize the function of the target USB device to be used.
[0086] A USB device consists of three parts: configuration, interface, and endpoint. Usually, a configuration of a USB device consists of multiple interfaces. An interface represents a function. An interface can contain multiple interface settings. Each interface setting contains ports related to the implementation of a certain function. A USB device can extend multiple functions through interfaces.
[0087] Therefore, the configuration information of the target USB device includes the interface identifier corresponding to the target function, namely InterfaceId. When the host enumerates, InterfaceId can specifically describe the functional details of the target USB device, and the USB controller on the host side will also use Interface to specifically enumerate the Gadget function.
[0088] S102: According to the configuration information of the target universal serial bus device, determine that a function driver corresponding to a target function of the target universal serial bus device is added to a driver function linked list, wherein the driver function linked list is used by a host to enumerate the target functions of the target universal serial bus device.
[0089] When the BMC has only one USB device controller, namely, UDC, the BMC will adopt the mode of USB device function composite driver, namely, USB Gadget composite driver, and then determine the function drivers corresponding to one or more target functions that the target USB device needs to load according to the configuration information of the target USB device, and add the function drivers corresponding to the one or more target functions to the driver function linked list, namely, Gadget Function linked list.
[0090] In a feasible implementation, according to the configuration information of the target USB device, determining that a function driver corresponding to the target function of the target USB device is added to a driver function linked list includes: according to the first configuration information of the target USB device, using a human-machine interface device driver as a function driver corresponding to the target function of the target USB device, and adding it to the driver function linked list.
[0091] When the target USB device is the first configuration information, the target USB device can be used as a device that directly interacts with people, and the corresponding function driver of the target USB device is added to the driver function chain list as a human-machine interface device driver, namely, a HID driver.
[0092] In a feasible implementation, according to the configuration information of the target USB device, determining that a function driver corresponding to the target function of the target USB device is added to a driver function linked list includes: according to the second configuration information of the target USB device, using a memory driver as a function driver corresponding to the target function of the target USB device, and adding it to the driver function linked list.
[0093] When the target USB device is the second configuration information, the target USB device can be used as a storage device, and the corresponding function driver of the target USB device is added to the driver function linked list as a storage driver, namely, a Mass Storage driver.
[0094] In a feasible implementation, according to the configuration information of the target USB device, determining that the function driver corresponding to the target function of the target USB device is added to the driver function linked list includes: according to the third configuration information of the target USB device, using the network device driver as the function driver corresponding to the target function of the target USB device, and adding it to the driver function linked list.
[0095] When the target USB device is the third configuration information, the target USB device can be used as a network card device, and the corresponding function driver of the target USB device is added to the driver function chain list as a network device driver, namely, a CDC Ethernet driver.
[0096] In other embodiments, if a target USB device can simultaneously function as a device that directly interacts with humans, a storage device, or a network card device, a configuration file can be customized by the user, and some or all of the human-machine interface device drivers, storage drivers, and network device drivers can be added to the driver function list to effectively utilize the rich functions of the target USB device.
[0097] After one or more function drivers of the target USB device are added to the target USB device driver function list, UDC is enabled to allow the host side to detect or sense the target USB device. When the host detects the target USB device, it will enumerate the one or more function drivers added to the driver function list, i.e., the Gadget Function list, by the USB device function composite driver.
[0098] Furthermore, since the interface identifier, i.e., Interface Id, corresponds to the target function of the target USB device, when the host performs enumeration, the host can be provided with detailed function information that specifically describes the target USB device. The USB controller on the host side will also use Interface to specifically enumerate the Gadget function. Therefore, for the function driver corresponding to any target function in the driver function list, an interface configuration data structure can be added for the function driver corresponding to the target function, and the interface configuration data structure includes each interface identifier corresponding to the target function.
[0099] Reference Figure 2 , shows a schematic diagram of a driver function linked list provided by an embodiment of the present application, in the universal serial bus device function composite driver of the BMC, including the configuration of the target universal serial bus device, namely, Configuration, the driver function linked list includes function drivers according to three target functions of the target universal serial bus device, including: human-machine interface device driver, storage driver and network device driver, and the interface identifier corresponding to the human-machine interface device function, namely, Interface Id, includes: interface identifier 0 and interface identifier 1; the interface identifier corresponding to the storage device function, namely, Interface Id, includes: interface identifier 0; the interface identifier corresponding to the network card device function, namely, Interface Id, includes: interface identifier 0 and interface identifier 1; the interface identifier is an identifier added to the interface corresponding to the function driver of any function, and the interface identifier 0 corresponding to the human-machine interface device function and the interface identifier 0 corresponding to the storage device function actually correspond to different interfaces.
[0100] S103: In response to a loading operation or an unloading operation for any target function of the target universal serial bus device, the universal serial bus device controller in the baseboard management controller is stopped, the driver function linked list is updated to obtain an updated driver function linked list, and the universal serial bus device controller is enabled so that the host re-enumerates the target functions of the target universal serial bus device after loading or unloading according to the updated driver function linked list.
[0101] Reference Figure 3 , shows an execution step diagram of loading a function driver provided by an embodiment of the present application. In a feasible implementation, dynamically loading a function driver of a target universal serial bus device includes the following steps:
[0102] A1: In response to a loading operation of any target function, stopping a universal serial bus device controller in the baseboard management controller.
[0103] Specifically, the process of stopping the USB device controller in the baseboard management controller includes:
[0104] In response to a loading operation for any target function of the target USB device, stop configuration information is sent to a register of the USB device controller, wherein the stop configuration information is used to instruct the USB device controller to stop pulling up a data positive line corresponding to the target USB device.
[0105] That is, by configuring the UDC register, UDC is disabled from pulling up the D+ pin corresponding to the target USB device. Although the hardware of the target USB device is not unplugged, the host's USB controller can detect or sense that the target USB device has been unplugged.
[0106] A2: Obtain the configuration information corresponding to the target function to be loaded.
[0107] The target function of the target USB device loaded as needed can be used to determine configuration information corresponding to the target function of the target USB device.
[0108] A3: According to the configuration information corresponding to the target function to be loaded, add the function driver corresponding to the target function to be loaded to the driver function linked list to obtain the updated driver function linked list.
[0109] According to the configuration information corresponding to the target function to be loaded, the function driver corresponding to the target function to be loaded in the configuration information corresponding to the target function to be loaded, such as when a target USB device needs to be used as a mouse, a HID driver can be added to the driver function list.
[0110] And according to the configuration information corresponding to the target function to be loaded, an interface configuration data structure is added in the driver function linked list for the function driver corresponding to the target function to be loaded, and the interface configuration data structure includes each interface identifier corresponding to the target function to be loaded.
[0111] For example, when adding the HID driver of the target USB device to the driver function linked list, the interface identifiers that implement the function are interface identifier 1 and interface identifier 2, then interface identifier 1 and interface identifier 2 are added to the interface configuration data structure of the newly added HID driver in the driver function linked list.
[0112] A4: enabling the universal serial bus device controller so that the host loads the target function to be loaded of the target universal serial bus device after re-enumeration according to the updated driver function linked list.
[0113] When the updated driver function linked list is detected, enable configuration information is sent to the register of the USB device controller, and the enable configuration information is used to enable the USB device controller to pull up the data positive line corresponding to the target USB device, that is, the D+ pin.
[0114] By configuring the UDC register and enabling UDC to pull up the D+ pin corresponding to the target USB device, the host's USB controller can detect or sense the insertion of the target USB device. When the USB controller on the host side enumerates again, it will load the corresponding function driver with the updated driver function list, thereby achieving the effect of dynamically loading the USB function driver.
[0115] Reference Figure 4 , shows an execution step diagram of uninstalling a function driver provided by an embodiment of the present application. In a feasible implementation, dynamically uninstalling a function driver of a target universal serial bus device includes the following steps:
[0116] B1: In response to an uninstallation operation of any target function, a universal serial bus device controller in the baseboard management controller is stopped, and a target function to be uninstalled is determined.
[0117] In response to an uninstall operation on any target function of the target USB device, stop configuration information is first sent to the register of the USB device controller. By configuring the UDC register, the UDC is disabled from pulling up the D+ pin corresponding to the target USB device, so that the host's USB controller detects or senses that the target USB device has been unplugged.
[0118] B2: Delete the function driver corresponding to the target function to be uninstalled from the driver function linked list to obtain an updated driver function linked list.
[0119] Then, the function driver corresponding to the target function to be uninstalled is deleted from the driver function chain list. For example, when the target USB device is no longer used as a mouse, the HID driver can be deleted from the driver function chain list.
[0120] After deleting the function driver corresponding to the target function to be uninstalled in the driver function linked list, it is also necessary to delete the interface configuration data structure of the function driver corresponding to the target function to be uninstalled in the driver function linked list.
[0121] If the interface identifiers corresponding to the HID driver are interface identifier 1 and interface identifier 2, then the interface identifier 1 and interface identifier 2 in the interface configuration data structure of the HID driver are also deleted in the driver function linked list.
[0122] B3: enabling the USB device controller so that the host can unload the target function to be loaded of the target USB device after re-enumeration according to the updated driver function linked list.
[0123] Specifically, when it is monitored that an updated driver function list is obtained, enable configuration information is sent to the register of the USB device controller. By configuring the UDC register, the UDC is enabled to pull up the D+ pin corresponding to the target USB device, so that the host's USB controller can detect or sense the insertion of the target USB device. When the USB controller on the host side is enumerated again, the corresponding function driver of the updated driver function list will be loaded, thereby achieving the effect of dynamically unloading the USB function driver.
[0124] In a feasible implementation manner, in response to a loading operation or an unloading operation for any target function of the target USB device, in the process of stopping the USB device controller in the baseboard management controller, the method further includes:
[0125] In response to a loading operation or an unloading operation for any target function of the target USB device, the data transmission state of the target USB device is monitored; when the target USB device is in the data transmission state, after monitoring that the target USB device completes the current data transmission, the USB device controller in the baseboard management controller is stopped.
[0126] Because when dynamically loading the function driver of the target function of the target USB device, the USB controller on the host side will detect the unplugging and plugging operations of the target USB device by configuring the UDC register, and the target USB device may be in a data transmission state at this time. If the UDC is stopped this time, the current data transmission process of the target USB device will be interrupted. Therefore, in order to dynamically load or unload the function driver of the USB device without affecting the normal data transmission process of the USB device, the data transmission state of the target USB device can also be transmitted in response to a loading operation or an unloading operation for any target function of the target USB device. When the target USB device is in a data transmission state, the UDC is stopped after the target USB device completes the current data transmission, and the function driver of the USB device is dynamically loaded or unloaded.
[0127] The method provided in this embodiment stops the UDC in response to a loading operation or an unloading operation on any target function of the target USB device, updates the driver function linked list, obtains an updated driver function linked list, and enables the UDC so that the host re-enumerates the target functions of the target USB device after loading or unloading according to the updated driver function linked list. Therefore, in a single UDC scenario, according to application requirements such as a KVM application scenario, the loading and unloading of the function driver of the USB device can be implemented without adding additional hardware to the BMC. Compared with the existing method of integrating a virtual hub in the BMC, the hardware cost of the BMC can be reduced.
[0128] Reference Figure 5 , shows a schematic diagram of a server provided by an embodiment of the present application, the server includes a baseboard management controller and a host, the baseboard management controller includes a universal serial bus device controller, namely, UDC, the BMC uses a universal serial bus device function composite driver to load the function drivers corresponding to one or more target functions of the target universal serial bus device, such as function driver 1,...function driver n, after the host enumerates the USB device, it can regard the target USB device as a variety of devices according to the function driver of the target universal serial bus device, including a mouse, a keyboard, a network card, a memory and other devices, and the BMC is used to execute the universal serial bus device function driver control method described in this embodiment to realize the loading or unloading of any function driver of the target universal serial bus device.
[0129] Reference Figure 6 , shows a functional module diagram of a universal serial bus device function drive control device provided in an embodiment of the present application, which is applied to a baseboard management controller, and the device includes:
[0130] The acquisition module 100 is used to acquire the configuration information of the target universal serial bus device after startup;
[0131] A function driver adding module 200, for determining, according to the configuration information of the target universal serial bus device, that a function driver corresponding to a target function of the target universal serial bus device is added to a driver function linked list, wherein the driver function linked list is used by a host to enumerate the target functions of the target universal serial bus device;
[0132] The loading or unloading module 300 is used to respond to a loading operation or an unloading operation for any target function of the target universal serial bus device, stop the universal serial bus device controller in the baseboard management controller, update the driver function linked list, obtain an updated driver function linked list, and enable the universal serial bus device controller so that the host re-enumerates the target function of the target universal serial bus device after loading or unloading according to the updated driver function linked list.
[0133] Optionally, the acquisition module is used to determine configuration information of the target universal serial bus device according to the current business, wherein the configuration information includes the configuration of a target function of the target universal serial bus device and an interface identifier corresponding to the target function.
[0134] Optionally, the acquisition module is used to: respond to a function selection operation of a user, determine configuration information of the target universal serial bus device, the configuration information including the configuration of a target function of the target universal serial bus device and an interface identifier corresponding to the target function.
[0135] Optionally, the function driver adding module is used to:
[0136] According to the first configuration information of the target universal serial bus device, a human-machine interface device driver is used as a function driver corresponding to the target function of the target universal serial bus device and is added to the driver function linked list.
[0137] Optionally, the function driver adding module is used to:
[0138] According to the second configuration information of the target universal serial bus device, a memory driver is used as a function driver corresponding to the target function of the target universal serial bus device and is added to the driver function linked list.
[0139] Optionally, the function driver adding module is used to:
[0140] According to the third configuration information of the target universal serial bus device, a network device driver is used as a function driver corresponding to the target function of the target universal serial bus device and is added to the driver function linked list.
[0141] Optionally, the device further includes an interface configuration module, configured to:
[0142] For a function driver corresponding to any target function in the driver function chain list, an interface configuration data structure is added to the function driver corresponding to the target function, wherein the interface configuration data structure includes each interface identifier corresponding to the target function.
[0143] Optionally, the loading or unloading module includes a loading unit, and the loading unit is used to:
[0144] In response to a loading operation of any target function, stopping a universal serial bus device controller in the baseboard management controller;
[0145] Get the configuration information corresponding to the target function to be loaded;
[0146] According to the configuration information corresponding to the target function to be loaded, the function driver corresponding to the target function to be loaded is added to the driver function linked list to obtain the updated driver function linked list;
[0147] The universal serial bus device controller is enabled so that the host loads the target function to be loaded of the target universal serial bus device after re-enumeration according to the updated driver function linked list.
[0148] Optionally, the loading unit is further used for:
[0149] According to the configuration information corresponding to the target function to be loaded, an interface configuration data structure is added in the driver function linked list for the function driver corresponding to the target function to be loaded, wherein the interface configuration data structure includes each interface identifier corresponding to the target function to be loaded.
[0150] Optionally, the loading unit includes a first stopping unit, configured to:
[0151] In response to a load operation for any target function of the target USB device, stop configuration information is sent to a register of the USB device controller, wherein the stop configuration information is used to cause the USB device controller to stop pulling up a D+ pin corresponding to the target USB device.
[0152] Optionally, the loading unit includes a first enabling unit, configured to:
[0153] When the updated driver function linked list is detected, enable configuration information is sent to the register of the universal serial bus device controller, and the enable configuration information is used to enable the universal serial bus device controller to pull up the D+ pin corresponding to the target universal serial bus device.
[0154] Optionally, the loading or unloading module includes an unloading unit, and the unloading unit is used to:
[0155] In response to an uninstallation operation of any target function, stopping a universal serial bus device controller in the baseboard management controller and determining a target function to be uninstalled;
[0156] Deleting the function driver corresponding to the target function to be uninstalled from the driver function chain list to obtain an updated driver function chain list;
[0157] The universal serial bus device controller is enabled so that the host can unload the target function to be loaded of the target universal serial bus device after re-enumeration according to the updated driver function linked list.
[0158] Optionally, the unloading unit is further used for:
[0159] In the driver function linked list, the interface configuration data structure of the function driver corresponding to the target function to be uninstalled is deleted.
[0160] Optionally, the unloading unit includes a second stopping unit, configured to:
[0161] In response to an uninstall operation on any target function of the target USB device, stop configuration information is sent to a register of the USB device controller, wherein the stop configuration information is used to cause the USB device controller to stop pulling up a D+ pin corresponding to the target USB device.
[0162] Optionally, the unloading unit includes a second enabling unit, configured to:
[0163] When the updated driver function linked list is detected, enable configuration information is sent to the register of the universal serial bus device controller, and the enable configuration information is used to enable the universal serial bus device controller to pull up the D+ pin corresponding to the target universal serial bus device.
[0164] Optionally, the device further includes a transmission status monitoring module, configured to:
[0165] In response to a load operation or an unload operation for any target function of the target universal serial bus device, monitoring a data transmission state of the target universal serial bus device;
[0166] When the target universal serial bus device is in a data transmission state, after monitoring that the target universal serial bus device completes current data transmission, the universal serial bus device controller in the baseboard management controller is stopped.
[0167] Reference Figure 7, shows a schematic diagram of a computer device provided in an embodiment of the present application, comprising: at least one processor 701, and a memory 702, wherein the memory 702 stores a computer program that can be run on the processor 701, wherein the processor 701 executes the universal serial bus device function drive control method described in this embodiment when executing the computer program.
[0168] Reference Figure 8 , shows a schematic diagram of a non-volatile readable storage medium provided in an embodiment of the present application, wherein the non-volatile readable storage medium 800 stores a computer program 801, wherein the computer program 801, when executed by a processor, executes the universal serial bus device function drive control method described in this embodiment.
[0169] Reference Fig. 9 , shows a schematic diagram of a computer program product provided in an embodiment of the present application, wherein the computer program product 900 includes a computer program / instruction 901, which, when executed by a processor, implements the universal serial bus device function drive control method described in this embodiment.
Claims
1. A universal serial bus device function drive control method, characterized in that: Applied to a baseboard management controller, the method comprises: After startup, obtain the configuration information of the target universal serial bus device; According to the configuration information of the target universal serial bus device, determine that a function driver corresponding to a target function of the target universal serial bus device is added to a driver function linked list, wherein the driver function linked list is used by a host to enumerate the target functions of the target universal serial bus device; In response to a loading operation or an unloading operation for any target function of the target universal serial bus device, the universal serial bus device controller in the baseboard management controller is stopped from pulling up the data positive line corresponding to the target universal serial bus device, the drive function linked list is updated to obtain an updated drive function linked list, and the universal serial bus device controller is enabled to pull up the data positive line corresponding to the target universal serial bus device, so that the host re-enumerates the target function of the target universal serial bus device after loading or unloading according to the updated drive function linked list; Among them, the function driver corresponding to any target function in the driver function chain list is added with an interface configuration data structure, and the interface configuration data structure includes various interface identifiers corresponding to the target function.
2. The method according to claim 1, characterized in that After startup, obtain the configuration information of the target USB device, including: According to the current service, the configuration information of the target universal serial bus device is determined, wherein the configuration information includes the configuration of the target function of the target universal serial bus device and the interface identifier corresponding to the target function.
3. The method according to claim 1, characterized in that After startup, obtain the configuration information of the target USB device, including: In response to a function selection operation of a user, configuration information of the target universal serial bus device is determined, wherein the configuration information includes a configuration of a target function of the target universal serial bus device and an interface identifier corresponding to the target function.
4. The method according to claim 1, characterized in that Determining, according to the configuration information of the target universal serial bus device, that a function driver corresponding to a target function of the target universal serial bus device is added to a driver function linked list comprises: According to the first configuration information of the target universal serial bus device, a human-machine interface device driver is used as a function driver corresponding to the target function of the target universal serial bus device and is added to the driver function linked list.
5. The method according to claim 1, characterized in that Determining, according to the configuration information of the target universal serial bus device, that a function driver corresponding to a target function of the target universal serial bus device is added to a driver function linked list comprises: According to the second configuration information of the target universal serial bus device, a memory driver is used as a function driver corresponding to the target function of the target universal serial bus device and is added to the driver function linked list.
6. The method according to claim 1, characterized in that Determining, according to the configuration information of the target universal serial bus device, that a function driver corresponding to a target function of the target universal serial bus device is added to a driver function linked list comprises: According to the third configuration information of the target universal serial bus device, a network device driver is used as a function driver corresponding to the target function of the target universal serial bus device and is added to the driver function linked list.
7. The method according to claim 1, characterized in that After determining, according to the configuration information of the target universal serial bus device, that a function driver corresponding to a target function of the target universal serial bus device is added to a driver function linked list, the method further comprises: For a function driver corresponding to any target function in the driver function chain list, an interface configuration data structure is added to the function driver corresponding to the target function, wherein the interface configuration data structure includes each interface identifier corresponding to the target function.
8. The method according to claim 7, characterized in that In response to a loading operation or an unloading operation for any function of the target universal serial bus device, stopping the universal serial bus device controller in the baseboard management controller from pulling up the data positive line corresponding to the target universal serial bus device, updating the drive function linked list to obtain an updated drive function linked list, and enabling the universal serial bus device controller to pull up the data positive line corresponding to the target universal serial bus device, including: In response to a loading operation of any target function, stopping the USB device controller in the baseboard management controller from pulling up a data positive line corresponding to the target USB device; Get the configuration information corresponding to the target function to be loaded; According to the configuration information corresponding to the target function to be loaded, the function driver corresponding to the target function to be loaded is added to the driver function linked list to obtain the updated driver function linked list; The USB device controller is enabled to pull up the data positive line corresponding to the target USB device, so that the host loads the target function to be loaded of the target USB device after re-enumeration according to the updated driver function linked list.
9. The method according to claim 8, characterized in that According to the configuration information corresponding to the target function to be loaded, after adding the function driver corresponding to the target function to be loaded in the driver function linked list and obtaining the updated driver function linked list, the method further includes: According to the configuration information corresponding to the target function to be loaded, an interface configuration data structure is added in the driver function linked list for the function driver corresponding to the target function to be loaded, wherein the interface configuration data structure includes each interface identifier corresponding to the target function to be loaded.
10. The method according to claim 8, characterized in that In response to a loading operation of any target function, stopping the universal serial bus device controller in the baseboard management controller from pulling up a data positive line corresponding to the target universal serial bus device includes: In response to a load operation for any target function of the target USB device, stop configuration information is sent to a register of the USB device controller, wherein the stop configuration information is used to cause the USB device controller to stop pulling up a data positive line corresponding to the target USB device.
11. The method according to claim 8, characterized in that Enabling the universal serial bus device controller to pull up a data positive line corresponding to the target universal serial bus device, comprising: When the updated driver function linked list is detected, enable configuration information is sent to the register of the universal serial bus device controller, and the enable configuration information is used to enable the universal serial bus device controller to pull up the data positive line corresponding to the target universal serial bus device.
12. The method according to claim 7, characterized in thatIn response to a load operation or an unload operation for any target function of the target universal serial bus device, stopping the universal serial bus device controller in the baseboard management controller from pulling up the data positive line corresponding to the target universal serial bus device, updating the drive function linked list to obtain an updated drive function linked list, and enabling the universal serial bus device controller to pull up the data positive line corresponding to the target universal serial bus device, including: In response to an uninstallation operation of any target function, stopping the USB device controller in the baseboard management controller from pulling up the data positive line corresponding to the target USB device, and determining the target function to be uninstalled; Deleting the function driver corresponding to the target function to be uninstalled from the driver function chain list to obtain an updated driver function chain list; The USB device controller is enabled to pull up the data positive line corresponding to the target USB device, so that the host can unload the target function to be loaded of the target USB device after re-enumeration according to the updated driver function linked list.
13. The method according to claim 12, characterized in that After deleting the function driver corresponding to the target function to be uninstalled from the driver function linked list, the method further includes: In the driver function linked list, the interface configuration data structure of the function driver corresponding to the target function to be uninstalled is deleted.
14. The method according to claim 12, characterized in that Stopping the universal serial bus device controller in the baseboard management controller from pulling up the data positive line corresponding to the target universal serial bus device, comprising: In response to an uninstall operation on any target function of the target USB device, stop configuration information is sent to a register of the USB device controller, wherein the stop configuration information is used to cause the USB device controller to stop pulling up a data positive line corresponding to the target USB device.
15. The method according to claim 12, characterized in that Enabling the universal serial bus device controller to pull up a data positive line corresponding to the target universal serial bus device, comprising: When the updated driver function linked list is detected, enable configuration information is sent to the register of the universal serial bus device controller, and the enable configuration information is used to enable the universal serial bus device controller to pull up the data positive line corresponding to the target universal serial bus device.
16. The method according to any one of claims 1 to 15, characterized in that: In response to a load operation or an unload operation for any target function of the target universal serial bus device, stopping the universal serial bus device controller in the baseboard management controller from pulling up a data positive line corresponding to the target universal serial bus device, the method further includes: In response to a load operation or an unload operation for any target function of the target universal serial bus device, monitoring a data transmission state of the target universal serial bus device; When the target USB device is in a data transmission state, after monitoring that the target USB device completes current data transmission, the USB device controller in the baseboard management controller is stopped from pulling up the data positive line corresponding to the target USB device.
17. A server, characterized in that: The server comprises a baseboard management controller and a host, the baseboard management controller comprises a universal serial bus device controller, and the baseboard management controller is used to execute the universal serial bus device function drive control method according to any one of claims 1-16.
18. A computer device, characterized in that: include: At least one processor, and a memory, wherein the memory stores a computer program that can be run on the processor, wherein when the processor executes the computer program, the universal serial bus device function drive control method described in any one of claims 1-16 is executed.
19. A non-volatile readable storage medium, characterized in that: The non-volatile readable storage medium stores a computer program, wherein the computer program, when executed by a processor, executes the universal serial bus device function drive control method according to any one of claims 1 to 16.
20. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the universal serial bus device function drive control method described in any one of claims 1-16 is implemented.
Citation Information
Patent Citations
Wiring data generating system and method
CN101105818A
Method of data interaction between computer and intelligent terminal modem
CN103024012A
Method for achieving extensible 3G communication function of tablet personal computer
CN103995563A
Method and apparatus for determining key attribute items
US20090204588A1
