Results 1 to 8 of 8

Thread: linux suspend/resume with hal/dbus

  1. #1
    Low Bitrate
    Join Date
    Sep 2006
    Posts
    80

    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

    $420

    Laptop

    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

    $175


    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. #2
    licensed to kill - FKA kev000
    Auto Apps:loading...
    tripzero's Avatar
    Join Date
    Aug 2006
    Location
    16.40618, 120.61106
    Posts
    2,560
    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. #3
    Constant Bitrate
    Join Date
    Jun 2006
    Location
    Chicago, IL
    Posts
    143
    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. #4
    Low Bitrate
    Join Date
    Sep 2006
    Posts
    80
    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. #5
    Raw Wave shotgunefx's Avatar
    Join Date
    Apr 2005
    Location
    Boston, MA
    Posts
    1,800
    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.

  6. #6
    Raw Wave shotgunefx's Avatar
    Join Date
    Apr 2005
    Location
    Boston, MA
    Posts
    1,800
    A little more detail...

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

    /etc/acpi/battery.pl
    Code:
    #!/usr/bin/perl
    
    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);
    }else{
      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
    Code:
    #!/usr/bin/perl
    
    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>;
       chomp($batt_time);
       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');
       }else{
           print $SHUTDOWN_SECS - (time() - $batt_time), " seconds until shutdown\n";
    
       }
    
    }else{
      # "Nothing to do";
    }

  7. #7
    Low Bitrate
    Join Date
    Sep 2006
    Posts
    80
    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. #8
    Raw Wave shotgunefx's Avatar
    Join Date
    Apr 2005
    Location
    Boston, MA
    Posts
    1,800
    Quote 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.

Similar Threads

  1. New Frontend for Windows and Linux
    By gbr in forum Other Cool Front Ends
    Replies: 68
    Last Post: 01-21-2009, 08:55 PM
  2. Linux duck duck goose!
    By rocken in forum Linux
    Replies: 11
    Last Post: 03-12-2006, 11:15 AM
  3. Linux Login, UPS and Linux Touch Screen
    By polc1410 in forum Newbie
    Replies: 5
    Last Post: 02-11-2005, 10:43 AM
  4. The LOW Risk Linux Adventure...
    By grepzen in forum Software & Software Development
    Replies: 13
    Last Post: 11-08-2004, 09:12 PM
  5. PS2 Linux -- check it out
    By Superfly in forum General Hardware Discussion
    Replies: 7
    Last Post: 03-21-2003, 11:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •