Control method and device of LED indicator light, electronic device and storage medium

By detecting and controlling the state of LED indicators in user-mode processes, and combining this with kernel-mode character device files, the problem of data transmission and reception crashes caused by kernel interrupt service routine delays was solved, thus achieving stable LED indicator flickering and data transmission and reception.

CN116225858BActive Publication Date: 2026-03-27KYLAND TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-19
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

In existing technologies, software interrupts in the operating system kernel's interrupt service routines can increase latency and easily lead to crashes during data transmission and reception, especially when multiple interfaces are transmitting and receiving simultaneously at high speeds.

Method used

By detecting the status of LED indicators in an independent process in user mode and controlling their on and off states in kernel mode, and using character device files to control preset time intervals, the system avoids adding delays in kernel-mode drivers and reduces kernel execution time.

Benefits of technology

It achieves a strobe display effect for LED indicators, avoids kernel crashes, and improves the stability and efficiency of data transmission and reception.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116225858B_ABST
    Figure CN116225858B_ABST
Patent Text Reader

Abstract

The application relates to a control method and device of an LED indicator lamp, an operating system and a storage medium, the method comprising the following steps: detecting the states corresponding to a plurality of LED indicator lamps in a character device file at a preset time interval; determining whether the LED indicator lamp is lighted based on the state of the LED indicator lamp; acquiring a target instruction in an operation instruction by an interrupt service routine in a kernel state to control the LED indicator lamp to be lighted; and updating the character device file based on a preset rule and a shutdown operation instruction, and forwarding the shutdown operation instruction to a corresponding target LED indicator lamp through the updated character device file to control the target LED indicator lamp to be extinguished. Through the application, the problem that the software interrupt of the interrupt service routine of the kernel of the operating system in the related art is increased and the time delay is increased, and the data transmission is prone to collapse is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of control, and particularly relates to a control method and device of an LED indicator light, an electronic device and a storage medium. BACKGROUND

[0002] In the related art, an indicator light flashes to indicate that data is being transmitted and received when port data is transmitted and received, and the indicator light is off when there is no data. Some port transceiver devices are equipped with indicator lights, but more transceivers are not equipped with indicator lights. For transceivers without indicator lights, an indicator light needs to be added by hardware, and the indicator light is controlled by software through a general-purpose input / output (GPIO) port to achieve the indication effect when data is transmitted and received.

[0003] On the operating system in the related art, for example, a Linux system, when a program developer uses a data transmission interface function on a user state process, the developer increases control of an LED indicator light by himself / herself, for example, the data indicator light is first turned on when data is transmitted, the indicator light is turned off after a period of time (1s or 2s) after a data packet is transmitted, and the same is true when data is received. However, increasing the time delay when data is transmitted and received affects the processing of data. If there is no time delay, when the data rate is high and the data packet is short, the human eye cannot see the indicator light, and the indicator light cannot achieve the flashing effect. At the same time, in the related art, the data indicator light control is added to the driver in the kernel state of the operating system, and is processed by the second half of the soft interrupt of the interrupt processing program. However, because the interrupt processing is fast, a time delay needs to be added in the soft interrupt to enable the human eye to observe the indicator light and the indicator light does not flash. When the data indicator light control is added to the driver in the kernel state of the operating system, when multiple interfaces simultaneously transmit and receive and the rate is high, the software interrupt of the interrupt service routine of the kernel increases the time delay, which causes the data transmission and reception to crash.

[0004] There is no better technical solution for the problem that the software interrupt of the interrupt service routine of the kernel of the operating system in the related art increases the time delay, which easily causes the data transmission and reception to crash. SUMMARY

[0005] The present application provides a control method and device of an LED indicator light, an electronic device and a storage medium to at least solve the problem that the software interrupt of the interrupt service routine of the kernel of the operating system in the related art increases the time delay, which easily causes the data transmission and reception to crash.

