A power supply device comprising: a power control section that controls switching among a plurality of power supply modes including an off mode for shutting off power supply to a power supply target; an operating switch that is used for the switching among the power supply modes and maintained in one of an on state and an off state by a user's operation; a hardware circuit that outputs different output signals between a case where the operation of the operating switch is continued for longer than a predetermined threshold time and the other cases; an operation detecting CPU that outputs different output signals between a case of having detected the operation of the operating switch and the other case; and a signal generating section that (i) feeds a control signal for switching the power supply mode to the off mode into the power control section when the hardware circuit outputs an output signal different from an output signal for the case where the operation is continued for longer than the threshold time and the operation detecting CPU outputs an output signal for the case of having detected the operation, (ii) feeds the control signal into the power control section when the hardware circuit outputs the output signal for the case where the operation is continued for longer than the threshold time and the operation detecting CPU outputs an output signal different from the output signal for the case of having detected the operation, (iii) does not feed the control signal into the power control section when the hardware circuit outputs the output signal different from the output signal for the case where the operation is continued for longer than the threshold time and the operation detecting CPU outputs the output signal different from the output signal for the case of having detected the operation, and (iv) does not feed the control signal into the power control section when the hardware circuit outputs the output signal for the case where the operation is continued for longer than the threshold time and the operation detecting CPU outputs the output signal for the case of having detected the operation. a power control section that controls switching among a plurality of power supply modes including an off mode for shutting off power supply to a power supply target; an operating switch that is used for the switching among the power supply modes and maintained in one of an on state and an off state by a user's operation; a hardware circuit that outputs different output signals between a case where the operation of the operating switch is continued for longer than a predetermined threshold time and the other cases; an operation detecting CPU that outputs different output signals between a case of having detected the operation of the operating switch and the other case; and a signal generating section that (i) feeds a control signal for switching the power supply mode to the off mode into the power control section when the hardware circuit outputs an output signal different from an output signal for the case where the operation is continued for longer than the threshold time and the operation detecting CPU outputs an output signal for the case of having detected the operation, (ii) feeds the control signal into the power control section when the hardware circuit outputs the output signal for the case where the operation is continued for longer than the threshold time and the operation detecting CPU outputs an output signal different from the output signal for the case of having detected the operation, (iii) does not feed the control signal into the power control section when the hardware circuit outputs the output signal different from the output signal for the case where the operation is continued for longer than the threshold time and the operation detecting CPU outputs the output signal different from the output signal for the case of having detected the operation, and (iv) does not feed the control signal into the power control section when the hardware circuit outputs the output signal for the case where the operation is continued for longer than the threshold time and the operation detecting CPU outputs the output signal for the case of having detected the operation.