From bc7b638f5680b15c46d8978e82a418762d60e323174ac413ce129b509f616a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismail=20D=C3=B6nmez?= Date: Wed, 12 Sep 2012 19:47:16 +0000 Subject: [PATCH] Accepting request 133875 from home:ealin:apple - removed init.d script and added a systemd service file - symlinked pommed.service so it starts by default. - removed rpmlint filter... we do not install in kde3 anymore - added a resonable settings, pommed.conf, works fine on my MBP7,1 OBS-URL: https://build.opensuse.org/request/show/133875 OBS-URL: https://build.opensuse.org/package/show/Base:System/pommed?expand=0&rev=14 --- pommed-rpmlintrc | 2 - pommed.changes | 8 ++++ pommed.conf | 122 +++++++++++++++++++++++++++++++++++++++++++++++ pommed.init | 109 ------------------------------------------ pommed.service | 11 +++++ pommed.spec | 68 +++++++++++++------------- 6 files changed, 176 insertions(+), 144 deletions(-) delete mode 100644 pommed-rpmlintrc create mode 100644 pommed.conf delete mode 100644 pommed.init create mode 100644 pommed.service diff --git a/pommed-rpmlintrc b/pommed-rpmlintrc deleted file mode 100644 index 0c49cd3..0000000 --- a/pommed-rpmlintrc +++ /dev/null @@ -1,2 +0,0 @@ -# this desktop file is just for autostarting gpomme on KDE -addFilter("untranslated-desktop-file.*/opt/kde3/share/autostart/gpomme.desktop") diff --git a/pommed.changes b/pommed.changes index 674a862..8755839 100644 --- a/pommed.changes +++ b/pommed.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Sep 12 14:28:25 UTC 2012 - alinm.elena@gmail.com + +- removed init.d script and added a systemd service file +- symlinked pommed.service so it starts by default. +- removed rpmlint filter... we do not install in kde3 anymore +- added a resonable settings, pommed.conf, works fine on my MBP7,1 + ------------------------------------------------------------------- Thu Jun 2 11:48:57 UTC 2011 - idonmez@novell.com diff --git a/pommed.conf b/pommed.conf new file mode 100644 index 0000000..2cfa6a6 --- /dev/null +++ b/pommed.conf @@ -0,0 +1,122 @@ +# +# Configuration file for pommed +# + +# General configuration +general { + # fnmode: functions keys first (no need to use fn) or last + # Value is either 1 or 2, effect is hardware-dependent + fnmode = 2 +} + +# sysfs backlight control +# nVidia machines, will fall back to nv8600gmt if not supported by the kernel +lcd_sysfs { + # The sysfs backlight control is a generic interface provided + # by the Linux kernel for backlight control on most graphic cards. + # The brightness range can differ depending on the hardware. +# these are values for nvidia 320m as comes on my MacBook Pro 7,1 +# abbaton:/home/alin # cat /sys/class/backlight/nvidia_backlight/max_brightness +# 44000 + + # initial backlight level [30000] (0 - 44000, -1 to disable) + init = 40000 + # step value (1 - 2) + step = 1000 + # backlight level when on battery [20000] (1 - 44000, -1 to disable) + on_batt = 20000 +} + +# ATI X1600 backlight control (MacBook Pro v1 & v2) +lcd_x1600 { + # initial backlight level [200] (0 - 255, -1 to disable) + init = -1 + # step value (1 - 127) + step = 10 + # backlight level when on battery [80] (1 - 255, 0 to disable) + on_batt = 80 +} + +# Intel 945GM, 965GM backlight control (MacBook v1-v4, MacBook Air v1) +lcd_gma950 { + # initial backlight level [0x6f] (0x1f - 0x94 usually, -1 to disable) + init = -1 + # step value (0x01 - 0x20) + step = 0x0f + # backlight level when on battery [0x40] (0x1f - 0x94 usually, 0 to disable) + on_batt = 0x40 +} + +# nVidia GeForce 8600M GT/9400M/9600M GT backlight control +# (MacBook Pro v3-v5, MacBook v5, MacBook v2) +lcd_nv8600mgt { + # initial backlight level [12] (0 - 15, -1 to disable) + init = -1 + # step value (1 - 2) + step = 1 + # backlight level when on battery [6] (1 - 15, 0 to disable) + on_batt = 6 +} + +# Audio support +audio { + # Use amixer or alsamixer/alsamixergui to determine the sound card + # and the mixer elements to use here. + + # sound card to use + card = "default" + # initial volume [80] (0 - 100%, -1 to disable) + init = -1 + # step value (1 - 50%) + step = 10 + # beep on volume change + beep = yes + # mixer element for volume adjustment + volume = "PCM" + # mixer element for muting the speakers + speakers = "Front" + # mixer element for muting the headphones + headphones = "Headphone" +} + +# Keyboard backlight control +kbd { + # default value for automatic backlight (0 - 255) + default = 40 + # step value (1 - 127) + step = 10 + # ambient light thresholds for automatic backlight (0 - 255) + on_threshold = 20 + off_threshold = 60 + # enable/disable automatic backlight + auto = yes + # idle timer - switches off keyboard backlight automatically (timeout in seconds, -1 to disable) + idle_timer = 10 +} + +# CD/DVD drive ejection +eject { + # enable/disable eject key + enabled = yes + # CD/DVD device + device = "/dev/dvd" +} + +# Beeper +beep { + # enable/disable beeper + enabled = no + # WAV file to use (from pommed: goutte.wav or click.wav in /usr/share/pommed) + beepfile = "/usr/share/pommed/goutte.wav" +} + +# Apple Remote - deprecated +# Note: the appleir driver is required for this to work; this driver has been +# obsoleted with Linux 2.6.22, so unless you are running a kernel < 2.6.22 or +# use the appleir driver on a newer kernel, this won't work. +# You should use LIRC instead. +appleir { + # enable/disable the appleir support + enabled = no +} + diff --git a/pommed.init b/pommed.init deleted file mode 100644 index 353d754..0000000 --- a/pommed.init +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/sh -# -### BEGIN INIT INFO -# Provides: pommed -# Required-Start: $remote_fs -# Required-Stop: $remote_fs -# Default-Start: 2 3 5 -# Default-Stop: 0 1 6 -# Short-Description: pommed daemon providing macbook backlight control -# Description: Start pommed to allow control over backlight on macbook -### END INIT INFO - - -# Check for missing binaries (stale symlinks should not happen) -# Note: Special treatment of stop for LSB conformance -POMMED_BIN=/usr/sbin/pommed - -. /etc/rc.status - -# Reset status of this service -rc_reset - - -case "$1" in - start) - echo -n "Starting pommed " - ## Start daemon with startproc(8). If this fails - ## the return value is set appropriately by startproc. - /sbin/startproc $POMMED_BIN - - # Remember status and be verbose - rc_status -v - ;; - stop) - echo -n "Shutting down pommed " - ## Stop daemon with killproc(8) and if this fails - ## killproc sets the return value according to LSB. - - /sbin/killproc -TERM $POMMED_BIN - - # Remember status and be verbose - rc_status -v - ;; - try-restart|condrestart) - ## Do a restart only if the service was active before. - ## Note: try-restart is now part of LSB (as of 1.9). - ## RH has a similar command named condrestart. - if test "$1" = "condrestart"; then - echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" - fi - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - # Remember status and be quiet - rc_status - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - $0 start - - # Remember status and be quiet - rc_status - ;; - force-reload) - ## Signal the daemon to reload its config. Most daemons - ## do this on signal 1 (SIGHUP). - ## If it does not support it, restart the service if it - ## is running. - - echo -n "Reload service pommed " - $0 try-restart - rc_status - ;; - reload) - ## Like force-reload, but if daemon does not support - ## signaling, do nothing (!) - rc_failed 3 - rc_status -v - ;; - status) - echo -n "Checking for service pommed " - ## Check status with checkproc(8), if process is running - ## checkproc will return with exit status 0. - - # Return value is slightly different for the status command: - # 0 - service up and running - # 1 - service dead, but /var/run/ pid file exists - # 2 - service dead, but /var/lock/ lock file exists - # 3 - service not running (unused) - # 4 - service status unknown :-( - # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) - - # NOTE: checkproc returns LSB compliant status values. - /sbin/checkproc $POMMED_BIN - # NOTE: rc_status knows that we called this init script with - # "status" option and adapts its messages accordingly. - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" - exit 1 - ;; -esac -rc_exit diff --git a/pommed.service b/pommed.service new file mode 100644 index 0000000..5897035 --- /dev/null +++ b/pommed.service @@ -0,0 +1,11 @@ +[Unit] +Description="keyboard lights and more for apple laptops" +After=dbus.service + +[Service] +Type=dbus +BusName=org.pommed +ExecStart=/usr/sbin/pommed -f + +[Install] +WantedBy=multi-user.target diff --git a/pommed.spec b/pommed.spec index ca63ba4..34f2870 100644 --- a/pommed.spec +++ b/pommed.spec @@ -1,7 +1,7 @@ # # spec file for package pommed # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,14 +16,13 @@ # - Name: pommed Version: 1.39 Release: 0 -License: GPLv2 Summary: Apple laptops hotkeys event handler -Url: http://technologeek.org/projects/pommed/ +License: GPL-2.0 Group: Hardware/Mobile +Url: http://technologeek.org/projects/pommed/ %if 0 # BuildRequires some package containing /usr/include/ofapi/of_api.h ExclusiveArch: ppc @@ -46,10 +45,10 @@ ExclusiveArch: %ix86 x86_64 BuildRequires: fdupes %endif Source0: %{name}-%{version}.tar.bz2 -Source1: pommed.init +Source1: pommed.service Source2: gpomme.desktop Source3: gpommerc -Source4: pommed-rpmlintrc +Source5: pommed.conf # PATCH-FIX-UPSTREAM pommed-desktop.patch idoenmez@suse.de -- Update desktop categories Patch1: pommed-desktop.patch # PATCH-FIX-OPENSUSE pommed-1.38-cflags.patch idoenmez@suse.de -- Respect our cflags @@ -58,11 +57,14 @@ Patch2: pommed-1.38-cflags.patch Patch3: pommed-1.38-hardcoded-libpci.patch # PATCH-FIX-UPSTREAM pommed-dbus_policy.patch ro@novell.com -- bnc#469771 Patch4: pommed-dbus_policy.patch -PreReq: %fillup_prereq -PreReq: %insserv_prereq Requires: eject Requires: xorg-x11 BuildRoot: %{_tmppath}/%{name}-%{version}-build +%systemd_requires +Requires(pre): systemd +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd %description pommed handles the hotkeys found on the Apple MacBook Pro, MacBook and @@ -75,7 +77,6 @@ up the keyboard backlight on the MacBook Pro and PowerBook. Optional support for the Apple Remote control is available. %package -n gpomme -License: GPLv2 Summary: Graphical client for pommed Group: Hardware/Mobile Requires: dbus-1 @@ -91,7 +92,6 @@ pommed on DBus and displays the action taken by pommed along with the current state associated to this action. %package -n wmpomme -License: GPLv2 Summary: WindowMaker dockapp client for pommed Group: Hardware/Mobile Requires: dbus-1 @@ -116,18 +116,17 @@ of each item controlled by pommed. make %{?_smp_mflags} %install -mkdir -p %{buildroot}/%{_bindir} %{buildroot}/%{_sbindir} %{buildroot}/%{_sysconfdir}/{init.d,dbus-1/system.d} +mkdir -p %{buildroot}/%{_bindir} %{buildroot}/%{_sbindir} %{buildroot}/%{_sysconfdir}/dbus-1/system.d +mkdir -p %{buildroot}/%{_unitdir} %{buildroot}/%{_unitdir}/multi-user.target.wants mkdir -p %{buildroot}/%{_datadir}/{applications,autostart,icons,pixmaps,gpomme,locale} mkdir -p %{buildroot}/%{_mandir}/man1 %{buildroot}/%{_datadir}/kde4/config install -m 755 pommed/pommed %{buildroot}/%{_sbindir} -%ifarch ppc ppc64 -install -m 644 pommed.conf.pmac %{buildroot}/%{_sysconfdir}/pommed.conf -%else -install -m 644 pommed.conf.mactel %{buildroot}/%{_sysconfdir}/pommed.conf -%endif -install -m 644 dbus-policy.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/pommed.conf -install -m 755 %{SOURCE1} %{buildroot}/%{_sysconfdir}/init.d/pommed -ln -sf %{_sysconfdir}/init.d/pommed %{buildroot}/%{_sbindir}/rcpommed +install -m 644 dbus-policy.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/pommed.conf +install -m 644 %{SOURCE5} %{buildroot}/%{_sysconfdir}/pommed.conf +install -m 644 %{SOURCE1} %{buildroot}%_unitdir/pommed.service +pushd %{buildroot}%_unitdir/multi-user.target.wants/ +ln -s ../pommed.service +popd install -m 644 pommed.1 %{buildroot}/%{_mandir}/man1 # gpomme install -m 755 gpomme/gpomme %{buildroot}/%{_bindir} @@ -152,35 +151,38 @@ install -m 644 wmpomme/wmpomme.1 %{buildroot}/%{_mandir}/man1 %suse_update_desktop_file %{buildroot}/%{_datadir}/applications/gpomme.desktop # enable videoswitch mkdir -p %{buildroot}/%{_sysconfdir}/pommed +install -m 644 icons/gpomme_32x32.xpm %{buildroot}/%{_datadir}/icons/wmpomme.xpm +install -m 644 icons/gpomme_32x32.xpm %{buildroot}/%{_datadir}/pixmaps/gpomme.xpm + %if 0%{?suse_version} > 1020 %fdupes -s %{buildroot} %endif -install -m 644 icons/gpomme_32x32.xpm %{buildroot}/%{_datadir}/icons/wmpomme.xpm -install -m 644 icons/gpomme_32x32.xpm %{buildroot}/%{_datadir}/pixmaps/gpomme.xpm %find_lang gpomme -%post -%{fillup_and_insserv -n %{name} %{name}} - -%preun -%stop_on_removal %{name} - -%postun -%restart_on_update %{name} -%{insserv_cleanup} - %clean rm -rf %{buildroot} +%pre +%service_add_pre %{name}.service + +%post +%service_add_post %{name}.service + +%preun +%service_del_preun %{name}.service + +%postun +%service_del_postun %{name}.service + %files %defattr(-,root,root) %doc AUTHORS README TODO %config(noreplace) %{_sysconfdir}/pommed.conf %config(noreplace) %{_sysconfdir}/dbus-1/system.d/pommed.conf -%{_sysconfdir}/init.d/pommed %{_sbindir}/pommed -%{_sbindir}/rcpommed %{_mandir}/man1/po* +%{_unitdir}/%{name}.service +%{_unitdir}/multi-user.target.wants/%{name}.service %files -n gpomme -f gpomme.lang %defattr(-,root,root)