[0006] In a first aspect, the application provides a control method of an LED indicator lamp, applied to a user state of a target operating system, the control method comprising: detecting, at preset time intervals, states corresponding to a plurality of LED indicator lamps in a character device file, wherein the character device file is generated by a kernel state based on operation instructions transmitted from the user state and acquired states of the LED indicator lamps; determining whether the LED indicator lamps are lit based on the states of the LED indicator lamps, wherein an interrupt service routine located in the kernel state controls the LED indicator lamps to be lit by acquiring target instructions in the operation instructions; and in a case where it is determined that the LED indicator lamps are lit, updating the character device file based on preset rules and a shutdown operation instruction, and forwarding the shutdown operation instruction to a corresponding target LED indicator lamp through the updated character device file, so as to control the target LED indicator lamp to be extinguished, wherein the target LED indicator lamp is one of the LED indicator lamps that are lit

[0007] In a second aspect, the application provides a control device of an LED indicator lamp, applied to a user state of a target operating system, comprising:

[0008] a detection module, configured to detect, at preset time intervals, states corresponding to a plurality of LED indicator lamps in a character device file, wherein the character device file is generated by a kernel state based on operation instructions transmitted from the user state and acquired states of the LED indicator lamps;

[0009] a determination module, configured to determine whether the LED indicator lamps are lit based on the states of the LED indicator lamps, wherein an interrupt service routine located in the kernel state controls the LED indicator lamps to be lit by acquiring target instructions in the operation instructions;

[0010] a processing module, configured to, in a case where it is determined that the LED indicator lamps are lit, update the character device file based on preset rules and a shutdown operation instruction, and forward the shutdown operation instruction to a corresponding target LED indicator lamp through the updated character device file, so as to control the target LED indicator lamp to be extinguished, wherein the target LED indicator lamp is one of the LED indicator lamps that are lit.

[0011] In a third aspect, a control device of an air conditioner is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;

[0012] The memory is configured to store a computer program.

[0013] The processor is configured to execute the program stored in the memory, so as to implement the steps of the control method of the LED indicator lamp according to any one of the embodiments in the first aspect.

[0014] In a fourth aspect, a computer-readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, implements the steps of the control method of the LED indicator light according to any one of the embodiments of the first aspect.

[0015] Compared with the related art, the control method, device, electronic device and storage medium of the LED indicator light provided in the embodiments detect the states corresponding to a plurality of LED indicator lights in a character device file at preset time intervals, the character device file is generated by a kernel state based on the operation instructions transmitted from a user state and the acquired states of the indicator lights; based on the states of the LED indicator lights, it is determined whether the LED indicator lights are lit, an interrupt service routine under the kernel state controls the LED indicator lights to be lit by acquiring target instructions in the operation instructions; in the case where it is determined that the LED indicator lights are lit, the character device file is updated based on preset rules and a shutdown operation instruction, and the shutdown operation instruction is forwarded to the corresponding target LED indicator light through the updated character device file to control the target LED indicator light to be extinguished, solving the problem that the software interrupt of the interrupt service routine of the kernel of the operating system in the related art is increased in time, which is easy to cause the data transceiving to be crashed, the logical control of the LED indicator light being turned off is realized by using an independent process in the user state, the kernel state only sends a light signal and forwards the control instruction of the user state, and the processes in the kernel state and the user state cooperate to realize the stroboscopic of the LED indicator light, without adding the control of the LED indicator light being turned off into the driver of the kernel state of the operating system, and without increasing the time in the second half of the software interrupt of the interrupt service routine, so that the kernel execution time is reduced, the display effect of the stroboscopic of the LED indicator light is improved, and the kernel is prevented from being crashed.

[0016] The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the application will be apparent from the description and drawings, and from the claims. BRIEF DESCRIPTION OF DRAWINGS

[0017] The accompanying drawings, which are incorporated herein and form a part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, brief introductions to the drawings needed to be used in the embodiments or prior art descriptions will be given below. Obviously, for those of ordinary skill in the art, other drawings can also be obtained from these drawings without any creative effort.

[0019] Figure 1A flowchart of a control method of an LED indicator lamp provided by an embodiment of the present application is shown in the figure;

[0020] Figure 2 A block diagram of a system for controlling an LED indicator lamp according to an embodiment of the present application is shown in the figure;

[0021] Figure 3 A flowchart of a user-mode process operating an LED indicator lamp according to a preferred embodiment of the present application is shown in the figure;

[0022] Figure 4 A structural block diagram of a control device of an LED indicator lamp provided by an embodiment of the present application is shown in the figure;

[0023] Figure 5 A structural diagram of an electronic device according to an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION

