3a. geany ~/Scripts/Unity-IR.sh
Code:
#!/bin/bash
# Script to enable irevent and irexec on start-up and then disable them
# as soon as certain programs are launched. Also starts lircmd.
# http://ubuntuforums.org/member.php?u=708376
# http://askubuntu.com/users/113523/rich-t
# Thanks go to Bulwinkle_Moose for getting the ball rolling:
# http://ubuntuforums.org/member.php?u=193624
# http://askubuntu.com/users/149558/bullwinkle-moose
notify-send -i ~/Icons/remote-control.png "Waiting for" "Remote Control"
while [ -z "$(pidof lircd)" ]; do
sleep 1
done
sudo lircmd --uinput
function irxeventoff {
if pidof irxevent >/dev/null 2>&1
then
killall irxevent
fi
}
function irxeventon {
if pidof irxevent >/dev/null 2>&1
then
:
else
irxevent &
fi
}
function irexecoff {
if pidof irexec >/dev/null 2>&1
then
killall irexec
fi
}
function irexecon {
if pidof irexec >/dev/null 2>&1
then
:
else
killall notify-osd
sleep 1
notify-send -i ~/Icons/remote-control.png "Desktop Remote Control" "Active" &
irexec &
fi
}
# For readability, list the applications to be monitored in this script alphabetically.
# Programs which require irxevent support should call irexecoff only.
# Those which have their own IR support should call both irexecoff and irxeventoff.
while :
do
if pgrep Boxee >/dev/null 2>&1
then
irxeventoff
irexecoff
elif pgrep elisa >/dev/null 2>&1
then
irexecoff
elif pgrep IR-Mouse.sh >/dev/null 2>&1
then
irxeventoff
irexecoff
elif pgrep mplayer >/dev/null 2>&1
then
irexecoff
elif pgrep mythfrontend >/dev/null 2>&1
then
irxeventoff
irexecoff
elif pgrep onboard >/dev/null 2>&1
then
irxeventoff
irexecoff
elif pgrep steam >/dev/null 2>&1
then
irxeventoff
irexecoff
elif pgrep totem >/dev/null 2>&1
then
irexecoff
elif pgrep vlc >/dev/null 2>&1
then
irexecoff
elif pgrep xbmc >/dev/null 2>&1
then
irxeventoff
irexecoff
elif pgrep xine >/dev/null 2>&1
then
irexecoff
elif pgrep xmame >/dev/null 2>&1
then
irexecoff
elif pgrep xmess >/dev/null 2>&1
then
irexecoff
else
irxeventon
irexecon
fi
sleep 2
done
chmod a+x ~/Scripts/Unity-IR.sh
3b. gksu geany ~/Scripts/Play_Blueray.sh
Code:
#!/bin/bash
# Play Blueray on Ubuntu
# Thanks to Brendan at http://fozztech.wordpress.com/ for this script.
# http://fozztech.wordpress.com/2011/08/22/bluray-on-ubuntu/
# To install MakeMKV (Thanks to Jeff Bower at https://www.ebower.com):
# https://www.ebower.com/docs/ubuntu-bluray/#MakeMKV
# sudo add-apt-repository ppa:ubuntu-ebower/ebower && sudo apt-get update && sudo apt-get install makemkv-install
# Visit http://www.makemkv.com/forum2/viewtopic.php?f=3&t=224 to find latest version number.
# sudo makemkv-install VERSION (eg. 1.8.2)
# For free MakeMKV beta key:
# http://www.makemkv.com/forum2/viewtopic.php?f=5&t=1053
#start makemkvcon on a new thread writing to a log in /tmp/
makemkvcon stream dev:/dev/sr0 > /tmp/makemkvcon.log &
#Notify the desktop user
notify-send -i media-optical "Starting Disc" "Bluray"
#wait for the port to open, this indicates makemkvcon is ready
DATA=''
while [[ -z $DATA ]]; do
sleep 1
DATA=`netstat -lnp | grep 51000 2>/dev/null`
done
#grep the log and parse out the list of titles
cat /tmp/makemkvcon.log | grep "was added as title" | awk '{print $7 }' | sed -e 's/^#//' > /tmp/titles.list
#load each title from the list as a url
TITLES=""
while read line
do
TITLES="$TITLES http://localhost:51000/stream/title$line.ts"
done < /tmp/titles.list
#clean up
rm /tmp/title.list
rm /tmp/makemkvcon.log
#open vlc with all titles in order
vlc -I lirc -f $TITLES &
sudo chmod a+x ~/Scripts/Play_Blueray.sh
3c. geany ~/Scripts/keyboard.sh
Code:
#!/bin/bash
# A little script to allow the onscreen keyboard
# to be toggled on and (completely) off with one
# remote control button or desktop shortcut.
if pgrep onboard >/dev/null 2>&1
then
killall onboard
exit
else
onboard &
fi
chmod a+x ~/Scripts/keyboard.sh
3d. sudo cp /usr/share/applications/onboard.desktop /usr/share/applications/onboard.desktop.old
gksu geany /usr/share/applications/onboard.desktop
Change the line
Exec=onboard
to:
Exec=~/Scripts/keyboard.sh
3e. geany ~/Scripts/IR-Mouse.sh
Code:
#!/bin/bash
# Script to display a dialog box to toggle LIRC mouse-mode off.
# This will help to prevent conflicts between lircmd, irexec and
# irxevent when used in combination with Unity-IR.sh.
killall notify-osd
sleep 1
notify-send -i mouse "Unity Remote-Control" "Mouse-Mode Active" &
sleep 1
zenity --info \
--no-wrap \
--title="IR-Mouse" \
--window-icon="/home/richard/Icons/remote-control.png" \
--text="<big><b>Unity Remote-Control Mouse-Mode Activated:</b></big>
Please leave this window open while <i>mousing around</i>.
<small>This will help to prevent conflicts between
remote control interpreters from occurring.</small>
Please click <b>OK</b> to return to
Push-Button Browsing mode.
<b>Thank You. ☺</b>"
# lircmd must be run as root, so you must add /usr/sbin/lircmd
# to your /etc/sudoers file, or (recommended) add to /etc/sudoers.d.
sudo killall lircmd
sleep 1
sudo lircmd --uinput
Exit
chmod a+x ~/Scripts/IR-Mouse.sh
Examples from my IR configuration:
Note: I find it handy to use irexec as a general IR parser for the Unity Desktop and so have
mapped all of my remote control's buttons to the ~/.lirc/irexec script. If you wish to be more
focussed in your approach and minimise conflicts, then comment out all unwanted buttons in this
script and then uncomment the #include ~/.lirc/unity-launcher_nofocus line in the ~/.lircrc script.
My ~/.lircrc file:
Code:
#Custom lircrc generated via mythbuntu-lirc-generator
#All application specific lircrc files are within ~/.lirc
#include ~/.lirc/unity-launcher
#include ~/.lirc/unity-dash
# Activating both unity-launcher and unity-dash scripts causes
# conflicts.
# Activate only one of them, but without the FOCUS attribute:
#include ~/.lirc/unity-launcher_nofocus
# Activating unity-launcher irxevent script is not necessary when
# irexec is configured for general desktop use and will cause
# conflicts. Configure irxevent scripts for unique key bindings
# in individual applications and disable irxevent when they are
# launched. This is done via UnityIR.sh.
#include ~/.lirc/unity-panel
# Unity Panel doesn't accept irxevent!
#include ~/.lirc/CurrentWindow
# CurrentWindow - For Testing Remote Control.
include ~/.lirc/mythtv
include ~/.lirc/mplayer
include ~/.lirc/xine
include ~/.lirc/vlc
include ~/.lirc/xmame
include ~/.lirc/xmess
include ~/.lirc/totem
include ~/.lirc/elisa
include ~/.lirc/irexec
My ~/.lirc/irexec file:
Code:
# LIRCRC Auto Generated by Mythbuntu Lirc Generator
# Author(s): Mario Limonciello, Nick Fox, John Baab
# Created for use with Mythbuntu
begin
remote = mceusb_hauppauge
prog = irexec
button = Power
button = Clear
config = (kill $(pgrep mythfrontend) || true) && mythfrontend --service &
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = irexec
button = Power
button = Clear
config = (kill $(pgrep mythfrontend) || true) && mythfrontend --service &
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_POWER
button = KEY_CLEAR
config = (kill $(pgrep mythfrontend) || true) && mythfrontend --service &
repeat = 0
delay = 0
end
#begin
# remote = mceusb
# prog = irexec
# button = KEY_DVD
# config = /usr/bin/xdotool key XF86TopMenu
# repeat = 0
# delay = 0
#end
begin
remote = mceusb
prog = irexec
button = KEY_DVD
config = ~/Scripts/Play_Blueray.sh
repeat = 0
delay = 0
end
#begin
# remote = mceusb
# prog = irexec
# button = KEY_POWER
# config = /usr/bin/xdotool key XF86PowerOff
# repeat = 0
# delay = 0
#end
begin
remote = mceusb
prog = irexec
button = KEY_POWER
config = /usr/bin/gnome-session-quit --power-off
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_TV
config = /usr/bin/xdotool key XF86Video
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_RADIO
config = steam steam://open/bigpicture
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_AUDIO
config = /usr/bin/xdotool key XF86Music
repeat = 0
delay = 0
end
#begin
# remote = mceusb
# prog = irexec
# button = Pictures
# config = /usr/bin/xdotool key XF86Pictures
# repeat = 0
# delay = 0
#end
begin
remote = mceusb
prog = irexec
button = Pictures
config = /usr/bin/shotwell
repeat = 0
delay = 0
end
#begin
# remote = mceusb
# prog = irexec
# button = KEY_VIDEO
# config = /usr/bin/xdotool key XF86Video
# repeat = 0
# delay = 0
#end
begin
remote = mceusb
prog = irexec
button = KEY_VIDEO
config = /usr/bin/xbmc
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_RECORD
config = /usr/bin/xdotool key XF86AudioRecord
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_PLAY
config = /usr/bin/xdotool key XF86AudioPlay
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_STOP
config = /usr/bin/xdotool key XF86AudioStop
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_REWIND
config = /usr/bin/xdotool key XF86AudioRewind
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_FORWARD
config = /usr/bin/xdotool key XF86BackForward
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_AGAIN
config = /usr/bin/xdotool key XF86AudioPrev
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_NEXT
config = /usr/bin/xdotool key XF86AudioNext
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_PAUSE
config = /usr/bin/xdotool key XF86AudioPause
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_BACK
config = /usr/bin/xdotool key Escape
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = More
config = /usr/bin/xdotool key Menu
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_UP
config = /usr/bin/xdotool key Up
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_DOWN
config = /usr/bin/xdotool key Down
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_LEFT
config = /usr/bin/xdotool key Left
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_RIGHT
config = /usr/bin/xdotool key Right
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_OK
config = /usr/bin/xdotool key Return
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_VOLUMEUP
config = /usr/bin/xdotool key XF86AudioRaiseVolume
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_VOLUMEDOWN
config = /usr/bin/xdotool key XF86AudioLowerVolume
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_HOME
config = /usr/bin/xdotool key alt+F1
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_MUTE
config = /usr/bin/xdotool key XF86AudioMute
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_CHANNELUP
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_CHANNELDOWN
config = /usr/bin/xdotool key XF86Back
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = LiveTV
config = /usr/bin/xdotool key XF86Video
repeat = 0
delay = 0
end
#begin
# remote = mceusb
# prog = irexec
# button = Guide
# config = /usr/bin/xdotool key XF86Video
# repeat = 0
# delay = 0
#end
begin
remote = mceusb
prog = irexec
button = Guide
config = usr/bin/yelp
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = RecTV
config = /usr/bin/xdotool key XF86Video
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_1
config = /usr/bin/xdotool key 1
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_2
config = /usr/bin/xdotool key 2
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_3
config = /usr/bin/xdotool key 3
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_4
config = /usr/bin/xdotool key 4
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_5
config = /usr/bin/xdotool key 5
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_6
config = /usr/bin/xdotool key 6
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_7
config = /usr/bin/xdotool key 7
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_8
config = /usr/bin/xdotool key 8
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_9
config = /usr/bin/xdotool key 9
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_0
config = /usr/bin/xdotool key 0
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = Star
config = /usr/bin/xdotool key asterisk
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = Hash
config = /usr/bin/xdotool key numbersign
repeat = 0
delay = 0
end
#begin
# remote = mceusb
# prog = irexec
# button = KEY_CLEAR
# config = /usr/bin/xdotool key Clear
# repeat = 0
# delay = 0
#end
begin
remote = mceusb
prog = irexec
button = KEY_CLEAR
config = /home/richard/Scripts/IR-Mouse.sh
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = Print
config = /usr/bin/xdotool key Print
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_ENTER
button = More
config = /usr/bin/xdotool key alt+F10
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_ENTER
button = KEY_CLEAR
config = /home/richard/Scripts/keyboard.sh
repeat = 0
delay = 0
end
My ~/.lirc/unity-launcher file:
Code:
begin
remote = mceusb
prog = irxevent
button = KEY_UP
repeat = 0
config = Key Up Focus unity-launcher
end
begin
remote = mceusb
prog = irxevent
button = KEY_DOWN
repeat = 0
config = Key Down Focus unity-launcher
end
begin
remote = mceusb
prog = irxevent
button = KEY_LEFT
repeat = 0
config = Key Left Focus unity-launcher
end
begin
remote = mceusb
prog = irxevent
button = KEY_RIGHT
repeat = 0
config = Key Right Focus unity-launcher
end
begin
remote = mceusb
prog = irxevent
button = KEY_PLAY
config = Key Return Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_STOP
config = Key Escape Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_OK
config = Key Return Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_FORWARD
config = Key Return Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_REWIND
config = Key BackSpace Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_NEXT
config = Key Return Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_AGAIN
config = Key BackSpace Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_BACK
config = Key Escape Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = More
config = Key Menu Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_1
config = Key 1 Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_2
config = Key 2 Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_3
config = Key 3 Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_4
config = Key 4 Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_5
config = Key 5 Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_6
config = Key 6 Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_7
config = Key 7 Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_8
config = Key 8 Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_9
config = Key 9 Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_0
config = Key 0 Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = Star
config = Key KP_Multiply Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = Hash
config = Key numbersign Focus unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_ENTER
config = Key KP_Enter Focus unity-launcher
repeat = 0
end
#begin
# remote = mceusb
# prog = irxevent
# button = KEY_
# config = Key Focus unity-launcher
# repeat = 0
#end
My ~/.lirc/unity-dash file:
Code:
begin
remote = mceusb
prog = irxevent
button = KEY_UP
repeat = 0
config = Key Up Focus unity-dash
end
begin
remote = mceusb
prog = irxevent
button = KEY_DOWN
repeat = 0
config = Key Down Focus unity-dash
end
begin
remote = mceusb
prog = irxevent
button = KEY_LEFT
repeat = 0
config = Key Left Focus unity-dash
end
begin
remote = mceusb
prog = irxevent
button = KEY_RIGHT
repeat = 0
config = Key Right Focus unity-dash
end
begin
remote = mceusb
prog = irxevent
button = KEY_PLAY
config = Key Return Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_STOP
config = Key Escape Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_OK
config = Key Return Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_FORWARD
config = Key Return Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_REWIND
config = Key BackSpace Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_NEXT
config = Key Return Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_AGAIN
config = Key BackSpace Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_BACK
config = Key Escape Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = More
config = Key Menu Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_1
config = Key 1 Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_2
config = Key 2 Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_3
config = Key 3 Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_4
config = Key 4 Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_5
config = Key 5 Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_6
config = Key 6 Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_7
config = Key 7 Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_8
config = Key 8 Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_9
config = Key 9 Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_0
config = Key 0 Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = Star
config = Key KP_Multiply Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = Hash
config = Key numbersign Focus unity-dash
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_ENTER
config = Key KP_Enter Focus unity-dash
repeat = 0
end
#begin
# remote = mceusb
# prog = irxevent
# button = KEY_
# config = Key Focus unity-dash
# repeat = 0
#end
My ~/.lirc/unity-launcher_nofocus file:
Code:
begin
remote = mceusb
prog = irxevent
button = KEY_UP
repeat = 0
config = Key Up unity-launcher
end
begin
remote = mceusb
prog = irxevent
button = KEY_DOWN
repeat = 0
config = Key Down unity-launcher
end
begin
remote = mceusb
prog = irxevent
button = KEY_LEFT
repeat = 0
config = Key Left unity-launcher
end
begin
remote = mceusb
prog = irxevent
button = KEY_RIGHT
repeat = 0
config = Key Right unity-launcher
end
begin
remote = mceusb
prog = irxevent
button = KEY_PLAY
config = Key Return unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_STOP
config = Key Escape unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_OK
config = Key Return unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_FORWARD
config = Key Return unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_REWIND
config = Key BackSpace unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_NEXT
config = Key Return unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_AGAIN
config = Key BackSpace unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_BACK
config = Key Escape unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = More
config = Key Menu unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_1
config = Key 1 unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_2
config = Key 2 unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_3
config = Key 3 unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_4
config = Key 4 unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_5
config = Key 5 unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_6
config = Key 6 unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_7
config = Key 7 unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_8
config = Key 8 unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_9
config = Key 9 unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_0
config = Key 0 unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = Star
config = Key KP_Multiply unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = Hash
config = Key numbersign unity-launcher
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_ENTER
config = Key KP_Enter unity-launcher
repeat = 0
end
#begin
# remote = mceusb
# prog = irxevent
# button = KEY_
# config = Key unity-launcher
# repeat = 0
#end
My ~/.lirc/unity-panel file:
Code:
begin
remote = mceusb
prog = irxevent
button = KEY_UP
repeat = 0
config = Key Up unity-panel
end
begin
remote = mceusb
prog = irxevent
button = KEY_DOWN
repeat = 0
config = Key Down unity-panel
end
begin
remote = mceusb
prog = irxevent
button = KEY_LEFT
repeat = 0
config = Key Left unity-panel
end
begin
remote = mceusb
prog = irxevent
button = KEY_RIGHT
repeat = 0
config = Key Right unity-panel
end
begin
remote = mceusb
prog = irxevent
button = KEY_PLAY
config = Key Return unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_STOP
config = Key Escape unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_OK
config = Key Return unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_FORWARD
config = Key Return unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_REWIND
config = Key BackSpace unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_NEXT
config = Key Return unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_AGAIN
config = Key BackSpace unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_BACK
config = Key Escape unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = More
config = Key Menu unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_1
config = Key 1 unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_2
config = Key 2 unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_3
config = Key 3 unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_4
config = Key 4 unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_5
config = Key 5 unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_6
config = Key 6 unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_7
config = Key 7 unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_8
config = Key 8 unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_9
config = Key 9 unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_0
config = Key 0 unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = Star
config = Key KP_Multiply unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = Hash
config = Key numbersign unity-panel
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_ENTER
config = Key KP_Enter unity-panel
repeat = 0
end
#begin
# remote = mceusb
# prog = irxevent
# button = KEY_
# config = Key unity-panel
# repeat = 0
#end
My ~/.lirc/CurrentWindow file:
Code:
begin
remote = mceusb
prog = irxevent
button = KEY_UP
repeat = 0
config = Key Up CurrentWindow
end
begin
remote = mceusb
prog = irxevent
button = KEY_DOWN
repeat = 0
config = Key Down CurrentWindow
end
begin
remote = mceusb
prog = irxevent
button = KEY_LEFT
repeat = 0
config = Key Left CurrentWindow
end
begin
remote = mceusb
prog = irxevent
button = KEY_RIGHT
repeat = 0
config = Key Right CurrentWindow
end
begin
remote = mceusb
prog = irxevent
button = KEY_PLAY
config = Key Return CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_STOP
config = Key Escape CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_OK
config = Key Return CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_FORWARD
config = Key Return CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_REWIND
config = Key BackSpace CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_NEXT
config = Key Return CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_AGAIN
config = Key BackSpace CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_BACK
config = Key Escape CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = More
config = Key Menu CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_1
config = Key 1 CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_2
config = Key 2 CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_3
config = Key 3 CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_4
config = Key 4 CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_5
config = Key 5 CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_6
config = Key 6 CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_7
config = Key 7 CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_8
config = Key 8 CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_9
config = Key 9 CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_0
config = Key 0 CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = Star
config = Key KP_Multiply CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = Hash
config = Key numbersign CurrentWindow
repeat = 0
end
begin
remote = mceusb
prog = irxevent
button = KEY_ENTER
config = Key KP_Enter CurrentWindow
repeat = 0
end
#begin
# remote = mceusb
# prog = irxevent
# button = KEY_
# config = Key CurrentWindow
# repeat = 0
#end
7a. Add Device to your X11 configuration:
First you have to know that to use ANY mouse in x11, you have to add it to your xorg.conf.
Add "InputDevice" lines to your xorg.conf:
sudo cp /etc/x11/xorg.conf /etc/x11/xorg.conf.old
gksu geany /etc/x11/xorg.conf
Code:
Section "InputDevice"
Identifier "Remote"
Driver "mouse"
Option "Protocol" "IntelliMouse"
Option "SendCoreEvents"
Option "Buttons" "5"
Option "ZAxisMapping" "4 5"
EndSection
My /etc/x11/xorg.conf file:
Code:
Section "Screen"
Identifier "Default Screen"
DefaultDepth 24
EndSection
Section "Module"
Load "glx"
EndSection
Section "Device"
Identifier "Default Device"
Driver "nvidia"
Option "NoLogo" "True"
EndSection
Section "InputDevice"
Identifier "Remote"
Driver "mouse"
Option "Protocol" "IntelliMouse"
Option "SendCoreEvents"
Option "Buttons" "5"
Option "ZAxisMapping" "4 5"
EndSection
7b. Load Driver on Startup:
Next you have to load the correct driver to make it work. Add to the file
/etc/modules the entry:
uinput
sudo cp /etc/modules /etc/modules.old
gksu geany /etc/modules
My /etc/modules file:
Code:
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
loop
lp
rtc
# Generated by sensors-detect on Wed May 15 03:41:41 2013
# Chip drivers
coretemp
w83627ehf
uinput
Create a new file
/etc/udev/rules.d/55-uinput with one line:
KERNEL=="uinput", MODE="0666"
gksu geany /etc/udev/rules.d/55-uinput
7c. Edit your hardware.conf file:
Now you must tell lirc to start the mouse daemon and where the config file is. Edit your
/etc/lirc/hardware.conf to have these settings:
START_LIRCMD="true"
LIRCMD_CONF="/etc/lirc/lircmd.conf"
sudo cp /etc/lirc/hardware.conf /etc/lirc/hardware.conf.old
gksu geany /etc/lirc/hardware.conf
My lirc/hardware.conf file:
Code:
# /etc/lirc/hardware.conf
#
#Chosen Remote Control
REMOTE="Windows Media Center Transceivers/Remotes (all)"
REMOTE_MODULES="lirc_dev mceusb"
REMOTE_DRIVER=""
REMOTE_DEVICE="/dev/lirc0"
REMOTE_SOCKET=""
REMOTE_LIRCD_CONF="mceusb/lircd.conf.mceusb"
REMOTE_LIRCD_ARGS=""
#Chosen IR Transmitter
TRANSMITTER="None"
TRANSMITTER_MODULES=""
TRANSMITTER_DRIVER=""
TRANSMITTER_DEVICE=""
TRANSMITTER_SOCKET=""
TRANSMITTER_LIRCD_CONF=""
TRANSMITTER_LIRCD_ARGS=""
#Disable kernel support.
#Typically, lirc will disable in-kernel support for ir devices in order to
#handle them internally. Set to false to prevent lirc from disabling this
#in-kernel support.
#DISABLE_KERNEL_SUPPORT="true"
#Enable lircd
START_LIRCD="true"
#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD="false"
#Try to load appropriate kernel modules
LOAD_MODULES="true"
# Default configuration files for your hardware if any
LIRCMD_CONF="/etc/lirc/lircmd.conf"
#Forcing noninteractive reconfiguration
#If lirc is to be reconfigured by an external application
#that doesn't have a debconf frontend available, the noninteractive
#frontend can be invoked and set to parse REMOTE and TRANSMITTER
#It will then populate all other variables without any user input
#If you would like to configure lirc via standard methods, be sure
#to leave this set to "false"
FORCE_NONINTERACTIVE_RECONFIGURATION="false"
START_LIRCMD="true"
7d. Create
lircmd.conf
Create a new file
/etc/lirc/lircmd.conf. You have to tell lirc which buttons will move the cursor what direction. Use irw to determine your button names if you need. Also note the TOGGLE_ACTIVATE is the button you will push to turn on and off your mouse capabilities of your remote. You must push this button before the other buttons will command the cursor, and you must push it again for these buttons to have their regular usage.
gksu geany /etc/lirc/lircmd.conf
My /etc/lirc/lircmd.conf file:
Code:
#
# lircmd config file
#
# CONFIGURED
#
# To find out how to get a proper configuration file please read:
#
# /usr/share/doc/lirc/README.Debian
PROTOCOL IntelliMouse
#PROTOCOL MouseSystems
# ACCELERATOR start max multiplier
ACCELERATOR 2 30 5
TOGGLE_ACTIVATE * KEY_CLEAR
MOVE_N * KEY_2
MOVE_NE * KEY_3
MOVE_E * KEY_6
MOVE_SE * KEY_9
MOVE_S * KEY_8
MOVE_SW * KEY_7
MOVE_W * KEY_4
MOVE_NW * KEY_1
MOVE_N * KEY_UP
MOVE_E * KEY_RIGHT
MOVE_S * KEY_DOWN
MOVE_W * KEY_LEFT
MOVE_IN * KEY_CHANNELUP
MOVE_OUT * KEY_CHANNELDOWN
BUTTON1_TOGGLE * KEY_5
BUTTON2_TOGGLE * Hash
BUTTON3_TOGGLE * Star
BUTTON1_CLICK * KEY_OK
BUTTON1_CLICK * KEY_HOME
BUTTON3_CLICK * KEY_MUTE
# BUTTONx_CLICK, BUTTONx_UP, BUTTONx_DOWN are also possible
Note: According to this configuration the CLEAR button (at the very bottom left of my remote) will be used to toggle LIRC Mouse Mode.
7e. Edit your /etc/init.d/lirc file:
There is an issue with the init script in Ubuntu. There is no way to pass arguments to the lircmd daemon at start up. We need to start it with the --uinput flag. to do this you need to edit
/etc/init.d/lirc. Note: line 194 added
-- -- uinput
Code:
191 if [ "$START_LIRCMD" = "true" ]; then
192 [ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
193 log_daemon_msg "Starting remote control mouse daemon : LIRCMD "
194 start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/lircmd -- -- uinput< /dev/null
195 log_end_msg $?
196 fi
sudo cp /etc/init.d/lirc /etc/init.d/lirc.old
gksu geany /etc/init.d/lirc
My /etc/init.d/lirc file:
Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides: lirc
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts LIRC daemon.
# Description: LIRC is used to control different
# infrared receivers and transceivers.
### END INIT INFO
load_modules ()
{
MODULES_MISSING=false
log_daemon_msg "Loading LIRC modules"
for mod in $*; do
if [ $mod = "udev" ]; then
log_end_msg 0
log_success_msg "Restarted via udev, don't reload modules"
break
else
modprobe $mod 2> /dev/null || MODULES_MISSING=true
fi
done
log_end_msg $?
if $MODULES_MISSING; then
log_failure_msg "Unable to load LIRC kernel modules. Verify your"
log_failure_msg "selected kernel modules in /etc/lirc/hardware.conf"
START_LIRCMD=false
START_LIRCD=false
fi
}
build_remote_args ()
{
REMOTE_ARGS="$*"
#For remote only detection support, we need
#both REMOTE_DEVICE and TRANSMITTER_DEVICE undefined
if [ -z "$REMOTE_DEVICE" ] && [ -z "$TRANSMITTER_DEVICE" ] && [ -c $dev ]; then
REMOTE_DEVICE="$dev"
fi
#If we have a REMOTE_DEVICE or REMOTE_DRIVER defined (either because no devices
#were defined, OR if we explicitly did), then populate REMOTE_ARGS
if [ ! -z "$REMOTE_DEVICE" ] || [ ! -z "$REMOTE_DRIVER" ]; then
if [ -n "$REMOTE_DEVICE" ] && [ "$REMOTE_DEVICE" != "none" ]; then
REMOTE_ARGS="--device=$REMOTE_DEVICE $REMOTE_ARGS"
fi
if [ -n "$REMOTE_DRIVER" ] && [ "$REMOTE_DRIVER" != "none" ]; then
REMOTE_ARGS="--driver=$REMOTE_DRIVER $REMOTE_ARGS"
fi
#Now, if we ALSO have a transmitter defined, add some args
#To make the first lircd listen up
if [ ! -z "$TRANSMITTER_DEVICE" ] || [ ! -z "$TRANSMITTER_DRIVER" ]; then
REMOTE_ARGS="$REMOTE_ARGS --listen"
fi
REMOTE_ARGS="--output=$REMOTE_SOCKET $REMOTE_ARGS"
fi
echo $REMOTE_ARGS
}
build_transmitter_args ()
{
TRANSMITTER_ARGS="$*"
#Transmitters must be explicitly be defined
if [ ! -z "$TRANSMITTER_DEVICE" ] || [ ! -z "$TRANSMITTER_DRIVER" ]; then
if [ -n "$TRANSMITTER_DEVICE" ] && [ "$TRANSMITTER_DEVICE" != "none" ]; then
TRANSMITTER_ARGS="--device=$TRANSMITTER_DEVICE $TRANSMITTER_ARGS"
fi
if [ -n "$TRANSMITTER_DRIVER" ] && [ "$TRANSMITTER_DRIVER" != "none" ]; then
TRANSMITTER_ARGS="--driver=$TRANSMITTER_DRIVER $TRANSMITTER_ARGS"
fi
#Now, if we ALSO have a remote defined, add some args
#To make the second lircd connect
if [ ! -z "$REMOTE_DEVICE" ] || [ ! -z "$REMOTE_DRIVER" ]; then
TRANSMITTER_ARGS="$TRANSMITTER_ARGS --connect=localhost:8765 --pidfile=/var/run/lirc/lircd1.pid"
fi
TRANSMITTER_ARGS="--output=$TRANSMITTER_SOCKET $TRANSMITTER_ARGS"
fi
echo $TRANSMITTER_ARGS
}
in_kernel_support() {
if [ -d /sys/class/rc ] && [ "$DISABLE_KERNEL_SUPPORT" = "true" ]; then
for file in `find /sys/class/rc/*/ -name protocols`; do
if [ "$1" = "disable" ]; then
echo "lirc" > $file
else
echo "none" > $file
for protocol in `cat $file`; do
echo "+${protocol}" > $file
done
fi
done
fi
}
. /lib/lsb/init-functions
test -f /usr/sbin/lircd || exit 0
test -f /usr/sbin/lircmd || exit 0
START_LIRCMD=true
START_LIRCD=true
START_IREXEC=true
DISABLE_KERNEL_SUPPORT=true
if [ -f /etc/lirc/hardware.conf ];then
. /etc/lirc/hardware.conf
fi
if [ ! -f /etc/lirc/lircd.conf ] || grep -q "^#UNCONFIGURED" /etc/lirc/lircd.conf; then
if [ "$1" = "start" ]; then
log_success_msg "No valid /etc/lirc/lircd.conf has been found."
log_success_msg "Remote control support has been disabled."
log_success_msg "Reconfigure LIRC or manually replace /etc/lirc/lircd.conf to enable."
fi
START_LIRCD=false
START_LIRCMD=false
START_IREXEC=false
fi
if [ ! -f /etc/lirc/lircmd.conf ] || grep -q "^#UNCONFIGURED" /etc/lirc/lircmd.conf; then
START_LIRCMD=false
fi
if [ ! -f /etc/lirc/lircrc ] || grep -q "^#UNCONFIGURED" /etc/lirc/lircrc; then
START_IREXEC=false
fi
#We need default socket locations
OLD_SOCKET="/dev/lircd"
if [ -z "$REMOTE_SOCKET" ]; then
REMOTE_SOCKET="/var/run/lirc/lircd"
fi
if [ -z "$TRANSMITTER_SOCKET" ]; then
TRANSMITTER_SOCKET="/var/run/lirc/lircd"
#Now, if we ALSO have a remote defined,
#change the default transmitter socket
if [ ! -z "$REMOTE_DEVICE" ] || [ ! -z "$REMOTE_DRIVER" ]; then
TRANSMITTER_SOCKET="${TRANSMITTER_SOCKET}1"
fi
fi
case "$1" in
start)
if [ "$LOAD_MODULES" = "true" ] && [ "$START_LIRCD" = "true" ]; then
load_modules $2 $REMOTE_MODULES $TRANSMITTER_MODULES $MODULES
in_kernel_support "disable"
fi
if [ "$START_LIRCD" = "true" ]; then
[ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
log_daemon_msg "Starting remote control daemon(s) : LIRC "
REMOTE_LIRCD_ARGS=`build_remote_args $REMOTE_LIRCD_ARGS`
TRANSMITTER_LIRCD_ARGS=`build_transmitter_args $TRANSMITTER_LIRCD_ARGS`
#if we have a remote defined, it is primary process
if [ ! -z "$REMOTE_LIRCD_ARGS" ]; then
start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/lircd -- $REMOTE_LIRCD_ARGS < /dev/null
log_end_msg $?
if [ -S "$REMOTE_SOCKET" -a "$OLD_SOCKET" != "$REMOTE_SOCKET" ]; then
rm -f $OLD_SOCKET && ln -s $REMOTE_SOCKET $OLD_SOCKET
fi
#now if we additionally have a transmitter defined, it is secondary process
if [ ! -z "$TRANSMITTER_LIRCD_ARGS" ]; then
/usr/sbin/lircd $TRANSMITTER_LIRCD_ARGS < /dev/null
if [ -S "$TRANSMITTER_SOCKET" ]; then
rm -f ${OLD_SOCKET}1 && ln -s $TRANSMITTER_SOCKET ${OLD_SOCKET}1
fi
fi
elif [ ! -z "$TRANSMITTER_LIRCD_ARGS" ]; then
start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/lircd -- $TRANSMITTER_LIRCD_ARGS < /dev/null
log_end_msg $?
if [ -S "$TRANSMITTER_SOCKET" -a "$OLD_SOCKET" != "$TRANSMITTER_SOCKET" ]; then
rm -f $OLD_SOCKET && ln -s $TRANSMITTER_SOCKET $OLD_SOCKET
fi
else
log_end_msg 1
fi
fi
if [ "$START_LIRCMD" = "true" ]; then
[ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
log_daemon_msg "Starting remote control mouse daemon : LIRCMD "
start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/lircmd -- -- uinput < /dev/null
log_end_msg $?
fi
if [ "$START_IREXEC" = "true" ]; then
[ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
log_daemon_msg "Starting execution daemon: irexec"
start-stop-daemon --start --quiet --oknodo --exec /usr/bin/irexec -- -d /etc/lirc/lircrc < /dev/null
log_end_msg $?
fi
;;
stop)
in_kernel_support "enable"
if [ "$START_IREXEC" = "true" ]; then
log_daemon_msg "Stopping execution daemon: irexec"
start-stop-daemon --stop --quiet --exec /usr/bin/irexec
log_end_msg $?
fi
if [ "$START_LIRCMD" = "true" ]; then
log_daemon_msg "Stopping remote control mouse daemon: LIRCMD"
start-stop-daemon --stop --quiet --exec /usr/sbin/lircmd
log_end_msg $?
fi
if [ "$START_LIRCD" = "true" ]; then
log_daemon_msg "Stopping remote control daemon(s): LIRC"
start-stop-daemon --stop --quiet --exec /usr/sbin/lircd
log_end_msg $?
[ -h "$OLD_SOCKET" ] && rm -f $OLD_SOCKET
[ -h "${OLD_SOCKET}1" ] && rm -f ${OLD_SOCKET}1
fi
;;
reload|force-reload)
if [ "$START_IREXEC" = "true" ]; then
start-stop-daemon --stop --quiet --signal 1 --exec /usr/bin/irexec
fi
if [ "$START_LIRCD" = "true" ]; then
start-stop-daemon --stop --quiet --signal 1 --exec /usr/sbin/lircd
fi
if [ "$START_LIRCMD" = "true" ]; then
start-stop-daemon --stop --quiet --signal 1 --exec /usr/sbin/lircmd
fi
;;
restart)
$0 stop
#passes parameter $2 which is possibly our udev paramater
$0 start $2
;;
*)
echo "Usage: /etc/init.d/lircd {start|stop|reload|restart|force-reload}"
exit 1
esac
exit 0
7f. Add lircmd --uinput to /etc/rc.local to run on startup:
gksu geany /etc/rc.local
My /etc/rc.local file:
Code:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
lircmd --uinput
exit 0
7f. Create configuration files for lircmd and killall to /etc/sudoers.d/ to enable them to run from a script:
http://luiseth.wordpress.com/2012/04...-etcsudoers-d/
http://ubuntuforums.org/showthread.php?t=1132821
https://help.ubuntu.com/community/Sudoers
Note: Create the files using the following as a template;
Code:
# Enable me to mount/umount simply
Host_Alias HOST = your_machine_name. You can get it by running cat /etc/hostname
Cmnd_Alias MOUNT = /bin/mount,/bin/umount
Cmnd_Alias FILEPERM = /bin/chown
your_username HOST=(root) NOPASSWD:MOUNT,FILEPERM
and enable them with variations of the following commands;
$sudo chown root:root mount_conf
$sudo chmod 0440 mount_conf
$sudo mv mount_conf /etc/sudoers.d/
then check everything went fine, by running sudo -l
Code:
$sudo -l
Matching Defaults entries for luis on this host:
env_reset
User luis may run the following commands on this host:
(ALL) ALL
(root) NOPASSWD: /bin/mount, /bin/umount, (root) /bin/chown
My sudoers.d files:
geany killall_conf
Code:
# Enable me to run killall as user.
Cmnd_Alias KILLALL = /usr/bin/killall
richard htpc=(root) NOPASSWD:KILLALL
geany lircmd_conf
Code:
# Enable me to run lircmd as user.
Cmnd_Alias LIRCMD = /usr/sbin/lircmd
richard htpc=(root) NOPASSWD:LIRCMD
sudo chown root:root lircmd_conf
sudo chmod 0440 lircmd_conf
sudo mv lircmd_conf /etc/sudoers.d/
sudo chown root:root killall_conf
sudo chmod 0440 killall_conf
sudo mv killall_conf /etc/sudoers.d/
sudo -l
Code:
Matching 'Defaults' entries for richard on this host:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User richard may run the following commands on this host:
(ALL : ALL) ALL
(root) NOPASSWD: /usr/bin/killall
(root) NOPASSWD: /usr/sbin/lircmd
WARNING: The first time I tried to do this, I created the configuration files as:
Code:
# Enable me to run killall as user.
Host_Alias HOST = htpc
Cmnd_Alias KILLALL = /usr/bin/killall
richard HOST=(root) NOPASSWD:KILLALL
Code:
# Enable me to run lircmd as user.
Host_Alias HOST = htpc
Cmnd_Alias LIRCMD = /usr/sbin/lircmd
richard HOST=(root) NOPASSWD:LIRCMD
This caused sudo to break, giving me an error report telling me that the command alias on line 3 of lircmd_conf
already existed. From that point on I was unable to get root access to anything on my system!
I was able to fix this by booting from an Ubuntu Live USB (or CD) and editing the files to remove the command alias
as shown in my example files.
Please be careful!!!
Bookmarks