.gear/rules | 2 + .gear/tags/list | 1 + debian/changelog | 15 ++++ debian/control | 2 +- debian/eeepc-acpi-scripts.default.in | 19 ++++-- debian/eeepc-acpi-scripts.init | 68 ++++++++----------- eeepc-acpi-scripts.spec | 120 ++++++++++++++++++++++++++++++++++ etc/acpi/actions/hotkey.sh | 10 ++-- etc/acpi/actions/lid.sh | 4 +- etc/acpi/actions/sleep.sh | 4 +- etc/acpi/actions/volume.sh | 14 ++-- etc/acpi/lib/notify.sh | 9 ++- etc/acpi/lib/sound.sh | 4 +- functions.sh | 51 ++++++++++++++ 14 files changed, 258 insertions(+), 65 deletions(-) diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 0000000..4fcfd99 --- /dev/null +++ b/.gear/rules @@ -0,0 +1,2 @@ +tar: @version@:. +diff: @version@:. . diff --git a/.gear/tags/list b/.gear/tags/list new file mode 100644 index 0000000..b7747d5 --- /dev/null +++ b/.gear/tags/list @@ -0,0 +1 @@ +e3eb3a7dfadceddaa231a4d2e1c4ce6f1ca9868e 1.1.9 diff --git a/debian/changelog b/debian/changelog index d9f5ecb..91cdc86 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,18 @@ +eeepc-acpi-scripts (1.1.11) UNRELEASED; urgency=low + + * notify: avoid staircase effect when sending notifications to the console. + Thanks to Trent W. Buck for reporting and testing. + + -- Damyan Ivanov Tue, 13 Apr 2010 17:51:03 +0300 + +eeepc-acpi-scripts (1.1.10) unstable; urgency=low + + * Fn-Space and the S.H.E. button are the same, and only generate a hotkey + event. Ensure that this isn't ignored. (Closes: #566707) + * Bump standards version to 3.8.4; no changes needed. + + -- Darren Salt Thu, 25 Feb 2010 15:11:25 +0000 + eeepc-acpi-scripts (1.1.9) unstable; urgency=low * suspend.sh: fix the check for a running /sbin/shutdown diff --git a/debian/control b/debian/control index 49fddbd..2bef1af 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Uploaders: Ben Armstrong , Darren Salt , Raphael Geissert Build-Depends: debhelper (>= 6) -Standards-Version: 3.8.3 +Standards-Version: 3.8.4 Vcs-Git: git://git.debian.org/git/debian-eeepc/eeepc-acpi-scripts.git Vcs-Browser: http://git.debian.org/?p=debian-eeepc/eeepc-acpi-scripts.git DM-Upload-Allowed: yes diff --git a/debian/eeepc-acpi-scripts.default.in b/debian/eeepc-acpi-scripts.default.in index 5b0c832..309be71 100644 --- a/debian/eeepc-acpi-scripts.default.in +++ b/debian/eeepc-acpi-scripts.default.in @@ -1,12 +1,16 @@ +##### DO NOT EDIT THIS FILE!!! +##### TO OVERRIDE DEFAULT SETTINGS, USE +##### /etc/sysconfig/eeepc-acpi-scripts.d/ + # By default, OSD output of function keys is disabled because it's too slow. # Set to 'yes' if you want fancy OSD overlays. -ENABLE_OSD='no' +ENABLE_OSD='yes' # Set to the name and size of the font used for the overlay. OSD_FONT='DejaVuSans 36' # Set this and ENABLE_OSD to yes if you want brightness changes via Fn-Fx to # be reported. -ENABLE_OSD_BRIGHTNESS='no' +ENABLE_OSD_BRIGHTNESS='yes' # Leave these empty to attempt to autoconfigure. If they don't work for you, # look up the following values by using amixer; one control name per line, @@ -71,7 +75,7 @@ LOCK_SCREEN_ON_SUSPEND='yes' # (specified above). # To do nothing, set it to "nothing". # Setting it to anything else will result in it being treated as a command. -LID_CLOSE_ACTION= +LID_CLOSE_ACTION="lock" # Try to load/unload the hci_usb module and use hcitool for checking # bluetooth state when the bluetooth control node in @@ -142,8 +146,8 @@ FnF_VOLUMEUP='handle_volume_up' # '2' = underclocked # (etc. as available). # '' = fastest (AC) or slowest (battery). -PWR_CLOCK_AC= -PWR_CLOCK_BATTERY= +PWR_CLOCK_AC=0 +PWR_CLOCK_BATTERY=2 # The current state is stored by the BIOS. However, we still have to handle # "auto" vs. "manual"; this is stored in /var/lib/eeepc-acpi-scripts/cpufv. # You can use DEFAULT_SHENGINE_CONFIG to provide a setting for when this @@ -153,3 +157,8 @@ PWR_CLOCK_BATTERY= # Set the following to '1' to force usage of S.H.E. even on models that don't # officialy support it. The default is '0' #SHENGINE_FORCE_ENABLE=0 + +for i in /etc/sysconfig/eeepc-acpi-scripts.d/*; do + [ "${i%\~}" = "$i" ] && [ "${i%.rpm*}" = "$i" ] || continue + . $i +done diff --git a/debian/eeepc-acpi-scripts.init b/debian/eeepc-acpi-scripts.init index f32ca73..3600602 100644 --- a/debian/eeepc-acpi-scripts.init +++ b/debian/eeepc-acpi-scripts.init @@ -1,12 +1,12 @@ -#! /bin/sh -e -### BEGIN INIT INFO -# Provides: eeepc-acpi-scripts -# Required-Start: udev mountkernfs $remote_fs -# Required-Stop: -# Default-Start: S -# Default-Stop: -# Short-Description: Load modules which are useful on EeePCs and similar hardware -### END INIT INFO +#!/bin/sh +# Load eeePC-specific modules +# +# chkconfig: 2345 35 65 +# description: Load modules which are useful \ +# on EeePCs and similar hardware +# +# Do not load RH compatibility interface. +WITHOUT_RC_COMPAT=1 # exit if package not installed test -f /usr/share/eeepc-acpi-scripts/functions.sh || exit 0 @@ -16,21 +16,14 @@ test -d /sys/bus/platform/devices/eeepc || exit 0 PATH="/sbin:/bin" -. /lib/lsb/init-functions +. /etc/init.d/functions -load_module () -{ - log_action_cont_msg "$1" - maybe_warn modprobe $@ -} +LOCKFILE=/var/lock/subsys/eeepc-acpi-scripts +RETVAL=0 -maybe_warn () +load_module () { - local WARN - WARN="$($@ 2>&1 || :)" - if [ -n "$WARN" ]; then - log_warning_msg "$WARN" - fi + action " $1:" modprobe $@ } case "$1" in @@ -51,7 +44,7 @@ case "$1" in # Now load the modules. We ignore failure since it's possible that # they're built into the running kernel. - log_action_begin_msg 'Loading EeePC support modules' + echo 'Loading EeePC support modules' # Load pciehp if required. # There are three recognised cases: @@ -64,12 +57,10 @@ case "$1" in # Hmm, already present if [ "$KERNEL" -ge 29 -a "`cat /sys/class/dmi/id/product_name`" != "900A" ]; then # 2.6.29 and newer on all but the EeePC 900A - unload pciehp if loaded - log_warning_msg 'Module "pciehp" is loaded; trying to unload' - maybe_warn modprobe -r pciehp + action 'Module "pciehp" is loaded; trying to unload' modprobe -r pciehp elif [ "$KERNEL" -ge 32 ]; then # 2.6.32 and newer on all EeePC models - unload pciehp if loaded - log_warning_msg 'Module "pciehp" is loaded; trying to unload' - maybe_warn modprobe -r pciehp + action 'Module "pciehp" is loaded; trying to unload' modprobe -r pciehp fi else # Load it if needed @@ -97,39 +88,36 @@ case "$1" in # Done. - log_action_end_msg 0 - if [ -f /etc/acpi/lib/shengine.sh ]; then - log_action_begin_msg 'Setting super hybrid engine according to configuration' + echo -n 'Setting super hybrid engine according to configuration' if [ -f /etc/default/eeepc-acpi-scripts ]; then . /etc/default/eeepc-acpi-scripts fi . /etc/acpi/lib/shengine.sh if shengine_supported; then if [ "${SHENGINE_SETTING:-auto}" != auto ]; then - log_action_cont_msg '(manual)' + success 'set_shengine (manual)' elif [ "$(cat /sys/class/power_supply/AC0/online 2>/dev/null)" = 0 ]; then - log_action_cont_msg '(battery)' - set_shengine "${PWR_CLOCK_BATTERY:-$(($SHENGINE_LIMIT - 1))}" || : + echo -n '(battery)' + set_shengine "${PWR_CLOCK_BATTERY:-$(($SHENGINE_LIMIT - 1))}" && echo_success 'set_shengine (battery)' || failure 'set_shengine (battery)' ; echo else - log_action_cont_msg '(AC)' - set_shengine "${PWR_CLOCK_AC:-0}" || : + echo -n '(AC)' + set_shengine "${PWR_CLOCK_AC:-0}" && success 'set_shengine (AC)' || failure 'set_shengine (AC)' ; echo fi else - log_action_cont_msg '(model not supported)' + echo -n '(model not supported)' fi - log_action_end_msg $? fi ;; - stop) + condrestart|condstop|stop) # Nothing to do. ;; *) - echo "Usage: /etc/init.d/eeepc-acpi-scripts {start|stop|restart|reload|force-reload}" - exit 1 + msg_usage "${0##*/} {start|stop|restart|reload|force-reload}" + RETVAL=1 ;; esac -exit 0 +exit $RETVAL diff --git a/eeepc-acpi-scripts.spec b/eeepc-acpi-scripts.spec new file mode 100644 index 0000000..418933e --- /dev/null +++ b/eeepc-acpi-scripts.spec @@ -0,0 +1,120 @@ +Name: eeepc-acpi-scripts +Version: 1.1.9 +Release: alt5 + +Summary: Debian eeePC support scripts +License: GPL +Group: System/Kernel and hardware + +BuildArch: noarch + +Url: http://git.debian.org/?p=debian-eeepc/eeepc-acpi-scripts.git + +Source: %name-%version.tar +Patch: %name-%version-%release.patch + +Requires: acpid udev amixer aosd_cat +Requires: rfkill >= 0.3.3 + +Conflicts: eeepc-scripts + + +%description +This package adds support to the special features of Asus Eee PC series of +laptops. These include sleep (suspend) and hotkeys such as wireless, +brightness, mute, volume, video output toggle and the 'soft' keys available in +some models. + + +%prep +%setup +%patch -p1 +#sed -i 's,/etc/default,%_datadir,g' etc/acpi/*/* + +%install +mkdir -p %buildroot%_sysconfdir/acpi/{actions,events,lib} +install -p -m0755 etc/acpi/actions/* %buildroot%_sysconfdir/acpi/actions/ +install -p -m0644 etc/acpi/events/* %buildroot%_sysconfdir/acpi/events/ +install -p -m0644 etc/acpi/lib/* %buildroot%_sysconfdir/acpi/lib/ + +mkdir -p %buildroot%_sysconfdir/modprobe.d +install -p -m0644 etc/modprobe.d/* %buildroot%_sysconfdir/modprobe.d/ + +mkdir -p %buildroot/lib/udev/rules.d +install -p -m0644 lib/udev/rules.d/* %buildroot/lib/udev/rules.d/ +install -p -m0755 lib/udev/[^r]* %buildroot/lib/udev/ + +mkdir -p %buildroot%_datadir/%name +install -p -m0644 functions.sh %buildroot%_datadir/%name/ + +install -pD -m0644 debian/eeepc-acpi-scripts.default.in %buildroot%_sysconfdir/default/%name +install -pD -m0755 debian/eeepc-acpi-scripts.init %buildroot%_initdir/%name + +mkdir -p %buildroot%_sysconfdir/sysconfig/%name.d +cat > %buildroot%_sysconfdir/sysconfig/%name.d/00README << _E_O_F_ +# put here custom configuration snippets +# do not remove or edit THIS file +_E_O_F_ + +mkdir -p %buildroot%_localstatedir/%name + +%post +%post_service %name +%_initdir/acpid condreload + +%preun +%preun_service %name +%_initdir/acpid condreload + + +%files +%_sysconfdir/acpi/* +%_sysconfdir/modprobe.d/* +%_sysconfdir/default/%name +%_sysconfdir/sysconfig/%name.d +%_initdir/%name +/lib/udev/* +%exclude %dir /lib/udev/rules.d/ +%_datadir/%name/ +%_localstatedir/%name/ +%doc TODO debian/NEWS debian/README.Debian debian/changelog debian/copyright + + +%changelog +* Wed May 12 2010 Mykola Grechukh 1.1.9-alt5 +- 00README + +* Wed Apr 28 2010 Mykola Grechukh 1.1.9-alt4 +- defaults moved to /etc/defaults + +* Wed Apr 28 2010 Mykola Grechukh 1.1.9-alt3 +- package redesigned + +* Wed Apr 28 2010 Mykola Grechukh 1.1.9-alt2 +- reasonable defaults; always use first soundcard to deal with alsa-plugin-pulse + +* Wed Apr 28 2010 Mykola Grechukh 1.1.9-alt1 +- new upstream version + +* Tue Jan 12 2010 Mykola Grechukh 1.1.6.0-alt1 +- upstream updated + +* Tue Jan 12 2010 Mykola Grechukh 1.1.2-alt2 +- require amixer + +* Tue Aug 25 2009 Andrey Rahmatullin 1.1.2-alt1 +- 1.1.2 + +* Fri May 29 2009 Andrey Rahmatullin 1.1.0-alt4 +- 1.1.0-8-g39afa73 +- SHE support (from upstream shengine branch) + +* Thu May 14 2009 Andrey Rahmatullin 1.1.0-alt3 +- add condstop target to the initscript to make preun_service happy (repocop) + +* Mon May 11 2009 Andrey Rahmatullin 1.1.0-alt2 +- fix /etc/acpi/actions/{lid,sleep}.sh + +* Sat May 09 2009 Andrey Rahmatullin 1.1.0-alt1 +- initial build +- tested on 901 with 2.6.30-rc4 kernel, your mileage may vary diff --git a/etc/acpi/actions/hotkey.sh b/etc/acpi/actions/hotkey.sh index cceace2..012a98c 100755 --- a/etc/acpi/actions/hotkey.sh +++ b/etc/acpi/actions/hotkey.sh @@ -26,10 +26,10 @@ acpi= acpiwrite= ACPITEST=/lib/init/rw/eeepc-acpi-scripts.acpi-ignore case "$code" in - # Soft buttons 3 & 4 are special. - # They're always reported as hotkeys (901, at least). + # Soft buttons 3 & 4 and Fn-Space/SHE are special. + # They're always reported as hotkeys. # This will probably break when button events are added for these keys. - 0000001[cd]) + 0000001[cd]|00000039) ;; *) if test -f "$ACPITEST"; then @@ -149,7 +149,7 @@ handle_gsm_toggle() { fi } -# Handle events which we're handling differently on different modelsz +# Handle events which we're handling differently on different models case $(cat /sys/class/dmi/id/product_name) in [79]*|1000H) case $code in @@ -255,7 +255,7 @@ case $code in ;; # --/Space - SHE management - # (ACPI event code not known) + # See "SHE button" below # Silver keys, left to right diff --git a/etc/acpi/actions/lid.sh b/etc/acpi/actions/lid.sh index a10e267..b78f7c3 100755 --- a/etc/acpi/actions/lid.sh +++ b/etc/acpi/actions/lid.sh @@ -1,8 +1,8 @@ #!/bin/sh -[ -e /usr/share/acpi-support/policy-funcs ] || exit 0 +[ -e /usr/share/eeepc-acpi-scripts/functions.sh ] || exit 0 -. /usr/share/acpi-support/policy-funcs +. /usr/share/eeepc-acpi-scripts/functions.sh if [ `CheckPolicy` = 0 ] ; then diff --git a/etc/acpi/actions/sleep.sh b/etc/acpi/actions/sleep.sh index f79de08..b2dbe87 100755 --- a/etc/acpi/actions/sleep.sh +++ b/etc/acpi/actions/sleep.sh @@ -1,8 +1,8 @@ #!/bin/sh -[ -e /usr/share/acpi-support/policy-funcs ] || exit 0 +[ -e /usr/share/eeepc-acpi-scripts/functions.sh ] || exit 0 -. /usr/share/acpi-support/policy-funcs +. /usr/share/eeepc-acpi-scripts/functions.sh if [ `CheckPolicy` = 0 ] ; then exit 0 diff --git a/etc/acpi/actions/volume.sh b/etc/acpi/actions/volume.sh index 63f4b47..bfea056 100755 --- a/etc/acpi/actions/volume.sh +++ b/etc/acpi/actions/volume.sh @@ -25,7 +25,7 @@ configureSound show_muteness() { local label msg status all_equal=1 current for label in $SOUND_SWITCH; do - current=$($AMIXER get $label | + current=$($AMIXER -c 0 get $label | sed -n 's/.*\[\(on\|off\)\].*/\1/;ta;d;:a;p') case "$(echo "$current")" in on*off*) current='on[L]'; ;; @@ -46,7 +46,7 @@ show_muteness() { show_volume() { local label msg percent all_equal=1 current for label in $SOUND_LABEL; do - current=$($AMIXER get $label | + current=$($AMIXER -c 0 get $label | sed -n '/%/{s/.*\[\(.*\)%\].*/\1/p;q}') [ "$percent" ] || percent="$current" [ "$percent" = "$current" ] || all_equal= @@ -68,27 +68,27 @@ IFS=' case "$action" in toggle) for label in $SOUND_SWITCH; do - $AMIXER -q set $label toggle + $AMIXER -c 0 -q set $label toggle done show_muteness ;; down) for label in $SOUND_LABEL $SOUND_SWITCH_EXCLUSIVE; do - $AMIXER -q set $label "$SOUND_VOLUME_STEP"- unmute + $AMIXER -c 0 -q set $label "$SOUND_VOLUME_STEP"- unmute done # in case something was unmuted, make sure everything else is for label in $SOUND_SWITCH; do - $AMIXER -q set $label unmute + $AMIXER -c 0 -q set $label unmute done show_volume ;; up) for label in $SOUND_LABEL $SOUND_SWITCH_EXCLUSIVE; do - $AMIXER -q set $label "$SOUND_VOLUME_STEP"+ unmute + $AMIXER -c 0 -q set $label "$SOUND_VOLUME_STEP"+ unmute done # in case something was unmuted, make sure everything else is for label in $SOUND_SWITCH; do - $AMIXER -q set $label unmute + $AMIXER -c 0 -q set $label unmute done show_volume ;; diff --git a/etc/acpi/lib/notify.sh b/etc/acpi/lib/notify.sh index b476b53..d305376 100644 --- a/etc/acpi/lib/notify.sh +++ b/etc/acpi/lib/notify.sh @@ -12,7 +12,8 @@ notify() { echo "$MSG" # for /var/log/acpid if [ ! -S /tmp/.X11-unix/X0 ]; then - echo "$MSG" > /dev/console + # echo's behaviour wrt "\r" is shell-dependent + printf "$MSG\r\n" > /dev/console return fi @@ -54,6 +55,12 @@ notify() { OSD_SHOWN=1 fi + KDIALOG4=/usr/lib/kde4/bin/kdialog + if [ -z "$OSD_SHOWN" ] && [ -x $KDIALOG4 ]; then + su $user -c "$KDIALOG4 --passivepopup '$MSG' 2" + OSD_SHOWN=1 + fi + if [ -z "$OSD_SHOWN" ] && [ -x /usr/bin/dcop ]; then dcop --user "$user" knotify Notify notify "notification" "knotify" "$MSG" "" "" 16 2 OSD_SHOWN=1 diff --git a/etc/acpi/lib/sound.sh b/etc/acpi/lib/sound.sh index b1c1e52..adb63d7 100644 --- a/etc/acpi/lib/sound.sh +++ b/etc/acpi/lib/sound.sh @@ -4,7 +4,7 @@ PKG=eeepc-acpi-scripts DEFAULT=/etc/default/$PKG -SOUND_FILE=/lib/init/rw/$PKG.sound +SOUND_FILE=/var/run/$PKG.sound AMIXER=/usr/bin/amixer [ -e "$SOUND_FILE" ] && . "$SOUND_FILE" @@ -29,7 +29,7 @@ configureSoundFilter() { # Defaults configureSound() { local amixer - amixer="$($AMIXER)" + amixer="$($AMIXER -c 0)" [ "$SOUND_PREFER_MASTER" != "yes" ] || { [ "$SOUND_LABEL" ] || { diff --git a/functions.sh b/functions.sh index e17cf6b..ecbcdf1 100644 --- a/functions.sh +++ b/functions.sh @@ -1,3 +1,54 @@ +#from Debian /usr/share/acpi-support/power-funcs +# getXuser gets the X user belonging to the display in $displaynum. +# If you want the foreground X user, use getXconsole! +getXuser() { + user=`pinky -fw | awk '{ if ($2 == ":'$displaynum'" || $(NF) == ":'$displaynum'" ) { print $1; exit; } }'` + if [ x"$user" = x"" ]; then + startx=`pgrep -n startx` + if [ x"$startx" != x"" ]; then + user=`ps -o user --no-headers $startx` + fi + fi + if [ x"$user" != x"" ]; then + userhome=`getent passwd $user | cut -d: -f6` + export XAUTHORITY=$userhome/.Xauthority + else + export XAUTHORITY="" + fi + export XUSER=$user +} +# getXconsole gets the foreground (console) X user +getXconsole() { + console=`fgconsole`; + displaynum=`COLUMNS="" ps ax | grep -e 'X .* vt'$console | grep -v grep | sed -re 's!.*/X .*:([0-9]+).*!\1!' | uniq` + if [ x"$displaynum" = x"" ]; then + # Second attempt: perhaps there's no X started with the "vt" argument, some users + # prefer to start X using startx instead. As a fallback we use that X instance. + displaynum=`COLUMNS="" ps ax | grep -e '/usr/bin/X .*' | grep -v grep | sed -re 's!.*/X .*:([0-9]+).*!\1!' | uniq` + fi + if [ x"$displaynum" != x"" ]; then + export DISPLAY=":$displaynum" + getXuser + fi +} + +#from Debian /usr/share/acpi-support/policy-funcs +# The (not very aptly named) function CheckPolicy checks if the current X +# console user is running a power management daemon that handles suspend/resume +# requests. This is used in various places to determine if we need to handle +# something ourselves or if we need to pass the info on to a power management +# daemon (e.g. through a fake key press). +CheckPolicy() { + getXconsole + if pidof gnome-power-manager kpowersave xfce4-power-manager > /dev/null || + ( test "$XUSER" != "" && pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop --user $XUSER kded kded loadedModules | grep -q klaptopdaemon) || + ( test "$XUSER" != "" && test -x /usr/bin/qdbus && test -r /proc/$(pidof kded4)/environ && su - $XUSER -c "eval $(echo -n 'export '; cat /proc/$(pidof kded4)/environ |tr '\0' '\n'|grep DBUS_SESSION_BUS_ADDRESS); qdbus org.kde.kded" | grep -q powerdevil) ; then + echo 0; + else + echo 1; + fi +} + # common eeepc-acpi-scripts functions # detect which rfkill has name=$1