[0024] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in connection with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0025] Before the computing solutions in the embodiments of the present application are described, the technical features involved in the present application are described as follows:

[0026] Linux: is a set of free and freely distributed Unix-like operating systems, which is a multi-user, multi-tasking, multi-threading and multi-CPU (Central Processing Unit, CPU) operating system based on Portable Operating System Interface (POSIX) and Unix. It can run major Unix tool software, applications and network protocols, and it supports 32-bit and 64-bit hardware. Linux inherits the design idea of Unix with network as the core, and is a stable multi-user network operating system.

[0027] Kernel state: CPU can access all data in memory, including peripheral devices such as hard disk and network card. CPU can also switch itself from one program to another program.

[0028] User state: can only access memory with restrictions, and is not allowed to access peripheral devices. The ability to occupy CPU is deprived, and CPU resources can be obtained by other programs.

[0029] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.

[0030] Figure 1 A flowchart of a control method of an LED indicator lamp provided in the embodiments of the present application is shown in FIG. 1. As shown in FIG. 1, the embodiments of the present application provide a control method of an LED indicator lamp, which comprises the following steps. Figure 1

[0031] In step S101, the states corresponding to a plurality of LED indicator lamps are detected in a character device file at a preset time interval, wherein the character device file is generated by a kernel state based on an operation instruction transmitted from a user state and the acquired states of the indicator lamps.

[0032] In the embodiments, an execution subject executing the control method of the embodiments runs in a user state of a target operating system, that is, a running process running in the user state, so as to realize the judgment logic for controlling the LED indicator lamp.

[0033] In the embodiments, the target operating system includes but is not limited to a Linux system, and the character device file in the embodiments of the present application refers to a character device file corresponding to a character device driven by a preset driver program in the kernel state, so as to build the character device file. In the embodiments, initialization, read and write operations of the device are added in an operation function corresponding to the character device file, which specifically includes: creating the initialization of the LED indicator lamp in an initialization function of the character device file, for example, setting the direction of GPIO as output; creating the lighting or extinguishing operation of the LED indicator lamp in a write function of the character device file, for example, pulling up or pulling down the level signal of GPIO; and creating the acquisition of the state of the LED indicator lamp in a read function of the character device file, for example, the current high or low state of the level signal of GPIO.

[0034] ​In the embodiment, the character device file is used for the user state to communicate with the kernel state, the process running in the kernel state generates the character device file for the process running in the user state to use, the process running in the user state obtains the states of all LED indicators through the character device file, and transmits the disable / enable instruction for judging whether the LED indicator can be operated and the LED indicator closing operation instruction into the character device file, meanwhile, the kernel state maps the obtained states of the LED indicators, for example, the lit LED indicator, to the character device file, and then forwards the corresponding states of the LED indicators to the user state; in the embodiment, the write interface function corresponding to the character device file is responsible for obtaining the instruction for judging whether the LED can be operated (LED disable / enable) and the LED closing operation transmitted from the user state, wherein the LED disable / enable is used for the interrupt service routine, the LED closing operation is used for the GPIO, and when the LED is closed is determined by the user state, and the kernel state is only used for forwarding.

[0035] In step S102, whether the LED indicator is lit is determined based on the state of the LED indicator, wherein the interrupt service routine in the kernel state controls the LED indicator to be lit by obtaining the target instruction in the operation instruction.

[0036] In the embodiment, the target instruction includes the enable operation instruction, which is used to represent the instruction for allowing the LED indicator to be operated, that is, the LED enable; in the embodiment, the flag for obtaining whether the LED indicator can be operated is added in the interrupt service routine, that is, the LED disable / enable is obtained, when the LED disable is obtained, no signal is sent to the LED indicator even if there is data transceiving, and when the LED enable is obtained, the lit signal is sent if there is data; in the embodiment, when the LED enable is obtained, that is, the corresponding interrupt service routine is started, the LED indicator associated therewith is lit under the lit signal sent by the interrupt service routine.

[0037] In the embodiment, when the LED indicator is lit, the process running in the kernel state can determine that the LED indicator is lit by detecting the relevant data transceiving port, and the process running in the kernel state can also detect that the corresponding LED indicator is closed.

