Abstract:
A device connected to a bus and a device driver for controlling the device, capable of preventing the device from falling into a forced use suspension (disable) state. Prior to notice of power consumption by a USB device connected to the bus(USB), the device driver acquires knowledge of remaining electric power that can be supplied by the bus. According to whether the remaining electric power is satisfactory for power consumption expected to be notified of by the USB device, the device driver permits the notice of power consumption by the USB device and causes the bus to start electric power supply, or executes avoidance processing in order to avoid shortage of power.

Description:
BACKGROUND OF THE INVENTION  
         [0001]    1. Field of the Invention  
           [0002]    The present invention relates to a device driver for controlling a device connected to a bus, and a device supplied with electric power from the bus.  
           [0003]    2. Description of Related Art  
           [0004]    Conventionally, a bus for connecting a peripheral device is provided in a main body of a personal computer or the like. A device driver for controlling the peripheral device connected to the bus is incorporated in the main body. Furthermore, in recent years, a universal serial bus (hereafter referred to as USB) has become a standard interface of personal computers.  
           [0005]    A plurality of devices (hereafter referred to as USB devices) can be connected to the USB. In low power USB devices among such USB devices, devices (bus power device) supplied with electric power from the USB also exist.  
           [0006]    As the USB spreads, however, the proportion of USB devices to devices connected to personal computers is increasing. The number of USB devices connected to each personal computer is also increasing. In some cases, therefore, the total power consumption of a USB device exceeds permissible supplied electric power of the USB provided in the personal computer. In such a case, in order to avoid imposing an abnormal load on the personal computer, there is adopted in the USB a scheme in which each USB device is caused to notify the bus of power consumption beforehand and the USB device is brought into a forced use suspension (disable) state when its power consumption cannot be satisfied with the permissible supplied electric power.  
           [0007]    Recently, however, USB devices are being adopted in devices each having a battery, such as portable telephones, as well. In such a USB device having a battery, not only electric power for operation of an electronic circuit but also electric power for charging the battery is supplied from the USB. Such a USB device causing largely different power consumption at the time of operation and having a plurality of functions typically notifies the bus side of power consumption in a function causing the greatest power consumption. Even in the case where only the operation of the electronic circuit is necessary, therefore, the USB device requests more electric power than is necessary from the host, often resulting in the forced use suspension (disable) state.  
           [0008]    There is also a USB device of such in which power consumption is switched from function to function and a notice to that effect is sent to the bus side. When switching to a function causing large power consumption is effected, however, the USB device falls into a forced use suspension (disable) state in some cases.  
           [0009]    Once the USB device falls into such a forced use suspension (disable) state, thereafter the USB device cannot be used at all, unless reconnection of the USB device is conducted. Therefore, it becomes necessary for the user to operate the USB device carefully so as to prevent the USB device from falling into the forced use suspension (disable) state, resulting in a troublesome operation.  
           [0010]    This problem occurs not only in USB buses but also in arbitrary buses each capable of being connected to a plurality of devices and supplying electric power to the devices.  
         SUMMARY OF THE INVENTION  
         [0011]    In view of the above described circumstances, an object of the present invention is to provide a device driver and a device capable of easily preventing the device from falling into the forced use suspension (disable) state.  
           [0012]    A device driver according to the present invention that achieves the object is a device driver for controlling devices of recipient type connected to a bus capable of being connected to a plurality of devices and supplying electric power to the connected devices, each of the devices notifying the bus of power consumption and being supplied with electric power, the device driver including: a remaining power knowledge acquisition section for acquiring knowledge of remaining electric power that can be supplied by the bus, prior to notice of power consumption by a device of recipient type connected to the bus; and an electric power supply control section for permitting the notice of power consumption by the device of recipient type and causing the bus to start electric power supply, or executing avoidance processing in order to avoid shortage of power, according to whether the remaining electric power the knowledge of which has been acquired by the remaining power knowledge acquisition section is satisfactory for power consumption expected to be notified of by the device of recipient type.  
           [0013]    Herein, “power consumption expected to be notified of” may be the one stored in the device of recipient type, or may be incorporated in the device driver itself beforehand.  
           [0014]    In the device driver of the present invention, “as the avoidance processing, the electric power supply control section may cause a predetermined display device to display a warning message, prior to the notice of power consumption by the device of recipient type, and wait for a predetermined start operation in order to permit the notice of power consumption and cause the bus to start electric power supply”, and “as the avoidance processing, the electric power supply control section may cause the device of recipient type to send a notice of power consumption satisfied by the remaining electric power and cause the device of recipient type to operate within the power consumption of the notice.” 
           [0015]    In the case of the avoidance processing of displaying a warning message and waiting for a start operation, the user of the device of recipient type can recognize that the remaining power is insufficient by the warning message, and avoid the forced use suspension (disable) state by disconnecting another unnecessary device from the bus to ensure power and then conducting start operation.  
           [0016]    In the case of the avoidance processing of causing the device of recipient type to send a notice of power consumption satisfied by the remaining electric power, the forced use suspension (disable) state can be avoided automatically.  
           [0017]    The device driver of the present invention may have such a format that “the remaining power knowledge acquisition section acquires knowledge of remaining electric power when the device of recipient type is connected to the bus” and may have such a format that “the device of recipient type has a plurality of operation modes differing from each other in power consumption, and newly notifies the bus of power consumption when the operation mode is altered, and the remaining power knowledge acquisition section acquires knowledge of remaining electric power when the operation mode of the device of recipient type is altered.” 
           [0018]    Preferably, in the device driver of the present invention, “the device of recipient type has a plurality of operation modes differing from each other in power consumption, and the electric power supply control section causes the device of recipient type to notify the bus of maximum power consumption, when the remaining electric power the knowledge of which has been acquired by the remaining power knowledge acquisition section is satisfactory for maximum power consumption among power consumption values respectively of the plurality of operation modes.” According to the device driver of such a form, power for the device of recipient type is ensured at the time when the remaining power is sufficiently large. Whichever mode is selected thereafter, therefore, the forced use suspension (disable) state is avoided.  
           [0019]    The device driver of the present invention may have such a form that “the device of recipient type stores a plurality of power consumption values to notify the bus of the plurality of power consumption values, and the electric power supply control section selects one of the plurality of power consumption values stored in the device of recipient type and thereby causes the device of recipient type to notify the bus of the selected power consumption value.” In a preferred form, however, “the device of recipient type rewritably stores the power consumption values to notify the bus of the power consumption values and the electric power supply control section rewrites the power consumption values stored in the device of recipient type and thereby causes the device of recipient type to notify the bus of the rewritten power consumption values”. According to the device driver of such a form, memory elements to be prepared in the device of recipient type can be held down and the cost of the device of recipient type can be held down.  
           [0020]    A device according to the present invention that achieves the object is a device connected to a bus and supplied with electric power from the bus by notifying the bus of power consumption, the device including: a power control section responsive to the power consumption being excessive as compared with a supply capability of the bus, for shifting the device to an operation state in which the device operates with reduced power consumption as compared with the excessive power consumption; and a power notice section responsive to a shift to the operation state, for notifying the bus of power consumption in the operation state.  
           [0021]    According to the device of the present invention, the operation state is shifted when power consumption has exceeded the supply capability of the bus, and the power consumption is reduced, whereby the forced use suspension (disable) state is avoided.  
           [0022]    According to the device driver and devices of the present invention, it becomes possible to easily avoid the forced use suspension (disable) state and keep the devices always operating as heretofore described. 
       
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS  
       [0023]    [0023]FIG. 1 is a diagram showing a computer system to which an embodiment of a device driver according to the present invention is applied;  
         [0024]    [0024]FIG. 2 is a diagram showing a configuration of a device driver;  
         [0025]    [0025]FIG. 3 is a diagram showing storage contents of a configuration descriptor  22 ;  
         [0026]    [0026]FIG. 4 is a diagram showing standard requests provided in a USB;  
         [0027]    [0027]FIG. 5 is a diagram showing a former stage of a control operation procedure in a first embodiment;  
         [0028]    [0028]FIG. 6 is a diagram showing a latter stage of a control operation procedure in the first embodiment;  
         [0029]    [0029]FIG. 7 is a diagram showing a control operation procedure in the second embodiment;  
         [0030]    [0030]FIG. 8 is a diagram showing a computer system to which a third embodiment is applied; and  
         [0031]    [0031]FIG. 9 is a diagram showing a control operation procedure in the third embodiment. 
     
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS  
       [0032]    Hereafter, embodiments of the present invention will be described.  
         [0033]    [0033]FIG. 1 is a diagram showing a computer system to which an embodiment of a device driver according to the present invention is applied.  
         [0034]    A computer system  1  having a computer main body  10  and a USB device  20  is shown in FIG. 1. The computer system  1  includes a display, which is not illustrated.  
         [0035]    The computer main body  10  includes a USB  13 . The USB  13  includes a host controller  11  and three bus lines  12  controlled by the host controller  11 . Each of the bus lines  12  consists of a connector and a cable. The USB device  20  is connected to one of the bus lines  12  of the USB  13  via a USB_I/F  21 . The USB device  20  is an example of a device referred in the present invention to as device of recipient type, and it is supplied with electric power from the USB  13 . By branching three bus lines  12 , a maximum of 127 devices can be connected to the USB  13 . The USB  13  can supply electric power to a plurality of devices of recipient type so long as it dose not exceed a predetermined upper power limit.  
         [0036]    There are installed in the computer main body  10  an OS (Operating System)  14  for conducting basic management on the whole computer system  1 , an application  15  for making the computer system  1  as a device that performs a predetermined function, and a device driver  100  for the USB device  20  for controlling the USB device  20 . The device driver  100  has been stored in a CD-ROM  200 . The CD-ROM  200  is loaded on a CD drive, which is provided in the computer system  1  and which is not illustrated, and read into the computer main body  10  and installed therein. The device driver  100  is an embodiment of a device driver according to the present invention.  
         [0037]    [0037]FIG. 2 is a diagram showing a configuration of the device driver.  
         [0038]    The configuration of the device driver  100  in such a state that it is stored in the CD-ROM  200  is shown in FIG. 2. The device driver  100  has the same configuration also in such a state that it is installed in the computer main body  10 . The device driver  100  includes a remaining power knowledge acquisition section  110  and an electric power supply control section  120 .  
         [0039]    The remaining power knowledge acquisition section  110  acquires the knowledge of remaining power that can be supplied by the USB  13  shown in FIG. 1. The electric power supply control section  120  controls electric power supply to the USB device  20 .  
         [0040]    Referring back to FIG. 1, description will be continued.  
         [0041]    N kinds of operation mode exist in the USB device  20 . N memory elements each referred to as configuration descriptor  22  are included in the USB device  20 . Operation environments (configurations) of the N kinds of operation modes are stored in the configuration descriptors  22 , respectively. Details of storage contents of the configuration descriptors  22  will be described later.  
         [0042]    The USB devices  20  further includes an operation control block  23  and a power control block  24 . The operation control block  23  conducts like switching among the N kinds of operation mode or selection among the configuration descriptors  22  according to the operation mode. The power control block  24  conducts power control according to the operation environment stored in the selected configuration descriptor  22 . The operation control block  23  is equivalent to an example of a section referred in the present invention to as power notice section. The power control block  24  is equivalent to an example of a section referred in the present invention to as power control section.  
         [0043]    [0043]FIG. 3 is a diagram showing storage contents of the configuration descriptor  22 .  
         [0044]    In FIG. 3, storage contents of the configuration descriptor are collectively shown in a configuration table  300 . Nine fields ranging from a zeroth field to an eighth field are stored in the configuration descriptor. In the configuration table  300 , a field name  301 , a size  302 , a field value  303 , and a field storage content  304  are shown for each of the nine fields. Among the nine fields, an eighth field  310  is provided with a field name “Max Power” in which maximum power consumption in the pertinent operation mode is stored.  
         [0045]    The USB  13  shown in FIG. 1 has an instruction (request) system. The device driver  100  controls the USB device  20  by using the instruction system.  
         [0046]    In the instruction system, there are used thirteen standard requests prescribed in common irrespective of the kind of the USB device, one class request prescribed in common in each of classes obtained by classifying the USB device into some classes, and one vendor request which can be freely defined by a maker of the USB device.  
         [0047]    [0047]FIG. 4 is a diagram showing standard requests provided in the USB.  
         [0048]    In FIG. 4, thirteen standard requests provided in the USB are collectively shown as a request table  320 . In the request table  320 , a request number  321 , a request name  322 , and a request content  323  are shown for each of the thirteen standard requests.  
         [0049]    Among the thirteen standard requests shown in FIG. 4, a sixth request  330  and a ninth request  340  will be used in the ensuing description. The sixth request  330  has a request name “GET_DESCRIPTOR,” and it is an instruction for acquiring a content stored in a configuration descriptor. The ninth request  340  has a request name “SET_CONFIGURATION,” and it is an instruction for setting an operation environment (configuration) of a USB device by specifying a configuration descriptor.  
         [0050]    Hereafter, a control operation procedure in a first embodiment of a device driver according to the present invention will be described. In the ensuing description, the components shown in FIG. 1 will be referred to as the occasion may demand.  
         [0051]    [0051]FIG. 5 is a diagram showing a former stage of the control operation procedure in the first embodiment. FIG. 6 is a diagram showing a latter stage of the control operation procedure in the first embodiment.  
         [0052]    Control of the USB device  20  conducted by the device driver  100  is started when the power supply of the computer main body  10  has turned on or when the USB device  20  is connected to (plugged in) the USB  13 . First, the USB device  20  sends a predetermined signal to the host controller  11  via the bus line  12  (step S 101 ). Upon the signal serving as a trigger, preprocessing (step S 102 ) for recognizing the USB device  20  is executed by an OS  14  and the like.  
         [0053]    Upon termination of the preprocessing, the device driver  100  issues the request  330  “GET DESCRIPTOR” shown in FIG. 4 to the USB device  20  (step S 103 ). The device driver  100  acquires the number of configuration descriptors  22  provided in the USB device  20  and a Max Power value stored in each configuration descriptor  22  from the USB device  20  (step S 104 ). The Max Power value thus acquired is preserved in the computer main body  10  by the device driver  100 .  
         [0054]    After the procedure of the former stage is finished and the USB device is recognized, the procedure of the latter stage shown in FIG. 6 is started, when one operation mode is specified from among a plurality of operation modes the USB device  20  has and the operation mode is started, or when switching from one operation mode to another operation mode is conducted. Hereafter, these cases are collectively referred to simply as “operation mode switching.” 
         [0055]    The operation mode switching is caused by one of the following two requests. One of the two requests is a switching request from the USB device  20  (step S 201 ). The other of the two requests is a switching request from the application  15  (step S 202 ).  
         [0056]    The switching request from the USB device  20  is sent from the operation control block  23  in the USB device  20  to the device driver  100  via the USB I/F  21 , the bus line  12 , and the USB host controller in order.  
         [0057]    The switching request from the application  15  is sent from the application  15  in the computer main body  10  to the device driver  100  via the OS  14 .  
         [0058]    Upon receiving such a request, the remaining power knowledge acquisition section  110  (see FIG. 2) in the device driver  100  acquires the knowledge of the remaining power value that can be supplied (permissible supplied electric power value), from the host controller  11  via the OS  14  (step S 203 ). Thereafter, the electric power supply control section  120  (see FIG. 2) in the device driver  100  determines whether the power consumption required for the operation mode after switching can be satisfied with the permissible supplied electric power value, on the basis of a Max Power value that is included in Max Power values acquired and preserved beforehand according to the procedure shown in FIG. 5 and that corresponds to the operation mode after the switching, and the permissible supplied electric power value acquired by the remaining power knowledge acquisition section  110 . In other words, the electric power supply control section  120  determines whether the increase of the Max Power value caused by switching of the operation mode exceeds the permissible supplied electric power value.  
         [0059]    If the increase of the Max Power value is judged not to exceed the permissible supplied electric power value (inclusive of the case where the Max Power value is decreased by the operation mode switching), then the device driver  100  issues the request “SET_CONFIGURATION” shown in FIG. 4 to the USB device  20  (step S 204 ), and thereby shifts the USB device  20  to an operation environment (configuration) of a new operation mode. The USB device  20  shifted in operation environment notifies the OS  14  of the power consumption in the new operation environment via the host controller  11 , and supplied with operation power from the USB  13 . Furthermore, the device driver  100  notifies the application  15  that the operation mode shift (switching) has been completed, via the OS  14  (step S 205 ).  
         [0060]    On the other hand, if the electric power supply control section  120  judges the increase of the Max Power value to exceed the permissible supplied electric power value, then the device driver  100  inquires of the user whether the operation mode is to be shifted/or not to be shifted, via the OS  14  and the application  15  (step S 206 ), and receives an answer notice representing “yes” (to be shifted)/ “no” (not to be shifted) (step S 207 ). Upon receiving the inquiry, the user ensures electric power by, for example, disconnecting an extra USB device connected to the USB  13  and returns an answer notice representing “yes” (to be shifted), or gives up the switching to the new operation mode and returns an answer notice representing “no” (not to be shifted).  
         [0061]    If an answer notice representing “no” (not to be shifted) is received, then the electric power supply control section  120  inhibits switching to the new operation mode. If the answer notice representing “yes” (to be shifted) is received, then the electric power supply control section  120  issues the request  340  “SET_CONFIGURATION” to the USB device  20  (step S 208 ), and shifts the USB device  20  to the operation environment (configuration) of the new operation mode. In the same way as the foregoing description, the USB device  20  sends a notice of power consumption and is supplied with electric power. The device driver  100  sends a notice to the effect that the operation mode shift (switching) has been completed, to the application  15  via the OS  14  (step S 209 ).  
         [0062]    According to the first embodiment, the inquiry as to whether the operation mode shift should be conducted/not conducted is presented to the user before the device falls into the disable state. Therefore, it is possible to easily avoid the forced use suspension (disable) state if the user respond to it suitably.  
         [0063]    A second embodiment of a device driver according to the present invention will now be described.  
         [0064]    Except that, for example, the Nth configuration descriptor included in N configuration descriptors  22  shown in FIG. 1 is rewritable in Max Power value, the second embodiment is premised on a computer system equivalent to the computer system  1  shown in FIG. 1. Furthermore, the second embodiment has the same configuration as that shown in FIG. 2.  
         [0065]    In the ensuing description, FIGS.  1  to  4  are diverted as diagrams concerning the second embodiment.  
         [0066]    [0066]FIG. 7 is a diagram showing a control operation procedure in the second embodiment.  
         [0067]    In the second embodiment as well, control of the USB device  20  conducted by the device driver  100  is started when the power supply of the computer main body  10  has turned on or when the USB device  20  is connected to (plugged in) the USB  13 . First, the USB device  20  sends a predetermined signal to the host controller  11  via the bus line  12  (step S 301 ). Upon the signal serving as a trigger, preprocessing (step S 302 ) for recognizing the USB device  20  is executed by the OS  14 .  
         [0068]    Upon termination of the preprocessing, in the second embodiment, the remaining power knowledge acquisition section  110  (see FIG. 2) in the device driver  100  acquires the knowledge of the permissible supplied electric power value, from the OS  14 . The permissible supplied electric power value is transmitted from the electric power supply control section  120  (see FIG. 2) in the device driver  100  to the Nth configuration descriptor  22  via the OS  14 , the host controller  11 , the bus line  12  and the USB I/F  21  in order, and set in the Nth configuration descriptor  22  as the Max Power value (step S 304 ). Such setting of the Max Power value can be implemented by defining, for example, the above described vendor request.  
         [0069]    Thereafter, by using the SET_CONFIGURATION request, the electric power supply control section  120  in the device driver  100  switches the operation environment of the USB device  20  to the operation environment stored in the Nth configuration descriptor  22  (step S 305 ).  
         [0070]    The power control block  24  in the USB device  20  conducts power control so that the Max Power value set in the switched operation environment will not be exceeded. For example, if the USB device  20  has a rechargeable battery supplied with charging power from the USB  13  and the permissible supplied electric power value is less than ordinary charging power, then the power control block  24  conducts power control to effect gradual charging within the set Max Power value (i.e., the permissible supplied electric power value).  
         [0071]    According to the second embodiment, the forced use suspension (disable) state is automatically avoided.  
         [0072]    If in the second embodiment the permissible supplied electric power value has a margin and it exceeds the maximum power consumption value consumed by the USB device  20  at the step S 304 , then the maximum power consumption value is set as the Max Power value. The maximum power consumption value is a value prepared in the device driver  100  beforehand.  
         [0073]    Since the maximum power consumption value is thus set as the Max Power value, excessive power assignment is avoided and in addition thereafter the forced use suspension (disable) state is avoided no matter which mode the operation is switched to.  
         [0074]    A third embodiment of a device driver according to the present invention will now be described.  
         [0075]    [0075]FIG. 8 is a diagram showing a computer system to which the third embodiment is applied.  
         [0076]    A computer system  2  shown in FIG. 8 is the same as the computer system  1  shown in FIG. 1 except that a USB device  25  having one configuration descriptor  26  in which the Max Power value can be rewritten is provided instead of the USB device  20  having N configuration descriptors  22  shown in FIG. 1 and a device driver  150  of the third embodiment is incorporated in the computer main body  10 . The device driver  150  of the third embodiment has the same configuration as that of the device driver  100  shown in FIG. 2.  
         [0077]    In the ensuing description, FIGS.  2  to  4  are diverted as diagrams concerning the third embodiment.  
         [0078]    [0078]FIG. 9 is a diagram showing a control operation procedure in the third embodiment.  
         [0079]    In the third embodiment as well, control of the USB device  20  conducted by the device driver  150  is started when the power supply of the computer main body  10  has turned on or when the USB device  20  is connected to (plugged in) the USB  13 . First, the USB device  20  sends a predetermined signal to the host controller  11  via the bus line  12  (step S 401 ). Upon the signal serving as a trigger, preprocessing (step S 402 ) for recognizing the USB device  20  is executed by the OS  14  and the like.  
         [0080]    Upon termination of the preprocessing, in the third embodiment as well, the remaining power knowledge acquisition section  110  (see FIG. 2) in the device driver  150  acquires the knowledge of the permissible supplied electric power value, from the OS  14  in the same way as the second embodiment. The permissible supplied electric power value is transmitted from the electric power supply control section  120  (see FIG. 2) in the device driver  150  to the configuration descriptor  26  via the OS  14 , the host controller  11 , the bus line  12  and the USB I/F  21 . A Max Power value of the configuration descriptor  26  is thus set equal to the same value as the set value in the step S 304  of the second embodiment.  
         [0081]    Thereafter, in the third embodiment, the device driver  150  issues a USB bus reset signal via the OS  14  and the host controller  11  (step S 404 ). The same preprocessing (step S 405 ) as that in the foregoing description is executed, and the USB device  25  is recognized again. Thereafter, the electric power supply control section  120  in the device driver  150  sets the operation environment of the USB device  25  equal to the operation environment stored in the configuration descriptor  26  by using the SET_CONFIGURATION request (step S 406 ).  
         [0082]    According to the third embodiment, the same electric power supply control as that of the second embodiment can be implemented by using one configuration descriptor  26  alone. Thus, the cost of the USB device  25  can be suppressed.  
         [0083]    By application in which the step S 204  or S 208  in the first embodiment is replaced with the procedure of the steps S 403  to S 406  in the third embodiment, the same electric power supply control as that in the first embodiment can also be implemented by using one configuration descriptor  26  alone.