Announcement

Collapse
No announcement yet.

triggering hibernation and waking up from hibernation

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • triggering hibernation and waking up from hibernation

    how could you do that with a car alarm output?

  • #2
    In the most basic form, alarm momentarily closes a relay that's hooked to your mobo's power switch/header.
    Tidder

    Try RevFE
    The best resurrected frontend I've ever used, period.

    Comment


    • #3
      Originally posted by Tidder View Post
      In the most basic form, alarm momentarily closes a relay that's hooked to your mobo's power switch/header.
      butt wouldn't that in effect just cut power? I would like to keep whatever is on on, as opposed to a fresh restart.

      http://www.quasarelectronics.com/318...with-reset.htm im planning on using that to control door locks and shutdown of the car and hibernation.


      also ideally, I would use this

      http://fit-pc2.com/wiki/index.php?title=Main_Page

      which I would assume can be wired directly to the 12v power source in the car. which wouldnt really interface with a standard atx style psu correct?

      Comment


      • #4
        If you setup your CarPC to hibernate when the power button is pressed, then no. It should not "cut" the power since all you'd be doing is emulating a power button push.
        Tidder

        Try RevFE
        The best resurrected frontend I've ever used, period.

        Comment


        • #5
          Originally posted by Tidder View Post
          If you setup your CarPC to hibernate when the power button is pressed, then no. It should not "cut" the power since all you'd be doing is emulating a power button push.
          Im thinking a shutdown controller set to hibernate would be a better option, as the relay board I have will only toggle or momentary pulse (I'm planning on turning on and off multiple relays with one channel on that remote, I'm not sure how I could simulate the power button push.

          Comment


          • #6
            no it doesnt switch the power unless you are using an old AT style computer. The power button in a PC is not connected directly to the mains power at all anymore. So when it gets "pressed" or closed via a relay, it tells the OS a power event occurred and then the OS does whatever with it.

            So if you use windows, and have windows set to hibernate on power button press, then if the pc is on and the button is pressed it will hibernate. Otherwise it will resume.
            Fusion Brain Version 6 Released!
            1.9in x 2.9in -- 47mm x 73mm
            30 Digital Outputs -- Directly drive a relay
            15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
            Buy now in the MP3Car.com Store

            Comment


            • #7
              Originally posted by 2k1Toaster View Post
              no it doesnt switch the power unless you are using an old AT style computer. The power button in a PC is not connected directly to the mains power at all anymore. So when it gets "pressed" or closed via a relay, it tells the OS a power event occurred and then the OS does whatever with it.

              So if you use windows, and have windows set to hibernate on power button press, then if the pc is on and the button is pressed it will hibernate. Otherwise it will resume.
              so lets say I get a cheap alarm for my car. instead of using the alarm keyfob, I use that 4 relay controller to arm and disarm the alarm.

              if I also setup a carpc and fusion brain to monitor other inputs like glass break sensor and whatnot, I could wire it upon any breakage/trip to pulse the power switch to wake up, monitor what sensors were tripped and if I have gprs, send me a text message or email with the status of the car?

              I'm tryng to not hook up a deep cycle battery but have my computer monitor the car.

              Comment


              • #8
                And if your carputer (zindowz) becomes autistic (not listening not listening...) you are doomed.

                Best to keep your power button as "OFF" and use an arduino to trigger the hibernate code, then check +12V (or +5V) is off. If not then close the power for 5 second.

                WIn nt (2k /xp) hibernate code (in delphi) :


                Code:
                //--------------------------------------------------------
                function IsWinNT : Boolean;
                var MyOS: TOSVersionInfo;
                begin
                // Running an NT OS ?
                  MyOS.dwOSVersionInfoSize := Sizeof(MyOS);
                  GetVersionEx(MyOS);
                  result := (MyOS.dwPlatformId = VER_PLATFORM_WIN32_NT);
                end;
                
                //--------------------------------------------------------
                procedure SetPrivilegeNT;
                var sTokenIn,sTokenOut : TTOKENPRIVILEGES ;
                    dwLen : DWORD ;
                    hCurrentProcess,hToken : THANDLE ;
                    Luid1 : TLargeInteger ;
                begin
                  try
                    hCurrentProcess := GetCurrentProcess ;
                //ajuste les privilèges, necessaire pour windows XP
                    OpenProcessToken (hCurrentProcess,TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY,hToken);
                    LookupPrivilegeValue(nil,'SeShutdownPrivilege',Luid1) ;
                    sTokenIn.PrivilegeCount := 1;
                    sTokenIn.Privileges[0].Luid := Luid1;
                    sTokenIn.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
                    AdjustTokenPrivileges(hToken,FALSE,sTokenIn,sizeof(TTOKENPRIVILEGES),sTokenOut,dwLen);
                    CloseHandle(hToken);
                  finally
                  application.ProcessMessages;
                  end;
                end;
                and the hibernate code itself :
                Code:
                    ...
                    if  IsWinNT then SetPrivilegeNT;
                    ItWorked:= SetSystemPowerState(False,False); // STD
                    if not ItWorked then
                    ShowMessage (STD impossible');
                    ...
                Now Galileo is real. Muhahahahaha :p

                Comment


                • #9
                  I havent touched delphi in 13 years and even then, I wasn't so great at it =\

                  Comment


                  • #10
                    Wasn't there some kind of DOS command to hibernate for the scripters? I can't remember.

                    inline4, you might be overthinking the power switching. Check out the MP3Car store. The basic startup/shutdown controller is for laptops and the DC-DC adapters like you're looking at. The ATX style power supplies have a built-in controller. Both types have a power button connection and you set the button to power off or hibernate, so there's no need to mess with relays. The adapters use a lot of power even when off, or the PC could freeze shutting down, so it's important to cut the power, which they do with timers and voltage monitoring.

                    As far as using the PC as an alarm, just put that thought aside for a while.

                    Comment


                    • #11
                      Originally posted by inline4 View Post
                      I havent touched delphi in 13 years and even then, I wasn't so great at it =\
                      No problem, that was just an example of how to trigger windows power options from code rather than from a button.

                      I.E.

                      SetSystemPowerState(True,False); // launch a STR
                      SetSystemPowerState(False,False); // idem but STD

                      ExitWindowsEx(EWX_FORCE or EWX_SHUTDOWN or EWX_POWEROFF , 0);
                      // Shutdown

                      ExitWindowsEx(EWX_REBOOT {or EWX_FORCEIFHUNG}, 0);
                      // Reboot

                      oh, on a side note, the SuspndToDisk command doesn't work on win9x
                      Now Galileo is real. Muhahahahaha :p

                      Comment


                      • #12
                        ExitWindowEx still works? Your first code segment is more up to date.

                        Comment

                        Working...
                        X