[0038] In order to realize the stroboscopic display during the data transceiving, the lit LED indicator needs to be closed after a set time, so as to realize the display effect that the LED indicator blinks once and once again, therefore, in the embodiment, the lit LED indicator is detected, and then the LED indicator is allowed to be operated only after being lit for a set time, so as to determine the stroboscopic display effect during the data transceiving.

[0039] Step S103, in the case of determining that the LED indicator light is on, updating the character device file based on the preset rule and the off operation instruction, and forwarding the off operation instruction to the corresponding target LED indicator light through the updated character device file to control the target LED indicator light to be turned off, wherein the target LED indicator light is one of the turned-on LED indicator lights.

[0040] In the embodiment, the preset rule means that the LED indicator light is prohibited from being operated within a set time to make the LED indicator light in the on state, and after the set time arrives, the prohibition of operation is removed and the off operation instruction is forwarded to the corresponding LED indicator light through the character device file to realize turning off the LED indicator light, thereby realizing the blinking display effect of the LED indicator light.

[0041] Through the above steps S101 to S103, the states of the plurality of LED indicator lights corresponding to the character device file are detected at preset time intervals, the character device file is generated by the kernel state based on the operation instruction transmitted from the user state and the acquired indicator light state; based on the state of the LED indicator light, it is determined whether the LED indicator light is on, and the interrupt service routine in the kernel state controls the LED indicator light to be on by acquiring the target instruction in the operation instruction; in the case of determining that the LED indicator light is on, updating the character device file based on the preset rule and the off operation instruction, and forwarding the off operation instruction to the corresponding target LED indicator light through the updated character device file to control the target LED indicator light to be turned off, solving the problem of increasing the software interrupt of the interrupt service routine of the kernel of the operating system in the related art, which is easy to cause the data transceiving to crash, realizing the logical control of the LED indicator light off by the user state using an independent process, the kernel state only sends the light signal and forwards the control instruction of the user state, and the processes of the kernel state and the user state cooperate to realize the blinking of the LED indicator light, without adding the control of turning off the LED indicator light to the driver of the kernel state of the operating system, and without increasing the delay in the second half of the software interrupt of the interrupt service routine, realizing the beneficial effects of reducing the kernel execution time, improving the display effect of the LED indicator light blinking, and avoiding the kernel crash.

[0042] It should be noted that the process running in the user state sets time interval (for example: 50ms), queries all LED indicator states, and when the LED indicator is on, the prohibition operation instruction is issued and the kernel state is issued, the timer is enabled (the timer timing limit is 500ms), the timing time is up, the prohibition operation instruction is released, the prohibition operation instruction is issued to the kernel state, and the shutdown operation instruction is issued to the kernel state to turn off the LED indicator. The control method of the embodiment of the application realizes that the user of the interface does not need to care about the control of the LED indicator, and the data transmission is not affected by the control of the LED indicator, and the kernel crash caused by the increase of the delay in the interrupt service routine of the kernel state is avoided.

[0043] In some embodiments, in the case where it is judged that the LED indicator is on, the character device file is updated based on the preset rule and the shutdown operation instruction, which is realized by the following steps:

[0044] Step 21, when it is determined that the LED indicator is on, the prohibition operation instruction is issued to the kernel state, and the timer is used for timing to obtain the time length after the prohibition operation instruction is issued, wherein the prohibition operation instruction is used to represent that the LED indicator that is on is not allowed to be operated.

[0045] Step 22, in the case where the time length is greater than the preset time threshold, the shutdown operation instruction is issued to the kernel state, so that the kernel state updates the character device file based on the received shutdown operation instruction.

[0046] In some embodiments, before the shutdown operation instruction is issued to the kernel state, the following step is implemented: the enable operation instruction is issued to the kernel state, wherein the enable operation instruction is used to represent that the LED indicator that is on is allowed to be operated.

[0047] In this embodiment, after the prohibition operation instruction is issued to the kernel state, the set time is reached, and the LED indicator needs to be turned off at this time, but the shutdown operation instruction is directly issued, and the LED indicator is still in the state of not allowing operation, so the LED indicator cannot be turned off by the shutdown operation instruction. At this time, the prohibition operation instruction needs to be released first, and the LED indicator is turned off by the shutdown operation instruction. In this way, the prohibition operation instruction is released to avoid the LED indicator being turned off in advance due to the misissued instruction, so that the LED indicator cannot be frequency flashed at the set frequency.

