No announcement yet.

linux suspend/resume with hal/dbus

  • Filter
  • Time
  • Show
Clear All
new posts

  • linux suspend/resume with hal/dbus

    I'm starting this thread to get some feedback from people that ideally have first hand experience with linux boxes in their car.

    i've been going back and forth between if i want to get a mini-itx system for my car, or use and old laptop. Cost, and features though are making me look at the old laptop as the best route to go, here's how i see it so far

    Mini itx
    2ghz c7 board+ ram+cf storage ~$250

    power supply/startup controller $100 +

    nice case $70



    pIII dell latitude - ~$100 on ebay, already have one though

    power supply ~$75 for a ac inverter for the original power brick then run a normal computer power supply for the 12v regulated my lilliput display needs


    using the laptop also has the advantage that my carpc now has its own battery (ignoring the display) so i won't need to worry that much about killing my battery in my car if i decide to use it when the car's off.

    I think its also possible to read acpi information with hal so when the laptop gets unplugged (+12 accesory tied into a transtor on the ac inverter's power switch) it suspends, and then when it gets plugged in, it resumes. i'm pretty sure i know how to initiate the suspend, but i'm not that sure about the resume, seeing how the laptop is suspended.

    i also know i can get processor temp readings correctly from the dell, monitor the fans, watch the battery level, and give it 2 batteries, so it deffinately seems the best way to go.

    how many people out there use laptops for their car pc's and how do you usually handle suspend/resum?

  • #2
    if the laptop suspends, it should automatically resume when it starts up again. Unless you are using suspend2 (which requires a separate kernel patch) your resume should be automatic.

    I personally use suspend2 and have modified acpid to hibernate when a poweroff even has occured.

    Good luck
    Former author of LinuxICE, nghost, nobdy.
    Current author of Automotive Message Broker (AMB).
    Works on Tizen IVI. Does not represent anyone or anything but himself.


    • #3
      why suspend/resume at all?
      if your laptop is around 800-1000MHz, it's powerfull enough to do cold start/shutdown.
      I'm using via c3 1GHz car pc, and can optimize the kernel and startup scripts to start in about 15sec.
      My main problem is BIOS that takes 10-12sec to boot, which I plan to replace with linuxbios (lots of soldering though since my bios chip is soldered on mainboard).
      With linuxbios it would start within 10-12sec, which is pretty much same as resume from S3 state.
      EPIA TC 1G 256MB 60GB Linux,WindowMaker, Roadnav, Xine, XMMS, iGuidance3
      Lilliput 8", Pharos i360, WUSB11v2.6 WiFi


      • #4
        i had my desktop down to about 20 seconds before, right now the laptop i'm goin to use is at 40 seconds though, i should be able to get it to 30 pretty easy, but i don't think it can hit the 10-15 sec mark on a cold boot.

        dupa are you goin to be at the chicago meet this month on the 30th? i should be able to make it again and have my setup with me.


        • #5
          I'm using a laptop (2.6.20 suspend2). For shutdown, I have a script that is run on a power down event which sets creates a file under /var and writes the time to it. Also have a power on even that removes it.

          I have a cronjob that runs every 3 minutes and checks for the file, and if found reads it, if the time is greater than X minutes, it deletes the file and issues a hibernate command.

          The only problem I have is every once in awhile, hibernate fails, I fixed this by adding a --force to the command.

          To start my monitor, I have a lilliput with auto power on, this is powered by a PIC that waits X seconds after receiving power to flip the relay. This relay also powers my line converter and poweron lead to my amp, so I avoid thumping.
          GE Cache Builder | [email protected] |Coolstuff | | Nitemax Ultra Pinouts


          • #6
            A little more detail...

            I modified /etc/acpi/ to call the following script right after the includes.

            warn "On Battery [$ARGV[0]\n";
            my $status = `/usr/bin/acpi -Ba`;
            #AC Adapter 1: on-line
            my $stat_file = '/var/run/battery_status';
            if ($status =~m/on-line/i){
              warn "On AC\n";
              unlink ($stat_file) if (-e $stat_file);
              warn "On Battery\n";
              open (FH, ">$stat_file") or die "Couldn't open battery status file [$stat_file] : $!";
              print FH time(),"\n";
            Here is the cronjob... /usr/local/bin/checkpower
            use warnings;
            $ENV{PATH} = '/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games';
            my $SHUTDOWN_SECS = 60 * 5; # How long to wait before shutdown
            my $file = '/var/run/battery_status';
            my $batt_time;
            if (-e $file){
               open (FH, "<$file") or die "Couldn't read file: $!";
               $batt_time = <FH>;
               print "On battery for ",time()-$batt_time," seconds\n";
               if (time() - $batt_time > $SHUTDOWN_SECS){
                 warn "Shutting down...";
                 unlink($file); # Clean up
                 warn "Hibernating\n";
                 system('/usr/local/sbin/hibernate --force');
                   print $SHUTDOWN_SECS - (time() - $batt_time), " seconds until shutdown\n";
              # "Nothing to do";
            GE Cache Builder | [email protected] |Coolstuff | | Nitemax Ultra Pinouts


            • #7
              thanks for posting the script, just the type of thing i was planning on, i'm still a few weeks off from testing this setup in my car, this'll let me spend time on more important things now


              • #8
                Originally posted by wirelessdreamer View Post
                thanks for posting the script, just the type of thing i was planning on, i'm still a few weeks off from testing this setup in my car, this'll let me spend time on more important things now
                No problem, have some other odds and ends like that. A script for daylight, nighttime detection, etc. Maybe I'll do a little write up. Should document it better even for my own needs. So many tweaks here and there, if I have to to it over again, I'd never remember everything off the top of my head.
                GE Cache Builder | [email protected] |Coolstuff | | Nitemax Ultra Pinouts