Site Tools


Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
headphones_insertion_handling

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

headphones_insertion_handling [2012/09/29 15:05] – created fly-awayheadphones_insertion_handling [2012/11/17 00:44] (current) fly-away
Line 6: Line 6:
 sudo dpkg -i input-event-daemon_0.1.3-1_armhf.deb sudo dpkg -i input-event-daemon_0.1.3-1_armhf.deb
 </code> </code>
 +/etc/input-event-daemon.conf:
 +<file input-event-daemon.conf>
 +[Global]
 +listen = /dev/input/by-path/platform-tegra-alc5632.0-event
 +listen = /dev/input/event2
 +listen = /dev/input/event3
 +listen = /dev/input/event4
 +
 +[Keys]
 +POWER = systemctl suspend
 +#POWER = systemctl poweroff
 +#MUTE         = amixer -q set Master mute
 +#CTRL+ALT+ESC = beep
 +
 +[Switches]
 +HEADPHONE_INSERT:0 = amixer set 'Int Spk' on
 +HEADPHONE_INSERT:1 = amixer set 'Int Spk' off
 +LID:1 = /usr/bin/brightness off
 +LID:0 = /usr/bin/brightness on
 +#LID:0 = DISPLAY=:0 XAUTHORITY=/home/user/.Xauthority xset dpms force on
 +#LID:1 = DISPLAY=:0 XAUTHORITY=/home/user/.Xauthority xset dpms force off
 +</file>
 +
 +/usr/bin/brightness:
 +
 +<file>
 +#!/bin/bash
 +
 +[ x"$1" == x ] && exit 1
 +bfile=/sys/devices/platform/pwm-backlight/backlight/pwm-backlight/brightness
 +curbr=$(cat $bfile)
 +brsave=/etc/brightness
 +minbr=5
 +
 +case $1 in
 +  on)
 +    br=$(cat $brsave)
 +    if (($br >= $minbr))
 +    then
 +      echo -n $br > $bfile
 +    else
 +      echo -n $minbr > $bfile
 +    fi
 +    exit 0
 +  ;;
 +  off)
 +    echo $curbr > $brsave
 +    echo 0 > $bfile
 +    exit 0
 +  ;;
 +esac
 +let "newbr=curbr $1"
 +if (( 5 < $newbr && $newbr < 255 ))
 +then
 +  echo -n $newbr > $bfile
 +fi
 +</file>
  
 Done! Now you can put in you earphones and speakers will be switched off. Done! Now you can put in you earphones and speakers will be switched off.
-See /etc/input-event-daemon.conf for more information.+And you screen backlight should switch off when lid closed and restore when its open.
headphones_insertion_handling.txt · Last modified: 2012/11/17 00:44 by fly-away