From owner-freebsd-mobile@FreeBSD.ORG Fri Aug 25 09:06:05 2006 Return-Path: X-Original-To: freebsd-mobile@freebsd.org Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CBB4316A4E0 for ; Fri, 25 Aug 2006 09:06:05 +0000 (UTC) (envelope-from freebsd@meijome.net) Received: from sigma.octantis.com.au (ns2.octantis.com.au [207.44.189.124]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5DC8343D49 for ; Fri, 25 Aug 2006 09:06:03 +0000 (GMT) (envelope-from freebsd@meijome.net) Received: (qmail 11967 invoked from network); 25 Aug 2006 19:06:02 +1000 Received: from 203-217-78-140.dyn.iinet.net.au (HELO localhost) (203.217.78.140) by sigma.octantis.com.au with (DHE-RSA-AES256-SHA encrypted) SMTP; 25 Aug 2006 19:06:02 +1000 Date: Fri, 25 Aug 2006 19:05:56 +1000 From: Norberto Meijome To: Fabian Keil Message-ID: <20060825190556.0e913ec5@localhost> In-Reply-To: <20060824171401.706707ea@localhost> References: <20060825005305.5f145cf6@localhost> <20060824171401.706707ea@localhost> X-Mailer: Sylpheed-Claws 2.4.0 (GTK+ 2.8.20; i386-portbld-freebsd6.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-mobile@freebsd.org Subject: Minimal sample custom devd.conf ( was Re: IBM T30 and suspend/resume capability ) X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2006 09:06:06 -0000 On Thu, 24 Aug 2006 17:14:01 +0200 Fabian Keil wrote: > > nice one :) do u know if this works for other Thinkpad models? I'm on a much > > newer Z60m here - acpi works fine, suspend is much more reliable after I > > wrote my own suspend script called by devd, but hibernation is something > > I'd be interested in. > > AFAIK there are two types of suspend to disk, one that heavily depends > on the BIOS to do the work and one that doesn't. FreeBSD currently only > supports the first one while modern laptops usually only support the second. gotcha :) I would guess mine is supported by BIOS: (S4 ) hw.acpi.supported_sleep_state: S3 S4 S5 hw.acpi.power_button_state: S5 hw.acpi.sleep_button_state: S3 hw.acpi.lid_switch_state: NONE hw.acpi.standby_state: S1 hw.acpi.suspend_state: S3 > > BTW: what exactly does your devd script do? Nothing major really... I was getting some crashes on resume, and the default acpi_ibm behaviours for the fn- keys weren't too much of my liking... so what I did (for the archives... hopefully it'll be useful for someone else) 1) added to /etc/sysctl.conf -- # Needed for custom ACPI control # This will pass ACPI events to devd after acpi_ibm. # Custom devd config can be found in /usr/local/etc/devd dev.acpi_ibm.0.events=1 --- 2) ensured /etc/devd.conf contains in the options { } section: directory "/usr/local/etc/devd"; 3) Created a ayiin.conf file in /usr/local/etc/devd (ayiin = name of machine... anything would work really), with the following lines ---- notify 10 { ## Fn-F4 : Suspend match "system" "ACPI"; match "subsystem" "IBM"; match "notify" "0x04"; action "/bin/sh -c /home/betom/bin/do_acpi_suspend.sh"; }; notify 10 { ## Closing lid : powerdown LCD with radeon tool match "system" "ACPI"; match "subsystem" "Lid"; match "notify" "0x00"; action "/usr/local/bin/radeontool light off; /usr/local/bin/radeontool dac off"; }; notify 10 { ## Opening lid : power up LCD with radeon tool match "system" "ACPI"; match "subsystem" "Lid"; match "notify" "0x01"; action "/usr/local/bin/radeontool light on; /usr/local/bin/radeontool dac off"; }; notify 10 { ## Fn-F2 - Lock match "system" "ACPI"; match "subsystem" "IBM"; match "notify" "0x02"; action "/usr/X11R6/bin/xscreensaver-command -lock"; #action "/bin/sh -c /home/betom/bin/do_acpi_x_lock.sh"; }; ------------------------------- end of /usr/local/etc/devd/ayiin.conf 4) Created /home/betom/bin/do_acpi_suspend.sh as follows: ---- #!/usr/local/bin/bash # switch to first VC vidcontrol -s 1 < /dev/ttyv0 # make sure we sync all the disk buffers ... in case we die on resume, this minimises problems with fsck sync sync sleep 3 sync sync sleep 1 sync zzz ---- and that's about it... I want to customise detaching devices ( hdac.ko from multimedia@ usually dies after resume, but it's not so easy to handle, as several apps keep the mixer / pcm open... in particular flash plugin in firefox... ), but i havent done any more yet. Anyway, some notes : on resume, the console stays on VC1, so I simply have to do Alt-F9 and I'm back in X. When I used to run on MODE_24 (text mode), I'd get the actual console. Now I'm running on MODE_279 (1024x768x16), so I get a soft-white screen instead.. possibly related to this in dmesg on resume Aug 23 09:44:37 ayiin kernel: vga0: failed to save state (nbytes=4) The FnF2 call xscreensaver-command-lock needs me to have xhost +local: set in my session script (devd runs as root, so it normally cannot execute on my X Session). Since I switched to custom devd msg handling, i've lost the bluetooth device - Fn-F5 (radio on) would attach the bt device... i'll have to configure that, or maybe run