Commit 2af3d8c5c4e15bf8064c09e3e609f3c0260bdd60

Authored by Silvan Calarco
1 parent 126c36289d
Exists in master

Switch to systemd renaming some things

Showing 7 changed files with 20 additions and 93 deletions Side-by-side Diff

... ... @@ -17,16 +17,17 @@
17 17 gcc -DVERSION=\"$(VERSION)\" -Wall backlight.c -o backlight -lpci -static
18 18  
19 19 install: backlight applesmc
20   - install -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(INITDIR) \
21   - $(DESTDIR)$(SBIN) $(DESTDIR)$(SBINDIR) $(DESTDIR)/lib/modprobe.d \
22   - $(DESTDIR)$(SBIN) $(DESTDIR)$(SBINDIR) \
23   - $(DESTDIR)$(SYSCONFDIR)/sysconfig
  20 + install -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(INITDIR)
  21 + install -d $(DESTDIR)$(SBIN) $(DESTDIR)$(SBINDIR) $(DESTDIR)/lib/modprobe.d
  22 + install -d $(DESTDIR)$(SBIN) $(DESTDIR)$(SBINDIR)
  23 + install -d $(DESTDIR)$(SYSCONFDIR)/sysconfig
  24 + install -d $(DESTDIR)/lib/systemd/system
24 25 install -s -m 4755 applesmc $(DESTDIR)$(BINDIR)
25 26 install -s -m 4755 backlight $(DESTDIR)$(BINDIR)
26 27 install -m 0755 macbook-set-input $(DESTDIR)$(BINDIR)/
27   - install -m 0755 macbook-tools-init $(DESTDIR)$(INITDIR)/macbook-tools
28   - install -m 644 macbook-tools-sysconfig $(DESTDIR)$(SYSCONFDIR)/sysconfig/macbook-tools
29   - install -m 0755 macbook-lightd $(DESTDIR)$(SBINDIR)/
  28 + install -m 0644 applesmcd.service $(DESTDIR)/lib/systemd/system/applesmcd.service
  29 + install -m 0644 appleir.service $(DESTDIR)/lib/systemd/system/appleir.service
  30 + install -m 0755 applesmcd $(DESTDIR)$(SBINDIR)/
30 31 install -m 0644 macbook-modprobe $(DESTDIR)/lib/modprobe.d/macbook.conf
31 32  
32 33 clean:
  1 +[Unit]
  2 +Description=lircd Apple IR remote daemon
  3 +ConditionPathExists=/dev/appleir
  4 +
  5 +[Service]
  6 +ExecStart=lircd -H macmini /etc/lirc/apple/lircd.conf.macmini
  1 +#!/bin/bash
  2 +#
  3 +# applesmc keyboard backlight sample test daemon
  4 +# by Silvan Calarco <silvan.calarco@mambasoft.it>
  5 +#
  6 +# This program is free software; you can redistribute it and/or modify it
  7 +# under the terms of the GNU General Public License v2 as published by the
  8 +# Free Software Foundation.
  9 +#
  10 +SENSIBILITY=25
  11 +TIMEWAIT=2
  12 +BLINDOFF=50
  13 +BLINDON=100
  14 +SENSOR_FILE=/sys/devices/platform/applesmc.768/light
  15 +
  16 +[ -e $SENSOR_FILE ] || exit 1
  17 +
  18 +while [ "1" ]; do
  19 + eval `cat $SENSOR_FILE|sed "s|(\(.*\),\(.*\))|LIGHTL=\1 LIGHTR=\2|"` >/dev/null
  20 + if [ "$LIGHTR" ]; then
  21 + if [ $LIGHTL -gt $LIGHTR ]; then
  22 + LIGHTM=$LIGHTL
  23 + else
  24 + LIGHTM=$LIGHTR
  25 + fi
  26 +# LIGHTM=`expr \( $LIGHTL + $LIGHTR \) / 2`
  27 + BACKLIGHT=`expr 255 - $LIGHTM \* $SENSIBILITY`
  28 + if [ $BACKLIGHT -lt $BLINDOFF ]; then
  29 + BACKLIGHT=0
  30 + elif [ $BACKLIGHT -lt $BLINDON ]; then
  31 + BACKLIGHT=`expr $BACKLIGHT + 50`
  32 + else
  33 + [ $BACKLIGHT -gt 255 ] && BACKLIGHT=255
  34 + fi
  35 + echo "LightM=$LIGHTM Backlight=$BACKLIGHT "
  36 + applesmc $BACKLIGHT
  37 +# echo $BACKLIGHT > /sys/devices/platform/applesmc.768/keyboard_backlight
  38 +# CURRBACKLIGHT=$BACKLIGHT
  39 + sleep $TIMEWAIT
  40 + fi
  41 +done
  1 +[Unit]
  2 +Description=MacBook keyboard backlight daemon
  3 +ConditionPathExists=/sys/devices/platform/applesmc.768
  4 +
  5 +[Service]
  6 +ExecStart=/usr/sbin/applesmcd