[0048] In the embodiment, the process running in the user state inquires the states of all LED indicator lights at a set time interval (for example, 50 ms), and when an LED indicator light is on, an operation prohibition instruction is issued and a kernel state is issued, a timer is enabled (the time limit of the timer is 500 ms), and when the time limit is reached, the operation prohibition instruction is released, and a release operation prohibition instruction is issued to the kernel state and a close operation instruction is issued to the corresponding process running in the kernel state to turn off the LED indicator light.

[0049] By the above step of issuing an operation prohibition instruction to the corresponding process running in the kernel state when the LED indicator light is determined to be on, and using a timer to time the duration after the operation prohibition instruction is issued, in the case where the duration is greater than a preset time threshold, a close operation instruction is issued to the corresponding process running in the kernel state, so that the corresponding process running in the kernel state updates the character device file based on the received close operation instruction, which realizes updating of the character device file to accurately control the LED indicator light to be turned off, and realizes logical judgment of the process in the user state on the LED indicator light flickering, thereby improving the display effect of the LED indicator light flickering.

[0050] In some embodiments, the following step is also implemented: when the duration is less than the preset time threshold, the enable operation instruction is prohibited from being issued to the kernel state.

[0051] In the embodiment, after the operation prohibition instruction is issued to the corresponding process running in the kernel state, if the set time is not reached, the LED indicator light is prohibited from being operated, that is, at this time, if the user state judges that the corresponding LED indicator light is on and wants to turn off the LED indicator light, it cannot be executed, so as to ensure that each LED indicator light flickers at a set flickering frequency.

[0052] In some embodiments, the following step is also implemented: when it is determined that the LED indicator light is not on, it is determined that the interrupt service routine corresponding to the LED indicator light that is not on is not started.

[0053] In the embodiment, when the corresponding interrupt service is started, the corresponding LED indicator light is on, that is, the corresponding data transceiver is in operation, and when the LED indicator light is not on (not turned off), it indicates that the corresponding data transceiver port is not performing data transceiving, and it is meaningless to control the LED indicator light to flicker, therefore, in the embodiment, the closing control of the LED indicator light that is on is considered.

[0054] In some embodiments, before detecting the states of the plurality of LED indicator lights in the character device file at the preset time interval, the following step is also implemented: obtaining the states of the plurality of LED indicator lights based on the character device file.

[0055] In some embodiments, before determining that the ED indicator light is lit, the following step is further implemented: when determining that data is transmitted to the data transceiver port corresponding to the interrupt service routine and the enable operation instruction is obtained, the interrupt service routine in the kernel state sends a lighting signal to the LED indicator light associated with the corresponding data transceiver port.

[0056] In the embodiment, the interrupt service routine running in the kernel state is only responsible for sending a lighting signal to the corresponding LED indicator light when there is data and the LED indicator light is enabled, so as to realize the strobe of the LED indicator light in cooperation with the process running in the user state, that is, after the interrupt service routine controls the corresponding LED indicator light to be lit, the process running in the user state determines the state of the LED indicator light in real time, so as to control the LED indicator light to be extinguished at a set strobe frequency.

[0057] Figure 2 is a block diagram of the LED indicator light control system of the embodiment of the application, and the control method of the LED indicator light of the embodiment of the application is further described as follows: Figure 2

[0058] In the implementation of the control method of the embodiment, the user state process runs on the Linux system, a driver module creating a character device file is added on the kernel state, so as to be used for communication between the user state and the kernel state, and an enable operation instruction (corresponding to the LED indicator light signal sending function) is added in the interrupt service routine for controlling the LED indicator light, and specifically,

[0059] In the kernel state, a driver module creating a kyLED device is added, and the driver module creates a character device file for the user state.

[0060] The initialization of the character device file indicates that the direction of the GPIO is set to output, and all the indicator lights are initialized to a determined off state, that is, the initialization value is set to low level.

[0061] The write interface function of the character device file is responsible for obtaining the instruction (LED disable / enable) of whether the LED can be operated and the LED off operation transmitted from the user state, wherein the LED disable / enable is used for the interrupt service routine, and the LED off operation is used for the GPIO, and when to be off is determined by the user state, and the kernel state only forwards.

