Optical module management method, device and system
By detecting the status signals of optical modules and creating or deleting file system nodes, the problem of hot-plugging optical modules in Linux systems is solved, realizing automatic identification and compatibility of optical modules and simplifying the development process of user programs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2026-03-31
AI Technical Summary
The hot-plugging issue of optical modules in Linux systems requires users to manually configure the system to recognize the reconnected optical modules, making the process cumbersome. Furthermore, the protocols of optical modules from different manufacturers vary greatly, resulting in poor portability.
By detecting the status signal of the optical module, it can determine whether there is a file system node in the system kernel, create or delete the file system node of the optical module, realize the hot-plugging of the optical module, and create a matching file system node according to the optical module protocol, simplifying the development of user programs.
It enables automatic identification and hot-swapping of optical modules in Linux systems, improves the compatibility of optical modules with different protocols, and simplifies the development of user programs.
Smart Images

Figure CN116303144B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of optical module technology, and in particular to an optical module management method, apparatus and system. Background Technology
[0002] An optical module is an optoelectronic device composed of optoelectronic components, functional circuits, and optical interfaces. It is used to convert optical signals into and out of electrical signals. The two ends of an optical module are connected to an optical fiber and a computer device, respectively. On one hand, the optical module can receive optical signals from the optical fiber and convert them into electrical signals that the computer device can recognize. On the other hand, the optical module converts electrical signals emitted by the computer device into optical signals, thereby transmitting the optical signals through the optical fiber.
[0003] Currently, some computer systems, such as Linux, do not support hot-swapping of optical modules. When a user removes and reconnects an optical module on a Linux computer, the Linux driver layer cannot automatically recognize the reconnected module. In this case, the user needs to manually configure the Linux system's user layer to recognize the reconnected module, making the process of using optical modules rather cumbersome. Summary of the Invention
[0004] To address the shortcomings of the prior art, this invention provides an optical module management method, apparatus, and system to solve the problem of hot-plugging optical modules on Linux system devices.
[0005] The first aspect of this application provides an optical module management method, including:
[0006] The optical module status signal of the target device is used to detect whether the target device is connected to an optical module; wherein, the target device is a computer device running a Linux system;
[0007] If the optical module status signal indicates that the target device has connected to the optical module, determine whether there is a file system node for the current optical module in the system kernel of the target device; wherein, the current optical module refers to the optical module currently connected to the target device, and the file system node for the current optical module is used to access the current optical module;
[0008] If the system kernel does not have a file system node for the current optical module, create a file system node for the current optical module in the system kernel;
[0009] If the optical module status signal indicates that the target device is not connected to the optical module, delete the file system node created in the system kernel for accessing the optical module.
[0010] Optionally, the optical module status signal includes an optical module presence signal and an optical module power supply signal;
[0011] The step of detecting whether the target device is connected to an optical module based on the optical module status signal of the target device includes:
[0012] The system detects whether the optical module's presence signal is a high-level or low-level signal, and detects whether the optical module's power supply signal is in a normal or abnormal state.
[0013] If the optical module is in-situ signal is a high-level signal and the optical module power supply signal is in a normal state, it is determined that the target device has been connected to the optical module;
[0014] If the optical module presence signal is a low-level signal and the optical module power supply signal is in an abnormal state, it is determined that the target device is not connected to the optical module.
[0015] Optionally, creating the file system node for the current optical module in the system kernel includes:
[0016] Determine the current optical module protocol carried by the current optical module;
[0017] Create a file system node in the system kernel that matches the current optical module protocol.
[0018] Optionally, determining the current optical module protocol carried by the current optical module includes:
[0019] Obtain the identifier information of the current optical module;
[0020] The optical module protocol that matches the identifier information among the preset multiple optical module protocols is determined as the current optical module protocol carried by the current optical module.
[0021] Optionally, after deleting the file system node already created in the system kernel for accessing the optical module, the method further includes:
[0022] Output optical module removal prompt.
[0023] A second aspect of this application provides an optical module management device, comprising:
[0024] A detection unit is used to detect whether the target device is connected to an optical module based on the optical module status signal of the target device; wherein, the target device is a computer device running a Linux system;
[0025] The judgment unit is used to determine whether there is a file system node for the current optical module in the system kernel of the target device if the optical module status signal indicates that the target device has been connected to the optical module; wherein, the current optical module refers to the optical module currently connected to the target device, and the file system node of the current optical module is used to access the current optical module;
[0026] A creation unit is used to create a file system node for the current optical module in the system kernel if the file system node for the current optical module does not exist in the system kernel.
[0027] The deletion unit is used to delete the file system node that has been created in the system kernel for accessing the optical module if the optical module status signal indicates that the target device is not connected to the optical module.
[0028] Optionally, the optical module status signal includes an optical module presence signal and an optical module power supply signal;
[0029] When the detection unit detects whether the target device is connected to an optical module based on the optical module status signal of the target device, it is specifically used for:
[0030] The system detects whether the optical module's presence signal is a high-level or low-level signal, and detects whether the optical module's power supply signal is in a normal or abnormal state.
[0031] If the optical module is in-situ signal is a high-level signal and the optical module power supply signal is in a normal state, it is determined that the target device has been connected to the optical module;
[0032] If the optical module presence signal is a low-level signal and the optical module power supply signal is in an abnormal state, it is determined that the target device is not connected to the optical module.
[0033] Optionally, when the creation unit creates the file system node of the current optical module in the system kernel, it is specifically used for:
[0034] Determine the current optical module protocol carried by the current optical module;
[0035] Create a file system node in the system kernel that matches the current optical module protocol.
[0036] Optionally, when the creation unit determines the current optical module protocol carried by the current optical module, it is specifically used for:
[0037] Obtain the identifier information of the current optical module;
[0038] The optical module protocol that matches the identifier information among the preset multiple optical module protocols is determined as the current optical module protocol carried by the current optical module.
[0039] Optionally, the device further includes an output unit for:
[0040] Output optical module removal prompt.
[0041] A third aspect of this application provides an optical module management system, including a memory and a processor;
[0042] The memory is used to store computer programs;
[0043] The processor is used to execute the computer program, specifically to implement the optical module management method provided in any of the first aspects of this application.
[0044] This application provides an optical module management method, apparatus, and system. The method includes: detecting whether the target device is connected to an optical module based on the optical module status signal of the target device; if the target device is connected to an optical module, determining whether there is a file system node for the currently connected optical module in the system kernel; the file system node for the currently connected optical module is used to access the currently connected optical module; if not, creating the file system node for the currently connected optical module in the system kernel; if the target device is not connected to an optical module, deleting the file system node already created in the system kernel for accessing the optical module. This solution detects whether the target device is connected to an optical module and creates or deletes a file system node for accessing the optical module based on whether the optical module is connected, thus realizing hot-swapping of optical modules on computer devices. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0046] Figure 1 A flowchart illustrating an optical module management method provided in this application embodiment;
[0047] Figure 2 This is a schematic diagram of the structure of an optical module management device provided in an embodiment of this application;
[0048] Figure 3 This is a schematic diagram of the structure of an optical module management system provided in an embodiment of this application. Detailed Implementation
[0049] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0050] Existing Linux devices (referring to computer devices running the Linux system) have the following problems when using optical modules:
[0051] On the one hand, existing Linux devices do not support hot-swapping of optical modules. When a user removes and reconnects an optical module on a Linux computer, the Linux driver layer cannot automatically recognize the reconnected optical module. In this case, the user needs to manually configure the Linux system's user layer to recognize the reconnected optical module, making the process of using optical modules rather cumbersome.
[0052] On the other hand, in existing Linux devices, optical modules are accessed by user-space applications directly accessing the optical module's registers according to the optical module's protocol. The problem with this approach is that the protocols used by optical modules from different manufacturers vary significantly. Under different protocols, the addresses of the registers storing information in the optical module also differ, resulting in poor portability between optical modules from different manufacturers; a specific manufacturer's optical module can only be accessed by applications from that manufacturer.
[0053] To address the above issues, this application provides an optical module management method. Please refer to [link to relevant documentation]. Figure 1 Here is a flowchart of the method, which may include the following steps.
[0054] S101, detect whether the target device is connected to an optical module based on the optical module status signal of the target device.
[0055] The target device is a computer running a Linux system.
[0056] The Linux system in this embodiment can be SONiC, Ubuntu, CentOS, or other similar systems.
[0057] The method provided in this embodiment can be executed by a kernel thread pre-created in the Linux system kernel for managing optical modules. This thread can be created when the target device starts up, and then the method provided in this embodiment is executed periodically according to a certain execution cycle during the operation of the target device, such as executing the method of this embodiment once every 10 seconds, thereby realizing hot-plugging of optical modules during the operation of the target device.
[0058] If the target device is detected to be connected to the optical module, proceed to step S102; if the target device is detected not to be connected to the optical module, proceed to step S104.
[0059] Optionally, the optical module status signals include the optical module in-situ signal (ModprsL) and the optical module power supply signal (Power).
[0060] The target device may have multiple pins at the interface for connecting the optical module, including a ModprsL pin for outputting an optical module presence signal and a Power pin for supplying power to the optical module. In step S101, the optical module presence signal on the ModprsL pin and the optical module power supply signal on the Power pin can be detected, and the status of these two signals can be used to determine whether the target device is currently connected to an optical module.
[0061] Detecting whether the target device is connected to an optical module based on the target device's optical module status signal includes:
[0062] The system detects whether the optical module's presence signal is high or low, and whether the optical module's power supply signal is in a normal or abnormal state.
[0063] If the optical module is in place signal is high and the optical module power supply signal is in normal state, it is determined that the target device has been connected to the optical module.
[0064] If the optical module is in place signal is low and the optical module power supply signal is in an abnormal state, it is determined that the target device is not connected to the optical module.
[0065] The optical module presence signal is a high-level signal, indicating that an optical module is currently connected to the target device, and a low-level signal, indicating that no optical module is currently connected to the target device.
[0066] If the optical module power supply signal is in a normal state, it means that the target device is currently connected to an optical module and the optical module is working properly. If the optical module power supply signal is in an abnormal state, it means that the target device is not connected to an optical module, or that the target device is currently connected to an optical module but the optical module is not working properly.
[0067] A normal optical module power supply signal means the optical module power supply signal is a high-level signal. An abnormal optical module power supply signal means the optical module is in-position signal is a low-level signal.
[0068] S102, determine whether there is a file system node for the current optical module in the system kernel of the target device.
[0069] Here, "current optical module" refers to the optical module currently connected to the target device, and the file system node of the current optical module is used to access the current optical module.
[0070] If there is no file system node for the current optical module in the system kernel, proceed to step S103. If there is a file system node for the current optical module in the system kernel, this embodiment ends.
[0071] A file system node, also known as a Sysfs node, is a memory-based file system used in this embodiment to provide kernel information to user programs in the Linux system in the form of files.
[0072] S103 creates a file system node for the current optical module in the system kernel.
[0073] In this embodiment, the file system node used to access the optical module can be understood as a collection of device files used to access the optical module. Each optical module contains an electrically erasable programmable read-only memory (EEPROM), which consists of multiple registers. In the file system node for accessing the optical module, each device file corresponds to the address of at least one register in the EEPROM of the optical module.
[0074] Optionally, create a file system node for the current optical module in the system kernel, including:
[0075] Determine the current optical module protocol carried by the current optical module;
[0076] Create a file system node in the system kernel that matches the current optical module protocol.
[0077] Optionally, determine the current optical module protocol carried by the current optical module, including:
[0078] Obtain the identifier information of the current optical module;
[0079] Among the various preset optical module protocols, the optical module protocol that matches the identifier information is determined as the current optical module protocol carried by the current optical module.
[0080] In step S103, the identifier information of the current optical module can be read from the EEPROM of the current optical module through the two-wire serial bus (Inter-Integrated Circuit, I2C) protocol. Then, the identifier information of the current optical module is compared with the identifier information of various optical module protocols pre-stored in the target device. If the identifier information of a certain optical module protocol pre-stored in the target device is found to be consistent with the identifier information of the current optical module, then the optical module protocol is determined to be the optical module protocol carried by the current optical module, that is, it is determined to be the current optical module protocol.
[0081] In this embodiment, the optical module protocols pre-stored by the target device include, but are not limited to, SFP, SFP+, SFP28, QSFP+, QSFP28, QSFP_DD, etc.
[0082] The process of creating a file system node in the system kernel that matches the current optical module protocol is as follows:
[0083] As mentioned earlier, optical modules use EEPROM composed of multiple registers to store information, while optical module protocols specify which registers in the optical module are used to store which types of information. In other words, an optical module protocol can be understood as a mapping relationship between register addresses and the types of information stored in the registers in the optical module. Different optical module protocols have different mapping relationships.
[0084] For example, optical modules store manufacturer information. The register address where the manufacturer information is stored differs in different optical module protocols. For instance, SFP+ may specify that the manufacturer information is stored in a register at address 100, while SFP28 may specify that the manufacturer information is stored in a register at address 200.
[0085] When creating a file system node that matches the current optical module protocol, the types of information stored in the current optical module's EEPROM can be determined based on the current optical module protocol. Then, for the different types of information stored in the current optical module's EEPROM, multiple device files can be created to access different types of information. For example, device files can be created to access manufacturer information and device files can be created to access register format information.
[0086] Device files of different types can be distinguished by their names. For example, the device file used to access manufacturer information is named "Manu_Info", and the device file used to access register format information is named "Register_Info".
[0087] After creating multiple device files for accessing each type of information in the EEPROM of the optical module, a mapping relationship can be established between the device file corresponding to each type of information and the register in the EEPROM that stores that type of information, according to the current optical module protocol.
[0088] Continuing with the previous example, assuming the current optical module protocol is SFP+, which specifies that manufacturer information is stored in register at address 100, then when creating a file system node matching the SFP+ protocol, a mapping relationship is established between the "Manu_Info" device file and EEPROM register 100. Assuming the current optical module protocol is SFP28, which specifies that manufacturer information is stored in register at address 200, then when creating a file system node matching the SFP28 protocol, a mapping relationship is established between the "Manu_Info" device file and EEPROM register 200.
[0089] Through the above process, multiple device files can be obtained, each mapped to a register in the EEPROM of the optical module. Each device file is used to access a specific type of information stored in the EEPROM of the optical module. The collection of these device files is the file system node to be created in S103 that matches the current optical module protocol.
[0090] Understandably, when any user program needs to access a specific type of information stored in the current optical module, the user program can directly look up the device file corresponding to that type of information in the aforementioned file system nodes. For example, when it needs to access manufacturer information, it can look up the “Manu_Info” device file in the aforementioned file system nodes.
[0091] Once the device file corresponding to a specific type of information is found, the user program can read information from or write information to the device file as needed. Since each device file in the file system node is mapped to a register at a specific address in the currently connected optical module, reading and writing operations on device files in the file system node are equivalent to reading and writing operations on registers at a specific address in the EEPROM of the optical module.
[0092] For example, if the current optical module protocol is SFP+, then reading information from the "Manu_Info" device file is equivalent to reading the manufacturer information from register 100 of the optical module's EEPROM. If the current optical module protocol is SFP28, then reading information from the "Manu_Info" device file is equivalent to reading the manufacturer information from register 200 of the optical module's EEPROM.
[0093] As can be seen from the above process of user program accessing the EEPROM of the optical module, after creating a file system node that matches the current optical module protocol, the user program only needs to find the corresponding device file in the file system node according to the type of information it needs to access. It can then perform read and / or write operations on the registers storing that type of information in the EEPROM by accessing the device file, eliminating the need to parse and adapt the optical module protocol to determine which register each type of information is specifically stored in. Therefore, by creating a file system node, the user program can directly access optical modules carrying different optical module protocols without needing to adapt to multiple optical module protocols, simplifying the development work of the user program.
[0094] S104, delete the file system node that has been created in the system kernel for accessing the optical module.
[0095] Optionally, before executing step S104, it can be determined whether there is any file system node in the system kernel used to access the optical module. If it is determined that there is a file system node used to access the optical module, then step S104 is executed. If it is determined that there is no file system node used to access the optical module, then this embodiment ends.
[0096] Optionally, after deleting the filesystem node already created in the system kernel for accessing the optical module, the following also applies:
[0097] Output optical module removal prompt.
[0098] One optional output method is to display a text message on the target device's display screen, indicating to the user that the optical module connected to the target device has been removed. Of course, other methods can also be used to output the optical module removal notification; this embodiment does not limit the specific output method.
[0099] This application provides an optical module management method, which includes: detecting whether the target device is connected to an optical module based on the optical module status signal of the target device; if the target device is connected to an optical module, determining whether there is a file system node for the currently connected optical module in the system kernel; the file system node for the currently connected optical module is used to access the currently connected optical module; if not, creating the file system node for the currently connected optical module in the system kernel; if the target device is not connected to an optical module, deleting the file system node already created in the system kernel for accessing the optical module. This solution detects whether the target device is connected to an optical module and creates or deletes the file system node for accessing the optical module based on whether the optical module is connected, thus realizing hot-swapping of optical modules on computer devices.
[0100] Furthermore, this embodiment can create a corresponding file system node in the kernel based on the optical module protocol carried by the currently connected optical module. This allows programs running on the target device to access the currently connected optical module through the file system node without needing to adapt to a specific optical module protocol. In other words, this embodiment improves the compatibility of Linux user programs with optical modules of different protocols, enabling Linux user programs to access optical modules carrying any optical module protocol. It also reduces the workload during user program development, eliminating the need to develop functionality to adapt to various optical module protocols.
[0101] Based on the optical module management method provided in the embodiments of this application, the embodiments of this application also provide an optical module management device. Please refer to [link to relevant documentation]. Figure 2 This is a schematic diagram of the structure of the device, which may include the following units.
[0102] The detection unit 201 is used to detect whether the target device is connected to an optical module based on the optical module status signal of the target device; wherein, the target device is a computer device running a Linux system;
[0103] The judgment unit 202 is used to determine whether there is a file system node for the current optical module in the system kernel of the target device if the optical module status signal indicates that the target device has been connected to the optical module; wherein, the current optical module refers to the optical module currently connected to the target device, and the file system node of the current optical module is used to access the current optical module;
[0104] Creation unit 203 is used to create a file system node for the current optical module in the system kernel if there is no file system node for the current optical module in the system kernel.
[0105] The deletion unit 204 is used to delete the file system node that has been created in the system kernel for accessing the optical module if the optical module status signal indicates that the target device is not connected to the optical module.
[0106] Optionally, the optical module status signals include optical module presence signals and optical module power supply signals;
[0107] When the detection unit 201 detects whether the target device is connected to an optical module based on the optical module status signal of the target device, it is specifically used for:
[0108] The system detects whether the optical module's presence signal is high or low, and whether the optical module's power supply signal is in a normal or abnormal state.
[0109] If the optical module is in place signal is high and the optical module power supply signal is in normal state, it is determined that the target device has been connected to the optical module.
[0110] If the optical module is in place signal is low and the optical module power supply signal is in an abnormal state, it is determined that the target device is not connected to the optical module.
[0111] Optionally, when creating the file system node for the current optical module in the system kernel, creation unit 203 is specifically used for:
[0112] Determine the current optical module protocol carried by the current optical module;
[0113] Create a file system node in the system kernel that matches the current optical module protocol.
[0114] Optionally, when creating unit 203 determines the current optical module protocol carried by the current optical module, it is specifically used for:
[0115] Obtain the identifier information of the current optical module;
[0116] Among the various preset optical module protocols, the optical module protocol that matches the identifier information is determined as the current optical module protocol carried by the current optical module.
[0117] Optionally, the device also includes an output unit 205 for:
[0118] Output optical module removal prompt.
[0119] The specific working principle of the optical module management device provided in this embodiment can be found in the relevant steps of the optical module management method provided in this application embodiment, and will not be repeated here.
[0120] This application provides an optical module management device, including: a detection unit 201, used to detect whether the target device is connected to an optical module based on the optical module status signal of the target device; wherein the target device is a computer device running a Linux system; a judgment unit 202, used to determine whether there is a file system node for the current optical module in the system kernel of the target device if the optical module status signal indicates that the target device is connected to an optical module; wherein the current optical module refers to the optical module currently connected to the target device, and the file system node for the current optical module is used to access the current optical module; a creation unit 203, used to create a file system node for the current optical module in the system kernel if there is no file system node for the current optical module in the system kernel; and a deletion unit 204, used to delete the file system node for accessing the optical module already created in the system kernel if the optical module status signal indicates that the target device is not connected to an optical module. This solution detects whether the target device is connected to an optical module and creates or deletes a file system node for accessing the optical module based on whether the optical module is connected, thus realizing hot-swapping of optical modules on computer devices.
[0121] This application also provides an optical module management system; please refer to [link to relevant documentation]. Figure 3This is a schematic diagram of the system structure, which may include a memory 301 and a processor 302.
[0122] The memory 301 is used to store computer programs.
[0123] The processor 302 is used to execute the computer program, specifically to implement the optical module management method provided in any embodiment of this application.
[0124] The optical module management system provided in this embodiment can be regarded as a computer device running a Linux system and used to execute the optical module management method provided in this embodiment.
[0125] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0126] It should be noted that the concepts of "first" and "second" mentioned in this invention are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0127] Those skilled in the art will be able to implement or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method of managing optical modules, the method comprising: The method comprises the following steps: detecting whether the target device is connected to the optical module according to the optical module state signal of the target device; wherein the target device is a computer device running a Linux system; if the optical module state signal indicates that the target device has been connected to the optical module, judging whether there is a file system node of the current optical module in the system kernel of the target device; wherein the current optical module refers to the optical module currently connected to the target device, and the file system node of the current optical module is used to access the current optical module; the file system node comprises a plurality of device files used to access the optical module; each device file corresponds to the address of at least one register in the EEPROM of the current optical module; a user program realizes the read and write operations on the registers at the corresponding address in the EEPROM of the optical module through read and write operations on the device files; if there is no file system node of the current optical module in the system kernel, creating the file system node of the current optical module in the system kernel; if the optical module state signal indicates that the target device is not connected to the optical module, deleting the file system node for accessing the optical module that has been created in the system kernel.
2. The method of claim 1, wherein, The optical module state signal comprises an optical module in-place signal and an optical module power supply signal; The step of detecting whether the target device is connected to the optical module according to the optical module state signal of the target device comprises the following steps: detecting whether the optical module in-place signal is a high-level signal or a low-level signal, and detecting whether the optical module power supply signal is in a normal state or an abnormal state; if the optical module in-place signal is a high-level signal and the optical module power supply signal is in a normal state, determining that the target device has been connected to the optical module; if the optical module in-place signal is a low-level signal and the optical module power supply signal is in an abnormal state, determining that the target device is not connected to the optical module.
3. The method of claim 1, wherein, The step of creating the file system node of the current optical module in the system kernel comprises the following steps: determining the current optical module protocol carried by the current optical module; creating a file system node matching the current optical module protocol in the system kernel.
4. The method of claim 3, wherein, The step of determining the current optical module protocol carried by the current optical module comprises the following steps: obtaining identifier information of the current optical module; determining, as the current optical module protocol carried by the current optical module, the optical module protocol matching the identifier information in a plurality of preset optical module protocols.
5. The method of claim 1, wherein, After the step of deleting the file system node for accessing the optical module that has been created in the system kernel, the method further comprises the following step: outputting an optical module removal prompt.
6. An optical module management apparatus characterized by comprising: The method comprises the following steps: detecting whether the target device is connected to the optical module according to the optical module state signal of the target device; wherein the target device is a computer device running a Linux system; The judging unit is configured to judge whether there is a file system node of a current optical module in a system kernel of the target device if the optical module state signal indicates that the target device has connected the optical module, wherein the current optical module refers to an optical module currently connected by the target device, and the file system node of the current optical module is used to access the current optical module; the file system node includes a plurality of device files used to access optical modules; each device file corresponds to an address of at least one register in an EEPROM of the current optical module; and a user program realizes read and write operations on the registers at the corresponding addresses in the EEPROM of the optical module through read and write operations on the device files. The creating unit is configured to create the file system node of the current optical module in the system kernel if there is no file system node of the current optical module in the system kernel. The deleting unit is configured to delete the file system node used to access the optical module that has been created in the system kernel if the optical module state signal indicates that the target device has not connected the optical module.
7. The apparatus of claim 6, wherein, The optical module state signal includes an optical module in-place signal and an optical module power supply signal. The detecting unit is configured to, when detecting whether the target device is connected with the optical module according to the optical module state signal of the target device, specifically: detect whether the optical module in-place signal is a high-level signal or a low-level signal, and detect whether the optical module power supply signal is in a normal state or an abnormal state; if the optical module in-place signal is a high-level signal and the optical module power supply signal is in the normal state, determine that the target device has connected the optical module; if the optical module in-place signal is a low-level signal and the optical module power supply signal is in the abnormal state, determine that the target device has not connected the optical module.
8. The apparatus of claim 6, wherein, The creating unit is configured to, when creating the file system node of the current optical module in the system kernel, specifically: determine a current optical module protocol carried by the current optical module; and create a file system node matching the current optical module protocol in the system kernel.
9. The apparatus of claim 8, wherein, The creating unit is configured to, when determining the current optical module protocol carried by the current optical module, specifically: obtain identifier information of the current optical module; and determine, as the current optical module protocol carried by the current optical module, an optical module protocol matching the identifier information in a plurality of preset optical module protocols.
10. An optical module management system, characterized by, The device includes a memory and a processor. The memory is configured to store a computer program. The processor is configured to execute the computer program, and specifically configured to implement the optical module management method in any one of claims 1 to 5.
Citation Information
Patent Citations
External device automatic mounting and informing control method and system
CN105808299A
Optical module identification method and device
CN115499068A