macbook-lightd
1   -#!/bin/bash
2   -#
3   -# applesmc keyboard backlight sample test daemon
4   -# by Silvan Calarco <silvan.calarco@mambasoft.it>
5   -#
6   -# This program is free software; you can redistribute it and/or modify it
7   -# under the terms of the GNU General Public License v2 as published by the
8   -# Free Software Foundation.
9   -#
10   -SENSIBILITY=25
11   -TIMEWAIT=2
12   -BLINDOFF=50
13   -BLINDON=100
14   -SENSOR_FILE=/sys/devices/platform/applesmc.768/light
15   -
16   -[ -e $SENSOR_FILE ] || exit 1
17   -
18   -while [ "1" ]; do
19   - eval `cat $SENSOR_FILE|sed "s|(\(.*\),\(.*\))|LIGHTL=\1 LIGHTR=\2|"` >/dev/null
20   - if [ "$LIGHTR" ]; then
21   - if [ $LIGHTL -gt $LIGHTR ]; then
22   - LIGHTM=$LIGHTL
23   - else
24   - LIGHTM=$LIGHTR
25   - fi
26   -# LIGHTM=`expr \( $LIGHTL + $LIGHTR \) / 2`
27   - BACKLIGHT=`expr 255 - $LIGHTM \* $SENSIBILITY`
28   - if [ $BACKLIGHT -lt $BLINDOFF ]; then
29   - BACKLIGHT=0
30   - elif [ $BACKLIGHT -lt $BLINDON ]; then
31   - BACKLIGHT=`expr $BACKLIGHT + 50`
32   - else
33   - [ $BACKLIGHT -gt 255 ] && BACKLIGHT=255
34   - fi
35   - echo "LightM=$LIGHTM Backlight=$BACKLIGHT "
36   - applesmc $BACKLIGHT
37   -# echo $BACKLIGHT > /sys/devices/platform/applesmc.768/keyboard_backlight
38   -# CURRBACKLIGHT=$BACKLIGHT
39   - sleep $TIMEWAIT
40   - fi
41   -done
macbook-tools-init
1   -#!/bin/bash
2   -#
3   -# Macbook tools initscript
4   -# Copyright (c) 2006-2009 by Silvan Calarco <silvan.calarco@mambasoft.it>
5   -# Released under the GPL v.2 license
6   -#
7   -# /etc/rc.d/init.d/macbook-tools
8   -#
9   -# chkconfig: 345 42 58
10   -# description: set screen backlight level and load iSight firmware on Apple MacBooks
11   -# processname: macbook-tools
12   -
13   -# Source function library.
14   -. /etc/rc.d/init.d/functions
15   -
16   -[ -e /etc/sysconfig/machine ] && . /etc/sysconfig/machine
17   -
18   -# Check for Apple manufacturer or exit
19   -[ "${SYSTEM_MANUFACTURER:0:5}" = "Apple" ] || {
20   - sed -i "s|KEYMAP=it-macbook|KEYMAP=it|" /etc/vconsole.conf
21   - exit 0
22   -}
23   -
24   -[ -f /etc/sysconfig/macbook-tools ] && . /etc/sysconfig/macbook-tools
25   -
26   -sed -i "s|KEYMAP=it$|KEYMAP=it-macbook|" /etc/vconsole.conf
27   -
28   -[ "$BACKLIGHT_LEVEL" ] || BACKLIGHT_LEVEL=190
29   -
30   -RETVAL=0
31   -
32   -#
33   -# See how we were called.
34   -#
35   -
36   -start() {
37   - [ -e /sys/devices/platform/applesmc.768 ] || modprobe applesmc
38   -
39   - if [ "$IR_EVENT_DEVICE" ]; then
40   - echo -n "Starting lircd for Apple IR remote: "
41   - lircd -H macmini /etc/lirc/apple/lircd.conf.macmini
42   - evaluate_retval
43   - echo
44   - fi
45   -
46   - #echo -n "Setting middle and right click mouse emulation: "
47   - #echo 1 > /proc/sys/dev/mac_hid/mouse_button_emulation
48   - #echo 125 > /proc/sys/dev/mac_hid/mouse_button2_keycode
49   - #echo 96 > /proc/sys/dev/mac_hid/mouse_button3_keycode
50   - #evaluate_retval
51   - #echo
52   -
53   - echo -n "Loading MacBook light sensor control daemon: "
54   - macbook-lightd &>/dev/null &
55   - evaluate_retval
56   - echo
57   -}
58   -
59   -stop() {
60   - echo -n "Stopping MacBook light sensor control daemon: "
61   - killall -9 macbook-lightd
62   - evaluate_retval
63   - echo
64   -}
65   -
66   -restart() {
67   - stop
68   - start
69   -}
70   -
71   -case "$1" in
72   -start)
73   - start
74   - ;;
75   -restart)
76   - restart
77   - ;;
78   -*)
79   - INITNAME=`basename $0`
80   - echo "Usage: $INITNAME {start|restart}"
81   - exit 1
82   -esac
83   -
84   -exit $RETVAL
macbook-tools-sysconfig
1   -ISIGHT_FIRMWARE_FILE=/mnt/osx/System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport
2   -IR_EVENT_DEVICE=/dev/appleir