[0062] The read interface function of the character device file is responsible for obtaining the lighting state of the LED indicator light and forwarding it to the user state, and the kernel state only obtains the state and forwards it without any judgment processing.

[0063] ​In the kernel state, a flag is added in the interrupt service routine to acquire whether the LED indicator is operable, if the flag is LED disabled, the LED is not signaled even if there is data transceiving, if the flag is LED enabled, the LED is signaled if there is data.

[0064] In the user state, the flashing logic of the LED indicator is controlled by the user state process, the user state process inquires all LED states every 50 ms, if there is a LED indicator, the disabling operation flag is set and the kernel state is sent, the timer is enabled for 500 ms, when the time is up, the disabling is released and the kernel state is sent, and the kernel is sent to close the LED.

[0065] Reference Figure 2 The operating system performs the following operations as shown:

[0066] Step 1, a character device driver is created in the kernel state of the operating system, initialization, read and write operations of the device are added in the operation function corresponding to the character device file, for example, the initialization of the indicator is created in the initialization function of the character device file, such as the direction of the GPIO is set to output; the lighting or extinguishing operation of the indicator is created in the write function of the character device file, such as the level signal of the GPIO is pulled high or low; the state of the indicator is acquired in the read function of the device file, such as the level signal of the GPIO is currently high or low.

[0067] Step 2, the LED lighting signal sending operation is added in the interrupt service routine of the kernel state data transceiving, the lighting signal is immediately sent to the GPIO if there is data, this operation only takes the time of one cpu instruction and does not have any impact on the interrupt routine.

[0068] Step 3, the control operation of the equal state flashing is realized in the user state, the state indication of the indicator is realized by using an independent process in the user state.

[0069] The control method of the embodiment of the application uses the independent process in the user state to realize the logical control of the LED indicator, the kernel state only sends the lighting signal and forwards the control instruction of the user state, which greatly reduces the kernel execution time and also realizes the stroboscopic of the indicator.

[0070] Figure 3 The flowchart of the user state process of the preferred embodiment of the application operating the LED indicator is shown in reference Figure 3 The flowchart includes:

[0071] Step S301, the kyled device is opened, then step S302 is executed.

[0072] Step S302, all LED states of the device are acquired, then step S303 is executed.

[0073] Step S303, determine whether the LED indicator light is lit, if so, execute step S304, otherwise, repeat step S303.

[0074] Step S304, set the disable operation command, and send to the kernel state, then execute step S305.

[0075] Step S305, enable the timer 500 ms, then execute step S306.

[0076] Step S306, time to send the close operation instruction, then execute step S307.

[0077] Step S307, set the enable operation instruction, and send to the kernel state, then execute step S308.

[0078] Step S307, determine the next LED state, then execute step S303.

[0079] The embodiment also provides an LED indicator light control device, which is used to realize the above-mentioned embodiments and preferred embodiments, and has been described above. The terms "module", "unit", "sub-unit" and the like used below can be a combination of software and / or hardware that realizes a predetermined function. Although the device described in the following embodiments is preferably realized in software, hardware, or a combination of software and hardware is also possible and is contemplated.

[0080] Figure 4 is a structural block diagram of an LED indicator light control device provided by the embodiment, as shown in Figure 4 The embodiment provides an LED indicator light control device, which is applied to a user state of a target operating system, and includes:

[0081] The detection module 41 is configured to detect, at a preset time interval, states corresponding to a plurality of LED indicator lights in a character device file, wherein the character device file is generated by a kernel state based on an operation instruction transmitted from a user state and an acquired indicator light state.

[0082] The determination module 42 is coupled to the detection module 41 and configured to determine whether the LED indicator light is lit based on the state of the LED indicator light, wherein an interrupt service routine in the kernel state controls the LED indicator light to be lit by acquiring a target instruction in the operation instruction.

[0083] The processing module 43 is coupled to the determining module 42, and is configured to, in a case where it is determined that the LED indicator light is on, update the character device file based on a preset rule and a turn-off operation instruction, and forward the turn-off operation instruction to a corresponding target LED indicator light through the updated character device file, so as to control the target LED indicator light to be turned off, wherein the target LED indicator light is one of the LED indicator lights that are on.

