Abstract:
A monitoring method and apparatus applied to a computer system having a computer case, a controller and a register for changing the power state of the computer system according to the assembling state of the computer case is disclosed. The method comprises steps of detecting whether the computer case of the computer system is disassembled, generating a trigger signal to the controller when the computer case of the computer system is disassembled, generating a power management signal in response to the trigger signal for changing a system power state indicator of the register, and polling the system power state indicator and driving the computer system into a hibernation mode according to the change of the system power state indicator.

Description:
FIELD OF THE INVENTION  
       [0001]     The present invention relates to a monitoring method and apparatus for regulating the power state of a computer system according to the assembling state of a computer case.  
       BACKGROUND OF THE INVENTION  
       [0002]     With the advancement of science and technology, the popularity and development of computer system have gained a great achievement, and the evolvement of humanity enters into a new age. Thus, it is easily to observe people using the computer at home, office or public place. Accordingly, the Internet is also universally developed as well. The combination of computer and Internet brings more frequent and greater contacts between each Internet user and service providers. Therefore, the combination of computer system and computer network can be extensively applied to various technical or commercial services to bring illimitable potentials to human&#39;s life.  
         [0003]     In general, the computer system employs a power management system to conserve power. On Dec. 22, 1996, Intel, Microsoft and Toshiba jointly established and published an ACPI (Advanced Configuration and Power Interface) standard, which integrates power management into the operating system to improve the efficiency of power management and accelerate the processing speed of computer system through a unified interface for controlling the power supply operation of all hardware.  
         [0004]     According the definition of ACPI standard, the power management of computer system includes six modes, S0˜S5, in which S0 is a normal operating mode; S1˜S3 is power saving modes; S4 is a hibernation mode; and S5 is a power off mode. S1˜S4 modes are slightly different with each other in the sense of power saving. S1 mode represents that the operation of the computer system can be quickly recovered and no system context is lost. S2 mode is similar to S1 mode, but the contents of CPU cache and system memory are lost, and after the computer system is recovered, the operating system needs to maintain the contents of CPU cache and system memory. S3 mode is a suspended-to-RAM mode, in which only RAM and the power management controller are powered on and the other hardware is in the off state when the computer system enters the S3 mode. Certainly, after entering the S3 mode, the operation data of the computer system are stored in RAM, and when returning to the normal operating mode, the computer system will quickly restore these data from RAM. S4 mode is a suspend-to-disk mode, in which when the computer system enters the S4 mode, BIOS selects a backup disk partition with the size being equivalent to a system partition to store subsequent operation data of the computer system, and when returning to the normal operating mode, the computer system will restore these data from the backup disk partition.  
         [0005]     On the other hand, the computer system mainly includes a display, a computer host and other peripherals. The transmission between the computer host and the display is proceeded via the signal cable, and the other peripherals are electrically connected with the computer host. However, when a user is removing an important component of the computer system, such as a display card or CPU, he may not be aware whether the computer system is in a power off mode (S5) or a standby mode (S3). As a result, the destructions and damages of the computer system or important components will be inadvertently caused, since the computer system is not completely powered off while the important components therein are suddenly installed or removed.  
         [0006]     To overcome the defects of the above-mentioned prior art and to ensure the computer system is correctly powered off in order to avoid damages as a result of user&#39;s incautious operation for the removal of the internal components, some components having the hot swappable function are provided on the market, so that the components can be removed while the computer system is not completely powered off. However, not all components of the computer system support the hot swappable function, and the production costs of the components having the hot swappable function are very high. Thus, it is a problem needing to be overcome for the company who wants to promote their market competition with lower production costs.  
         [0007]     Therefore, it is needed to provide a method and apparatus for monitoring the power state of the computer system, which can overcome the defects of the above-mentioned prior art, and ensure that the computer system is in the S4 mode (suspend-to-disk mode) when the user is replacing the internal components of the computer system.  
       SUMMARY OF THE INVENTION  
       [0008]     It is an object of the present invention to provide a monitoring method and apparatus for regulating the power state of the computer system according to the assembling state of the computer case, so as to remove the defect of the traditional computer system that the computer system or its important component is damaged due to the incautious power-off event when the user is replacing an important component.  
         [0009]     To achieve the above-mentioned object, a monitoring method applied to a computer system having a computer case, a controller and a register for changing the power state of the computer system according to the assembling state of the computer case is disclosed. The method comprises steps of detecting whether the computer case of the computer system is disassembled; generating a trigger signal to the controller when the computer case of the computer system is disassembled; generating a power management signal in response to the trigger signal for changing a system power state indicator of the register; and driving the computer system into a hibernation mode according to the change of the system power state indicator.  
         [0010]     In another embodiment, a monitoring method applied to a computer system having a computer case, a controller and a register and working in a power-saving mode is disclosed. The method comprises steps of detecting whether the computer case of the computer system is disassembled; generating a trigger signal to the controller when the computer case of the computer system is disassembled; generating a power management signal in response to the trigger signal for changing a system power state indicator of the register; changing the power state of the computer system from the power-saving mode into a normal operating mode; and driving the computer system from the normal operating mode into a hibernation mode according to the change of the system power state indicator.  
         [0011]     To achieve the above-mentioned object, a monitoring apparatus applied to a computer system having a computer case for changing the power state of the computer system according to the assembling state of the computer case is further disclosed. The monitoring apparatus comprises a detecting component for detecting whether the computer case of the computer system is disassembled and generating a trigger signal when the computer case is disassembled; a controller electrically connected with the detecting component for generating a power management signal in response to the trigger signal; a register electrically connected with the controller and comprising a system power state indicator for indicating that the system power state of the computer system is to be changed in response to the power management signal; and a monitor system electrically connected with the register for polling the system power state indicator and driving the computer system into a hibernation mode according to the content of the system power state indicator.  
         [0012]     The above objects and advantages of the present invention will become more readily apparent to those ordinarily skilled in the art after reviewing the following detailed description and accompanying drawings, in which: 
     
    
     BRIEF DESCRIPTION OF THE DRAWINGS  
       [0013]      FIG. 1  is a block diagram of the circuit framework of the computer system used in the method for monitoring the power state of the computer system according to a preferred embodiment of the present invention;  
         [0014]      FIG. 2  is a flowchart of the method for monitoring the power state of the computer system according to a preferred embodiment of the present invention;  
         [0015]      FIG. 3 ( a ) is a schematic view showing the detecting component according to a preferred embodiment of the present invention; and  
         [0016]      FIG. 3 ( b ) is a schematic view showing the detecting component of  FIG. 3 ( a ) disposed on the computer case according to a preferred embodiment of the present invention. 
     
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT  
       [0017]     The present invention provides a method for monitoring the power state of the computer system through the detection of whether the computer case is disassembled by a detecting component disposed on the outside surface of the computer case. When the computer case is disassembled, a trigger signal is generated to inform the internal circuit of the computer system, so that the computer system can enter S4 (suspend-to-disk) mode defined by the ACPI standard from its original power state; thus, the subsequent operation data of the computer system can be stored in the disk partition with the size being equivalent to a system partition so as to avoid data loss. When the user is removing a component of the computer system, since almost all components are in a power off state, the damage of the system or component can be eliminated during the installation or removal process, so that the user can replace the component under a safe condition.  
         [0018]     Please refer to  FIG. 1 , which is a block diagram of the circuit framework of the computer system used in the method for monitoring the power state of the computer system according to a preferred embodiment of the present invention. As shown in  FIG. 1 , the computer system includes a display  101 , a display controller  102 , a CPU  103 , a RAM  104 , a system bus  105 , a hard disk  106 , a detecting component  107 , a general-purpose I/O port  108 , a controller  109 , a BIOS  110 , and a monitor system  111 . Preferably, the controller  109  is a S/B (southbridge) system controller.  
         [0019]     The detecting component  107  is electrically connected with the general-purpose I/O port  108  disposed on the main board (not shown) for dynamically detecting whether the lid (not shown) of the computer case is detached and generating a trigger signal to the S/B system controller  109  through the general-purpose I/O port  108  when the lid of the computer case is detached.  
         [0020]     When the S/B system controller  109  receives the trigger signal generated by the detecting component  107 , the state of an intrusion alarm data bit set in the S/B system controller  109  will be correspondingly changed according to the trigger signal, in order to generate a power management signal and transmit the power management signal to a register in the BIOS  110 .  
         [0021]     In this embodiment, the register is an I/O port register  1101  and includes a system power state indicator for storing the system power state that will be changed when the I/O port register  1101  receives the power management signal, which means the computer case of the computer system is disassembled and therefore the power state of the computer system is transformed into the S4 (suspend-to-disk mode) defined by the ACPI standard.  
         [0022]     A monitor system  111  is loaded during the boot procedure of computer system for dynamically detecting whether the system power state indicator of the I/O port register  1101  is changed. The monitor system  111  includes a monitor program  1111  and an I/O port driver  1112 , in which the I/O port driver  1112  enables the monitor program  1111  to poll the data of system power state indicator of the I/O port register  1101 . The monitor program  1111  can dynamically detect the change of system power state indicator of the I/O port register  1101  for driving the computer system into S4 (suspend-to-disk) mode when the system power state indicator is changed. Therefore, the subsequent operation data of the computer system can be stored in the disk partition with the size being equivalent to a system partition so as to avoid data loss, and when the user is installing or removing a component of the computer system, the damage of the system or component can be eliminated.  
         [0023]     As to the display  101 , display controller  102 , CPU  103 , RAM  104 , system bus  105 , and hard disk  106 , since their circuit design principles and the functions are well known by one skilled in the art, they are not described here for simplicity.  
         [0024]     Please refer to  FIG. 2 , which shows a flowchart of the method for monitoring the power state of the computer system according to a preferred embodiment of the present invention. First, the determination of whether the detachable lid of the computer case of the computer system is detached (step S 20 ) is made by the detecting component  107 . If the lid of the computer case is detached, a trigger signal is generated and transmitted through the general-purpose I/O port  108  to the S/B system controller  109  (step S 21 ). Then the intrusion alarm data bit in the S/B system controller  109  is correspondingly changed according to the trigger signal to generate a power management signal and transmit the power management signal to the I/O port register  1101  in the BIOS  110  (step S 22 ). Afterward, the content of the system power state indicator stored in the I/O port register  1101  is changed in response to the power management signal, which means the power state of the computer system needs to be transformed into the S4 (suspend-to-disk) mode (step S 23 ).  
         [0025]     Since the power state of the computer system might be S0 (normal operating mode) or one of the power-saving modes (S1, S2 and S3 mode), when the computer case is disassembled by the user, the method of the present embodiment continues with the next step of detecting whether the original power state of the computer system is in S0 mode or not by BIOS (step S 24 ).  
         [0026]     When the original power state of the computer system is in S0 (normal operating mode), the monitor program  1111  polls the system power state indicator of the I/O port register  101  and drives the computer system from S0 mode into S4 (suspend-to-disk) mode according to the content thereof (step S 25 ) for storing the subsequent operation data of the computer system in the disk partition with the size being equivalent to the system partition to avoid data loss.  
         [0027]     When the original power state of the computer system is in one of the power-saving mode, for example, S3 mode, the related devices that are turned off when entering the S3 mode, such as CPU, RAM controller, chipset or cache, are awaken by the BIOS  110 . Then the monitor program  1111  polls the system power state indicator of the I/O port register  1101  and drives the computer system from S0 mode into S4 (suspend-to-disk) mode according to the content thereof (step S 25 ) for storing the subsequent operation data of the computer system in the disk partition with the size being equivalent to the system partition to avoid data loss.  
         [0028]     Therefore, it can be ensured that when the user is removing the important component of the computer system, the computer system is forced to stay in the S4 mode to avoid data loss, and since almost all components are in power off state, the damage of the computer system or component can be eliminated during the installation or removal process.  
         [0029]     Please refer to  FIG. 3 ( a ), which is a schematic view showing the detecting component according to a preferred embodiment of the present invention. In this embodiment, the detecting component  107  is a switch component having a roll structure  1071  and is fixedly mounted on the outside surface of the computer case  30  via a plurality of screws  1073  (as shown in  FIG. 3 ( b )). When the lid of the computer case  30  is not detached, the roll structure  1071  of the detecting component  107  is configured to lean against the lid of the computer case  30 . When the lid of the computer case  30  is detached, the roll structure  1071  of the detecting component  107  does not lean against the lid of the computer case  30 , and therefore it is determined that the lid cover of the computer case  30  is detached so as to further generate the trigger signal.  
         [0030]     The detecting component  107  has transmission lines  1072  to be electrically connected with the general-purpose I/O port  108  disposed on the main board  31  for transmitting the trigger signal to the S/B system controller  109 .  
         [0031]     Of course, the aforesaid detecting component  107  is merely an embodiment of the present invention, and its structure shall not be limited thereby. Instead, any detecting component which can be used to detect whether the lid of the computer case is detached can be applied in the present invention.  
         [0032]     In conclusion, the method for monitoring the power state of the computer system provided in the present invention employs the detecting component to generate and transmit the trigger signal to the internal circuit of the computer system when the lid of the computer case is detached, so that the monitor program can detect that the power state of the computer system needs to be transformed into the S4 mode, and thus the subsequent operation data of the computer system can be stored in the disk partition with the size being equivalent to a system partition so as to avoid data loss, and the damage of the computer system or component can be eliminated during the installation or removal process.  
         [0033]     While the invention has been described in terms of what is presently considered to be the most practical and preferred embodiments, it is to be understood that the invention needs not be limited to the disclosed embodiment. On the contrary, it is intended to cover various modifications and similar arrangements included within the spirit and scope of the appended claims which are to be accorded with the broadest interpretation so as to encompass all such modifications and similar structures.