Patent Publication Number: US-2019197022-A1

Title: Method for controlling activity indicators of an electronic appliance

Description:
TECHNICAL FIELD 
     The present disclosure relates to a method for controlling activity indicators of an electronic appliance. 
     BACKGROUND 
     Electronic appliances are equipped with activity indicators, typically visual indicators in form of diodes (e.g. LEDs), which are used to show up/down status of various interfaces of the appliance, e.g. DSL, Wi-Fi, LAN, USB. When the status of the particular interface is “up”, the corresponding indicator can for example blink whenever a data transfer is being performed at the moment. This is usually implemented by modifying drivers of each type of the interface to make them provide active notifications of switching between “active” and “idle” state. Then such notifications (carrying information about activity/being idle) are routed to the appropriate indicators and trigger blinking. 
     The solution based on triggering activity status directly from drivers of particular interfaces usually requires modifying a source code of each driver, e.g. injecting calls to an API at proper places of the original code, without changing its behaviour and with respect to timing constraints. In case of binary drivers this is impossible and in other cases doing such change may be forbidden by the license, not advisable due to e.g. voiding warranty, or simply impractical due to the amount of workload. Delivering modified interface drivers increases maintenance cost significantly. 
     Therefore, there is a need to provide a method for controlling activity indicators of electronic appliances connected to computer networks or equipped with USB host-type ports, in which the appropriate indicators are operated basing on statistics provided by interface drivers. 
     SUMMARY 
     There is disclosed a method for controlling activity indicators for indicating activity of interface drivers of an electronic appliance, wherein the electronic appliance comprises a memory with a file system, wherein each interface driver has associated a corresponding directory in the file system for storing files representative of an activity of the interface driver, the method comprising periodically performing a background process comprising: calculating a current message digest for the file corresponding to the interface driver activity; comparing the message digest with the last stored message digest; upon detecting a change of the message digest, generating a state message for the activity indicator corresponding to the interface driver; sending the state message the activity indicator. 
     The method may comprise sending the state message the activity indicator via an indicator driver. 
     The file system may comprise first level patterns related to directories corresponding to interface drivers and second level patterns related to files corresponding to interface driver activity. 
     Calculating the message digest may comprise calculating a hash function for collapsing a content of any number of files under any number of sub-directories into a fixed-size byte buffer. 
     There is also disclosed a computer program comprising program code means for performing all the steps of the computer-implemented method as described above when said program is run on a computer, as well as a computer readable medium storing computer-executable instructions performing all the steps of the computer-implemented method as described above when executed on a computer. 
     There is also disclosed an electronic appliance comprising: activity indicators for indicating activity of interface drivers of the electronic appliance; a memory with a file system; wherein each interface driver has associated a corresponding directory in the file system for storing files representative of an activity of the interface driver; characterized in that the electronic appliance further comprises a processor configured to periodically operate a background process configured to: calculate a current message digest for the file corresponding to the interface driver activity; compare the message digest with the last stored message digest; upon detecting a change of the message digest, generate a state message for the activity indicator corresponding to the interface driver; send the state message the activity indicator. 
    
    
     
       BRIEF DESCRIPTION OF DRAWINGS 
       The method presented herein is presented by means of example embodiments on a drawing, wherein: 
         FIG. 1  presents a simplified structure of a typical SoC-based (System on Chip) router; 
         FIG. 2A  presents controlling activity indicators in a typical prior art appliance; 
         FIG. 2B  presents controlling the activity indicators according to the method of the present invention in an electronic appliance; 
         FIG. 2C  presents CPU modules; 
         FIG. 3A  presents data stored in a memory; 
         FIG. 3B  presents an example of memory contents; 
         FIGS. 4A-4B  present a flowchart of the method for controlling the activity indicators; 
         FIG. 5  presents an example of file system directories for network interfaces with matching sample system-level names. 
     
    
    
     NOTATION AND NOMENCLATURE 
     Some portions of the detailed description which follows are presented in terms of data processing procedures, steps or other symbolic representations of operations on data bits that can be performed on computer memory. Therefore, a computer executes such logical steps thus requiring physical manipulations of physical quantities. 
     Usually these quantities take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared, and otherwise manipulated in a computer system. For reasons of common usage, these signals are referred to as bits, packets, messages, values, elements, symbols, characters, terms, numbers, or the like. 
     Additionally, all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Terms such as “processing” or “creating” or “transferring” or “executing” or “determining” or “detecting” or “obtaining” or “selecting” or “calculating” or “generating” or the like, refer to the action and processes of a computer system that manipulates and transforms data represented as physical (electronic) quantities within the computer&#39;s registers and memories into other data similarly represented as physical quantities within the memories or registers or other such information storage. 
     A computer-readable (storage) medium, such as referred to herein, typically may be non-transitory and/or comprise a non-transitory device. In this context, a non-transitory storage medium may include a device that may be tangible, meaning that the device has a concrete physical form, although the device may change its physical state. Thus, for example, non-transitory refers to a device remaining tangible despite a change in state. 
     DETAILED DESCRIPTION 
       FIG. 1  presents a simplified structure of an example of an electronic appliance (in particular, a networking appliance)—a typical SoC-based (System on Chip) router. The router is equipped with a system on chip  110  module, which comprises a CPU  111  with a LED driver  113 , a LAN switch  112 , a memory unit  114  including RAM  114 A and Flash  114 B blocks. The router also comprises other external interfaces: a DSL line connector  130 , a WAN Ethernet port  140 , LAN Ethernet ports  121 - 124 , a USB port  150  and LED indicators  161 - 164 . 
     The example presented herein comprises LED indicators  161 - 164 , but any other types of indicators can be used (including other visual indicators, or audio indicators), being controlled individually or by a common indicator driver  113 . 
       FIG. 2A  presents details of controlling activity indicators in a typical prior art appliance. The electronic appliance utilizes several interface drivers (in particular, external interfaces, and more particularly, networking interfaces), such as: a WAN Ethernet driver  230 , a DSL driver  240 , a host USB driver  250 . Each driver  230 ,  240 ,  250  which performs operations considered as activity to be indicated by visual indicators  161 ,  162 ,  163 ,  164  (e.g. LEDs) makes calls to a corresponding LED trigger  261 ,  262 ,  263 . Whenever an operation of interest is performed (e.g. a single network packet is transmitted or received, or a single USB request block is transferred), the driver makes a call to one of the corresponding LED triggers  261 ,  262 ,  263 , which changes its state to ACTIVE and launches a timer. In case when another call occurs before the timer fires, the ACTIVE state is kept, and the timer is prolonged. In case the timer triggers before next call, the LED trigger changes the state back to INACTIVE. The timeout is tuned to a value greater than a period of incoming calls during normal continuous operation, so that for example during transfer of a larger block of data via a USB the USB host driver  250  periodically calls the LED trigger  263 , with a frequency such that the timer doesn&#39;t fire and the LED trigger  263  keeps the ACTIVE state until the transfer is finished. The LED triggers  261 ,  262 ,  263  pass the activity state transition messages (from INACTIVE to ACTIVE and vice-versa) for each LED indicator  161 - 164 , to a LED driver  113 . The LED driver  113  maps each activity state received from the LED triggers  261 ,  262 ,  263  to the particular LED indicator  161 - 164 , because whenever a mapping changes, a configuration manager  280  (depicted in  FIG. 2C ) invokes a helper program LED configurator  220  which passes that mapping to the LED driver  113 . Simultaneously, all involved drivers  230 ,  240 ,  250  perform operations necessary to make their statistics via a file system interface/manager  210 . The statistics are available to the rest of the system (e.g. number of received/transmitted packets/bytes, and many more), but these data are not used by the above method for indicating activity status. 
       FIG. 2B  presents details of controlling the activity indicators in an electronic appliance according to the method of the present invention. The method according to the invention does not rely directly on the interface drivers  230 ,  240 ,  250 . The method involves launching a new background process, called a LED daemon  270 . The LED daemon  270  monitors statistics of all relevant interface drivers  230 ,  240 ,  250  via the file system interface  210  and transforms the changes in statistics to the activity state transition messages (as shown in  FIG. 4A, 4B ) and controls the LED driver  113  directly. The interface drivers  230 ,  240 ,  250  do not make any specific calls for triggering the activity of the indication LEDs  161 - 164 , they just provide the generic statistics about the transmitted/received data blocks. The Configuration manager  280  transfers a configuration data to the LED daemon  270  by means of IPC (Inter-Process Communication) instead of invoking a short-lived LED configuration helper program  220 . The LED daemon  270  saves that information in the LED configuration memory block  370  and utilizes it to control the LED driver  113 . 
       FIG. 2C  presents a structure of a CPU  111  with modules relevant to the present invention. The Central Processing Unit (CPU)  111  comprises the Configuration manager  280  for transferring the LED indicators configuration data to the LED daemon  270 . The LED daemon  270  saves the configuration in the memory and controls the LED driver  113 . The LED driver controls the LED indicators  161 - 164 . The CPU further comprises interface drivers, such as the WAN Ethernet driver  230  for controlling the network traffic over the WAN Ethernet port  140 , the DSL driver  240  for controlling the network traffic over the DSL line  130  and the Host USB driver  250  for controlling data transfer over the USB port  150 . 
       FIG. 3A  presents data transferred by the Configuration manager  380  concerning each LED indicator, which is stored in the memory  114 . Data is stored in containers, such as tables, files or other data types. 
     A LEDs IDs block  310  comprises information concerning identification data of the LED indicator. 
     A last activity status (lastACT)  350  comprises information concerning previous activity status of the LED indicator. 
     First level patterns  320  comprise information concerning patterns of matching file system directories (directory names related the group of interface drivers of interest). 
     Second level patterns  330  comprise information concerning patterns of relevant files (such as enumerated list of files, underneath each directory matching the first pattern, which contribute to the state of activity of an interface). For example, a file related to a networking interface may contain information about the number of received and transmitted packets, and a file related to a USB interface may contain information about number of transmitted URB request blocks. 
     A last computed hash function values  340  comprise information concerning last known value of the message digest for comparing it against newly computed one. The hash function is used to collapse the content of any number of files under any number of subdirectories into a fixed-size byte buffer (by calculating a message digest of their content). 
     Statistics  360  comprise statistic information concerning particular interface driver activity. 
     A LED configuration  370  comprises system-specific information needed by the LED daemon  270  to control the LED driver  113  properly. This, for example, may include a list of numbers of GPIO (General-Purpose Input/Output) lines to turn the LED on and off initially and upon transition from the ACTIVE to INACTIVE state, and a list of GPIO lines to turn the LED on and off during each step of blinking duty cycle. 
       FIG. 3B  presents an example of the content of the memory  114 . The first set of data concerns the DSL indicator, whose ID is stored in the LEDs ID block  311 . The value of the last activity status  351  is equal 0. The first level patterns directory path of the matching file system  321  is “/sys/class/net/atm*,ptm*”, while the second level patterns directory of relevant files  331  is “statistics/tx_packets,statistics/rx_packets”. The last computed hash function value  341  is equal “40be0a9513f644a98207bfaede17802a”. The LED configuration is the DSL LED configuration  371 . The statistics information are stored in statistics block  360 . The second data set stored in blocks  312 ,  352 ,  322 ,  332 ,  342 ,  372 , corresponding to the blocks of the first set, concerns Wi-Fi LED indicator. 
       FIGS. 4A-4B  present a flowchart of the method for controlling the activity indicators. The method in this example assumes that the interface drivers&#39; statistics are exposed via a file system. Particularly, a specific path in the file system may contain subdirectories named after interfaces (such as network devices or USB devices), and inside those subdirectories may be stored a hierarchy of sub-subdirectoris containing files with particular values essential from the point of view of monitoring the activity of the relevant interface. 
     The procedure shown in  FIGS. 4A, 4B  is operated by the background process  270  periodically, i.e. once the procedure finishes after step  421 , it is started again in step  401  after expiry of a pooling period from the beginning of the previous run of the procedure. 
     The pooling period between consecutive runs of the procedure should be:
         greater than the minimal time needed by an interface to make an action (e.g. transmit or receive a single packet);   greater than minimal perceivable blinking period of a visual activity indicator; and   not greater than acceptable delay of indicating activity/lack of activity with a visual indicator.
 
For example, the pooling period may be set to a value of 500 ms.
       

     First, in step  401 , a context of a message digest calculation is initialized (such as calculating an MD5 sum). Next, in step  402 , a parent directory extracted from the first pattern is opened. In step  403 , it is checked if there are any directory entries left. If so, then in step  404  a next directory entry is retrieved. In step  405  it is checked if the retrieved entry refers to a directory. If not, the method returns to step  403 , otherwise it continues to step  406 , in which it is checked if the retrieved entry name matches the first pattern. If not, the method returns to step  403 , otherwise it continues to step  407 , in which the sub-directory referred by the retrieved entry is opened. Next, in step  408 , it is checked if there are any sub-directory entries left. If not, the method loops to step  403 , otherwise it continues to step  409 , in which next sub-directory entry is retrieved. In step  410  it is checked if the retrieved entry refers to a directory. If so, the method loops back to step  408 , otherwise it continues to step  411 , in which it is checked if the retrieved entry name matches the second pattern. If not, the method loops back to step  408 , otherwise it continues to step  412 , in which the file referred by the entry is opened. Next, in step  413 , the content of the file is transferred to the message digest calculation procedure and the method loops back to step  408 . 
     If in step  403  there are no directories entries left, then in step  414  the message digest calculation procedure is finalized. Next, in step  415 , the currently calculated message digest is collected and in step  416  it is compared against the last stored message digest. In step  417 , if the newly calculated message digest differs from the stored message digest, then the value of the actual state is changed to 1 (ACT=1), and if both message digests are the same then the value of the actual state is changed to 0 (ACT=0). Next, in step  418 , the stored message digest is replaced with the new message digest calculated in step  414 . Next, in step  419 , it is checked if the actual state value is equal to 1 and if the last state value is equal to 0 (if the ACT=1 and the lastACT=0). If so, then in step  420  the activity indication is started and in step  421  the actual state value is assigned to the last state value variable (lastACT=ACT). If in step  419  the condition is not fulfilled, then in step  422  it is checked if the actual state value is equal to 0 and if the last state value is equal to 1 (if the ACT=0 and the lastACT=1). If not, the method continues directly to step  421 , otherwise in step  423  the activity indication is stopped and then the method continues to step  421 , after which the method is terminated. 
     When the activity indication is started in step  420 , a state message is sent to the LED driver  113  to activate a particular indicator  161 - 164  corresponding to the active interface driver  230 - 250 . When the activity indication is stopped in step  423 , a state message is sent to the LED driver  113  to de-activate a particular indicator  161 - 164  corresponding to the inactive interface driver  230 - 250 . 
       FIG. 5  shows an example of file system directories for network interfaces with system-level names matching “en*”, including statistics for time moments t 0 , t 1  and t 2 . As indicated, statistics for interface “enol” have changed between t 0  and t 1 , which can be detected by comparing the MD5 sums. 
     Activity transition from No to Yes enters a mode in which configured steps of blinking duty cycles are executed periodically. 
     Activity transition from Yes to No aborts periodic execution of configured duty cycles and re-applies configured initial state of appropriate visual indicator(s), e.g. switches LED(s) on. 
     At least parts of the methods according to the invention may be computer implemented. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, micro-code, etc.) or an embodiment combining software and hardware aspects that may all generally be referred to herein as a “circuit”, “module” or “system”. 
     Furthermore, the present invention may take the form of a computer program product embodied in any tangible medium of expression having computer usable program code embodied in the medium. 
     It can be easily recognized, by one skilled in the art, that the aforementioned method for controlling the activity indicators of electronic appliances may be performed and/or controlled by one or more computer programs. Such computer programs are typically executed by utilizing the computing resources in a computing device. Applications are stored on a non-transitory medium. An example of a non-transitory medium is a non-volatile memory, for example a flash memory while an example of a volatile memory is RAM. The computer instructions are executed by a processor. These memories are exemplary recording media for storing computer programs comprising computer-executable instructions performing all the steps of the computer-implemented method according the technical concept presented herein. 
     While the invention presented herein has been depicted, described, and has been defined with reference to particular preferred embodiments, such references and examples of implementation in the foregoing specification do not imply any limitation on the invention. It will, however, be evident that various modifications and changes may be made thereto without departing from the broader scope of the technical concept. The presented preferred embodiments are exemplary only, and are not exhaustive of the scope of the technical concept presented herein. 
     Accordingly, the scope of protection is not limited to the preferred embodiments described in the specification, but is only limited by the claims that follow.