[0084] The LED indicator light control device provided in the embodiments of the present application detects the states of the plurality of LED indicator lights in the character device file at preset time intervals, the character device file is generated by the kernel based on the operation instruction transmitted from the user and the states of the LED indicator lights; the LED indicator light is determined to be on or off based on the states of the LED indicator lights, the interrupt service routine in the kernel controls the LED indicator light to be on by obtaining the target instruction in the operation instruction; in a case where it is determined that the LED indicator light is on, the character device file is updated based on a preset rule and a turn-off operation instruction, and the turn-off operation instruction is forwarded to the corresponding target LED indicator light through the updated character device file, so as to control the target LED indicator light to be turned off, thereby solving the problem of the increase of the software interrupt of the interrupt service routine of the kernel of the operating system in the related art, which is easy to cause the data transmission to be crashed, the logical control of the LED indicator light is realized by using an independent process in the user state, and the kernel only needs to send the light-on signal and forward the control instruction of the user state, so as to complete the on-off control of the LED indicator light, reduce the kernel execution time, improve the display effect of the LED indicator light frequency flashing, and avoid the kernel crash.

[0085] In some embodiments, the processing module 43 further includes:

[0086] The timing unit is configured to, in a case where it is determined that the LED indicator light is on, issue a prohibition operation instruction to the kernel, and use a timer to count the time length after the prohibition operation instruction is issued, wherein the prohibition operation instruction is used to indicate that the LED indicator light that is on is not allowed to be operated.

[0087] The issuing unit is coupled to the timing unit, and is configured to, in a case where the time length is greater than a preset timing threshold, issue a turn-off operation instruction to the kernel, so that the kernel updates the character device file based on the received turn-off operation instruction.

[0088] In some embodiments, before the turn-off operation instruction is issued to the kernel, the LED indicator light control device is further configured to issue an enable operation instruction to the kernel, wherein the enable operation instruction is used to indicate that the LED indicator light that is on is allowed to be operated.

[0089] In some embodiments, the control device for the LED indicator is also used to prevent the issuance of enable operation commands to the kernel mode when the duration is less than a preset timing threshold.

[0090] In some embodiments, the control device for the LED indicator is further configured to determine that the interrupt service routine corresponding to the unlit LED indicator has not been started when it is determined that the LED indicator is not lit.

[0091] In some embodiments, the control device for the LED indicator is further configured to obtain the status of multiple LED indicators based on the character device file before detecting the status corresponding to multiple LED indicators in the character device file at preset time intervals. Figure 5 This is a schematic diagram of the structure of the electronic device according to an embodiment of this application, such as... Figure 5 As shown, this application provides an electronic device including a processor 51, a communication interface 52, a memory 53, and a communication bus 54. The processor 51, communication interface 52, and memory 53 communicate with each other via the communication bus 54.

[0092] Memory 53 is used to store computer programs;

[0093] When processor 51 executes the program stored in memory 53, it implements... Figure 1 The methods and steps in the text.

[0094] The processing in this electronic device Figure 1 The method steps described above, and the resulting technical effects, are the same as those achieved in the embodiments described above. Figure 1 The technical effect of the control method for LED indicator lights is the same as that in this paper, so it will not be repeated here.

[0095] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0096] The communication interface is used for communication between the aforementioned electronic device and other devices.

[0097] The memory can include a random access memory (RAM) and can also include a non-volatile memory, such as at least one disk memory. Optionally, the memory can also be at least one storage device located remotely from the aforementioned processor.

[0098] The aforementioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., and can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0099] The embodiment of the present application further provides a computer readable storage medium, which has a computer program stored thereon, and the computer program is executed by a processor to implement the steps of the LED indicator control method provided by any one of the foregoing method embodiments.

[0100] In another embodiment provided by the present application, a computer program product containing instructions, which, when executed on a computer, causes the computer to perform the steps of the LED indicator control method of any one of the foregoing embodiments.

