|
 |
08-30-2007, 09:03 AM
|
#1
|
|
Low Bitrate
Join Date: Sep 2006
Posts: 77
|
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?
|
|
|
|
|
|
Advertisement
|
Sponsored links
|
08-30-2007, 01:05 PM
|
#2
|
|
licensed to kill
Join Date: Aug 2006
Location: Deep in the Rockies... coding in caves
Posts: 1,042
|
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
__________________
LinuxICE - because my car already has enough windows (and because I like speed).
LinuxICE2 beta2 is released!!! get it now!
Follow OpenICE development
Last edited by kev000; 08-30-2007 at 03:06 PM.
|
|
|
08-30-2007, 11:24 PM
|
#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
|
|
|
08-31-2007, 03:05 PM
|
#4
|
|
Low Bitrate
Join Date: Sep 2006
Posts: 77
|
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.
|
|
|
08-31-2007, 03:24 PM
|
#5
|
|
Raw Wave
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.
|
|
|
08-31-2007, 03:57 PM
|
#6
|
|
Raw Wave
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";
}
Last edited by shotgunefx; 08-31-2007 at 06:27 PM.
Reason: Removed call to 'ps' as it was kruft from an early version that did some process handling
|
|
|
09-03-2007, 11:52 AM
|
#7
|
|
Low Bitrate
Join Date: Sep 2006
Posts: 77
|
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
|
|
|
09-03-2007, 02:45 PM
|
#8
|
|
Raw Wave
Join Date: Apr 2005
Location: Boston, MA
Posts: 1,800
|
Quote: Originally Posted by wirelessdreamer 
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.
|
|
|
|
Sponsored links
|
|
Advertisement
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 08:40 PM.
| |