[0101] It should be noted that, in the present document, relational terms such as "first" and "second", and the like, are used solely to distinguish one entity or action from another entity or action, without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without more limitations, an element defined by the phrase "comprising a... " does not exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0102] The foregoing is considered as illustrative only of the principles of the application. Numerous modifications and changes will readily occur to those skilled in the art, and it is intended to embrace all such modifications and changes that fall within the scope of the application. Accordingly, the application is not to be restricted in scope to the specific embodiments disclosed herein but is to be accorded the full scope that the principles and novel features request appropriately granted.

Claims

1. A method for controlling an LED indicator, running in the user mode of a target operating system, characterized in that, The control method includes: At preset time intervals, the status of multiple LED indicators is detected in the character device file. The character device file is generated by the kernel based on the operation instructions passed from the user mode and the obtained indicator status. The character device file is used for interactive communication between the user mode and the kernel mode. Based on the state of the LED indicator, it is determined whether the LED indicator is lit. The interrupt service routine located in the kernel mode controls the LED indicator to light up by obtaining the target instruction in the operation instruction. When it is determined that the LED indicator is lit, the character device file is updated based on preset rules and a shutdown operation command. The shutdown operation command is then forwarded to the corresponding target LED indicator through the updated character device file to control the target LED indicator to turn off. The target LED indicator is one of the lit LED indicators. The preset rule refers to prohibiting the operation of the LED indicator for a set time to keep the LED indicator lit, and lifting the prohibition after the set time is reached. The shutdown operation command is forwarded to the target LED indicator through the character device file.

2. The method according to claim 1, characterized in that, Upon detecting that the LED indicator is lit, the character device file is updated based on preset rules and a shutdown command, including: When it is determined that the LED indicator is lit, a prohibition operation command is sent to the kernel state, and a timer is used to count the time to obtain the duration after the prohibition operation command is sent. The prohibition operation command is used to indicate that operation of the lit LED indicator is not allowed. If the duration exceeds a preset timeout threshold, a shutdown operation command is sent to the kernel state, so that the kernel state updates the character device file based on the received shutdown operation command.

3. The method according to claim 2, characterized in that, Before issuing the shutdown operation instruction to the kernel state, the method further includes: issuing an enable operation instruction to the kernel state, wherein the enable operation instruction is used to characterize the LED indicator light that allows operation to be lit.

4. The method according to claim 3, characterized in that, When the duration is less than a preset timeout threshold, the enable operation instruction is prohibited from being sent to the kernel mode.

5. The method according to claim 3, characterized in that, The target instruction includes the enable operation instruction.

6. The method according to claim 1, characterized in that, When it is determined that the LED indicator is not lit, it is determined that the interrupt service routine corresponding to the unlit LED indicator has not been started.

7. The method according to claim 1, characterized in that, Before detecting the status of multiple LED indicators in the character device file at preset time intervals, the method further includes: obtaining the status of multiple LED indicators based on the character device file.

8. The method according to claim 1, characterized in that, Before determining that the LED indicator is lit, the method further includes: When the interrupt service routine determines that it is sending or receiving data to its corresponding data transceiver port and obtains an enable operation command, it sends a lighting signal to the LED indicator associated with the corresponding data transceiver port.

9. A control device for an LED indicator light, applied in the user mode of a target operating system, characterized in that, include: The detection module is used to detect the status of multiple LED indicators in a character device file at preset time intervals. The character device file is generated by the kernel based on the operation instructions passed from the user mode and the obtained indicator status. The character device file is used for interactive communication between the user mode and the kernel mode. The determination module is used to determine whether the LED indicator is lit based on the state of the LED indicator, wherein the interrupt service routine located in the kernel mode controls the LED indicator to light up by obtaining the target instruction in the operation instruction; The processing module is configured to, upon determining that the LED indicator is lit, update the character device file based on preset rules and a shutdown operation command, and forward the shutdown operation command to the corresponding target LED indicator through the updated character device file to control the target LED indicator to turn off. The target LED indicator is one of the lit LED indicators. The preset rules refer to prohibiting operation of the LED indicator for a set time to keep the LED indicator lit, and lifting the prohibition after the set time has elapsed. The module also forwards the shutdown operation command to the target LED indicator through the character device file.

10. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in a memory, implements the steps of the control method for an LED indicator as described in any one of claims 1-8.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the LED indicator control method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • LED display scanning method and frequency converter

    CN108074516A

  • Method and device for controlling flickering of set-top box indicator lamp

    CN111131896A