Grabbing the net and tuning up for the target system here below some tips.
in /usr/lib/pm-utils/sleep.d/
i created a file named 02mythtv_MBE with the following content:
----------- code start --------------
#!/bin/bash
# don't forget: sudo chmod a+x /usr/lib/pm-utils/sleep.d/02mythtv_xBE
RETVAL=0
case "$1" in
suspend|hibernate)
sv stop mythbackend
sv stop lircd
sleep 0.2
rmmod tuner
rmmod cx88_dvb
rmmod cx88_alsa
rmmod cx88_blackbird
rmmod cx8800
rmmod cx8802
rmmod cx88xx
rmmod ivtv
rmmod bttv
rmmod tveeprom
rmmod cx22702
rmmod cx88_vp3054_i2c
rmmod btcx_risc
rmmod compat_ioctl32
rmmod videodev
rmmod v4l1_compat
rmmod cx2341x
rmmod wm8775
rmmod v4l2_common
#
/etc/net/scripts/network.init stop
sleep 0.2
rmmod rt73usb # network WiFi USB dongle
rmmod zd1211rw # Siemens network WiFi USB dongle
#
rmmod lirc_i2c # Remove remote
rmmod lirc_dev # Remove remote
RETVAL=$?
;;
resume|thaw)
modprobe rt73usb # network WiFi USB dongle
modprobe zd1211rw # Siemens network WiFi USB dongle
sleep 0.2
/etc/net/scripts/network.init restart
#
modprobe v4l2_common
modprobe wm8775
modprobe cx2341x
modprobe v4l1_compat
modprobe videodev
modprobe compat_ioctl32
modprobe cx88_vp3054_i2c
modprobe cx88xx
modprobe cx22702
modprobe tuner
modprobe cx8800
modprobe cx88_blackbird
modprobe cx8802
modprobe cx88_alsa
modprobe cx88_dvb
modprobe ivtv
modprobe bttv
#
modprobe lirc_dev
modprobe lirc_i2c
sv start mythbackend
sv start lircd
#
RETVAL=$?
;;
esac
-------- code end ------------
For going to sleep --> /home/mythtv/bin/Shutdown_MBE
----------- code start --------------
#!/bin/bash
#
logfile=/var/log/mythtv/Shutdown_MBE.log
now=`date`
me=`basename $0 | sed -e 's/^\.//'`
echo ----------------------------------------------------- >> $logfile
#
echo "$me requested $now" >> $logfile
echo >> $logfile
vmstat -S K >> $logfile
sudo killall mythwelcome
sudo killall x11vnc # only if started
echo >> $logfile
sudo pm-suspend >> $logfile
#---When we reach this point in the script, we've suspended and restarted again.
result=$? # returns 2 if hibernate was aborted due to errors in script
echo "suspend result returned = $result" >> $logfile
# Wait for the backend to accept connections
while !(netstat -pl 2>&1 | grep -q mythbackend); do sleep 0.1; done
# Bring up the frontend
export DISPLAY=:0.0
/usr/bin/mythwelcome &
# if x11vnc was running it should be restored
sudo /usr/bin/x11vnc -nap -wait 50 -noxdamage -passwd xxxx -display :0 -forever -o /var/log/x11vnc.log -bg &
#---Give dcron a chance to run periodic jobs each time is suspended
sudo /etc/rc.d/crond restart >> $logfile
#---hide the mouse cursor
/usr/X11R6/bin/unclutter
-------- code end ------------
To set alarm --> /home/mythtv/bin/SetAlarm
----------- code start --------------
#!/bin/bash
#
# inspired from
http://www.mythtv.org/wiki/index.php/ACPI_Wakeup
# and
https://help.ubuntu.com/community/MythT ... t/ACPIWake
#
# MythWakeSet
#
# set mythtv wake-up time with UTC-adjusted time
#
# use: MythWakeSet date time
# ex.: MythWakeSet 2008-11-02 20:15:00
# See also 'man date' for date/time-formats.
# TimeZone, use +0100 for GMT+1
#TZ="+0100"
TZ=$(date +%z)
LOG=/var/log/mythtv/SetAlarm.log
DATE=$(date -d "$1 $2 $TZ" "+%F %H:%M:%S" -u)
SECS=$(date -d "$1 $2" "+%s")
echo Running $0 to set the wakeup time to $1 $2 >>$LOG
if [ -e /sys/class/rtc/rtc0/wakealarm ]; then
echo 0 > /sys/class/rtc/rtc0/wakealarm
echo $SECS > /sys/class/rtc/rtc0/wakealarm
echo "echo 0 > /sys/class/rtc/rtc0/wakealarm" >>$LOG
echo "echo $SECS > /sys/class/rtc/rtc0/wakealarm" >>$LOG
cat /proc/driver/rtc >>$LOG
else
if [ -e /proc/acpi/alarm ]; then
echo $DATE > /proc/acpi/alarm
echo "echo $DATE > /proc/acpi/alarm" >>$LOG
else
echo "ERROR, Wakeup not set, no /sys/class/rtc/rtc0/wakealarm and no /proc/acpi/alarm found" >>$LOG
fi
fi
-------- code end ------------
To check if shutdown is possible create --> /home/mythtv/bin/ShutdownCheck_MBE
----------- code start --------------
#!/bin/bash
#
## Return Value Meaning
## 0 Ok to shut down
## >=1 Something going on -- do not shut down
#
#
logfile=/var/log/mythtv/ShutdownCheck_MBE.log
exstate=0
now=`date`
me=`basename $0 | sed -e 's/^\.//'`
echo >> $logfile
echo >> $logfile
echo "-------------------">> $logfile
# The next few lines are useful for debugging until you have the scripts
# working, in case I forgot to mention something
.
#
echo "$me requested $now" >> $logfile
# Does mythshutdown say it is ok to shutdown?
/usr/bin/mythshutdown --check
result=$? # returns 0 if mythshutdown has no reason to stay up
echo "mythshutdown --check got result = $result" >> $logfile
if [ $result -ne 0 ]; then # if mythshutdown says to stay up,
exstate=$result # Stay up.
fi
# Check for mythfrontend running and capture result of check
pgrep -f mythfrontend.re >& /dev/null # grep returns 0 if it found any matches
if [ $? -eq 0 ]; then # if grep found any matches, stay up.
echo "mythfrontend is running - no Shut down is possible" >> $logfile
exstate=1 # Stay up.
fi
# Check for mythburn running and capture result of check
pgrep -f mythburn >& /dev/null # grep returns 0 if it found any matches
if [ $? -eq 0 ]; then # if grep found any matches, stay up.
echo "mythburn is running - no Shut down is possible" >> $logfile
exstate=1 # Stay up.
fi
# Check for mythfilldatabase running and capture result of check
pgrep mythfilldatabase >& /dev/null # pgrep returns 0 if it found any jobs that match supplied criteria
if [ $? -eq 0 ]; then # if pgrep found any jobs, stay up.
echo "mythfilldatabase is running - no Shut down is possible" >> $logfile
exstate=1 # Stay up.
fi
# to not shutdown during mythcommflag process, uncomment the following line
pgrep -f mythcommflag >& /dev/null
if [ $? -eq 0 ]; then # if pgrep found any jobs, stay up.
echo "mythcommflag is running - no Shut down is possible" >> $logfile
exstate=1 # Stay up.
fi
if [ `last | head | grep -c "pts/.*still logged in"` -ne 0 ]; then # check for active *remote* login?
echo "Remote is logged in - no Shut down is possible" >> $logfile
exstate=1
fi
# Now, if there are any pseudo-terminals in use then do not shutdown
if [ `ps -ef | egrep "pts/[0-6]" | egrep -v egrep | wc -l` -ne 0 ]; then
echo "There are pseudo-terminals in use - exit with 1 - Stay up" >> $logfile
exstate=1 # Stay up.
fi
exit $exstate
-------- code end ------------
And here is my configuration
#--------- CONFIGURATION --------------
# MythTV-Setup:
[alt] + s - (sudo mythtv-setup)
# Startup command:
# UNTAG Block shutdown before client connected
# Idle shutdown timeout (secs): 120
# Max. wait for recording (min): 15
# Start before rec (secs): 120
# Wakeup time format: yyyy-MM-dd hh:mm:ss
# Command to set Wakeup Time: sudo /home/mythtv/bin/SetAlarm $time
# Server halt command: sudo /usr/bin/mythshutdown --shutdown
# Pre Shutdown check-command: sudo /home/mythtv/bin/ShutdownCheck_MBE
mythwelcome -s
# In Mythwelcome setup (# mythwelcome -s will get you there):
# Command to set Wakeup Time: sudo /home/mythtv/bin/SetAlarm $time
# Wakeup time format: yyyy-MM-dd hh:mm:ss
# nvram-wakeup Restart Command: <empty>
# Command to reboot: leave default
# Command to shutdown: sudo /home/mythtv/bin/Shutdown_MBE
Finally I have found that some keys on my remote were not active hence I created the directory hauppauge-HVR-1300 in /usr/MythVantage/templates/remotes/ with thees tho files:
--- lircd-hvr-1300.conf ----
begin remote
name Hauppauge_350
bits 13
flags RC5|CONST_LENGTH
eps 30
aeps 100
one 969 811
zero 969 811
plead 1097
gap 114605
toggle_bit 2
begin codes
Go 0x00000000000017BB
Power 0x00000000000017BD
TV 0x000000000000179C
Videos 0x0000000000001798
Music 0x0000000000001799
Pictures 0x000000000000179A
Guide 0x000000000000179B
Radio 0x000000000000178C
UP 0x0000000000001794
LEFT 0x0000000000001796
RIGHT 0x0000000000001797
DOWN 0x0000000000001795
OK 0x00000000000017A5
Back-Exit 0x000000000000179F
Menu 0x000000000000178D
Volume-UP 0x0000000000001790
Volume-DOWN 0x0000000000001791
Prev-Channel 0x0000000000001792
Mute 0x000000000000178F
Channel-UP 0x00000000000017A0
Channel-Down 0x00000000000017A1
Record 0x00000000000017B7
Stop 0x00000000000017B6
Rewind 0x00000000000017B2
Play 0x00000000000017B5
Forward 0x00000000000017B4
Previous 0x00000000000017A4
Pause 0x00000000000017B0
Next 0x000000000000179E
1 0x0000000000001781
2 0x0000000000001782
3 0x0000000000001783
4 0x0000000000001784
5 0x0000000000001785
6 0x0000000000001786
7 0x0000000000001787
8 0x0000000000001788
9 0x0000000000001789
star 0x000000000000178A
0 0x0000000000001780
hash 0x000000000000178E
red 0x000000000000178B
green 0x00000000000017AE
yellow 0x00000000000017B8
blue 0x00000000000017A9
end codes
end remote
--------- end -----------------
and
-------- lircrc-hvr-1300.txt -----
# MythTV LIRC config file for the Hauppauge HVR-1300 remote
# Sticker on the inside of battery compartment
# A415-HPG-WE
# 1004 032400
#
# /home/mythtv/.mythtv/lircrc
#
#
### RESET THE MYTH BOX or REBOOT IT
# 1 click is reset front end, 2 clicks is reboot
#
begin
prog = irexec
button = Power
config = /home/mythtv/scripts/mypower.sh &
end
#
### MYTHTV SETTINGS FOR IT'S CONTROL
#
# Program Guide
begin
remote = Hauppauge_350
prog = mythtv
button = Guide
config = F2
end
#
# TV Recording Playback
begin
remote = Hauppauge_350
prog = mythtv
button = Videos
config = F3
end
#
# Live TV
begin
remote = Hauppauge_350
prog = mythtv
button = TV
config = F4
end
#
# MythWeather
begin
remote = Hauppauge_350
prog = mythtv
button = Go
config = F7
end
#
# MythGame
begin
remote = Hauppauge_350
prog = mythtv
button = Green
config = F5
end
#
# MythMusic
begin
remote = Hauppauge_350
prog = mythtv
button = Music
config = F6
end
#
# Previous Channel
begin
remote = Hauppauge_350
prog = mythtv
button = Prev-Channel
config = H
end
#
# Channel Up
begin
remote = Hauppauge_350
prog = mythtv
button = Channel-UP
repeat = 3
config = Up
end
# Channel Down
begin
prog = mythtv
button = Channel-Down
repeat = 3
config = Down
end
# OK/Select
begin
prog = mythtv
button = OK
config = Space
end
# Play
begin
prog = mythtv
button = Play
config = Return
end
# Stop
begin
prog = mythtv
button = Stop
config = Esc
end
# Escape/Exit/Back
begin
prog = mythtv
button = Back-Exit
config = Esc
end
# Power Off/Exit
# begin
# prog = mythtv
# button = Power
# config = Esc
# end
# Red means stop!
#begin
#prog = mythtv
#button = red
#config = Esc
#end
# Pause
begin
prog = mythtv
button = Pause
repeat = 3
config = P
end
# Mute
begin
prog = mythtv
button = Mute
repeat = 3
config = F9
end
begin
prog = mythtv
button = UP
repeat = 3
config = Up
end
begin
prog = mythtv
button = RIGHT
repeat = 3
config = Right
end
begin
prog = mythtv
button = DOWN
repeat = 3
config = Down
end
begin
prog = mythtv
button = LEFT
repeat = 3
config = Left
end
# Fast forward (while viewing)
begin
prog = mythtv
button = Forward
repeat = 3
config = >
end
# Rewind (while viewing)
begin
prog = mythtv
button = Rewind
repeat = 3
config = <
end
# Skip forward (10 min default)
begin
prog = mythtv
button = Next
repeat = 3
config = PgDown
end
# Skip backward (10 min default)
begin
prog = mythtv
button = Previous
repeat = 3
config = PgUp
end
# Record
begin
prog = mythtv
button = Record
repeat = 3
config = R
end
# Delete
begin
prog = mythtv
button = red
repeat = 3
config = D
end
# OSD browse
begin
prog = mythtv
button = Menu
repeat = 3
config = O
end
# Display EPG while in live TV,
# View selected show while in EPG
begin
prog = mythtv
button = Guide
repeat = 3
config = M
end
# Volume-Up
begin
prog = mythtv
button = Volume-UP
repeat = 3
config = ]
end
# Volume-Down
begin
prog = mythtv
button = Volume-DOWN
repeat = 3
config = [
end
# Bring up OSD info
begin
prog = mythtv
button = Go
repeat = 3
config = I
end
# Change display aspect ratio
#begin
#prog = mythtv
#button = FULL
#repeat = 3
#config = W
#end
# Seek to previous commercial cut point
begin
prog = mythtv
button = yellow
repeat = 3
config = Q
end
# Seek to next commercial cut point
begin
prog = mythtv
button = blue
repeat = 3
config = Z
end
# Numbers 0-9
begin
prog = mythtv
button = 0
repeat = 3
config = 0
end
begin
prog = mythtv
button = 1
repeat = 3
config = 1
end
begin
prog = mythtv
button = 2
repeat = 3
config = 2
end
begin
prog = mythtv
button = 3
repeat = 3
config = 3
end
begin
prog = mythtv
button = 4
repeat = 3
config = 4
end
begin
prog = mythtv
button = 5
repeat = 3
config = 5
end
begin
prog = mythtv
button = 6
repeat = 3
config = 6
end
begin
prog = mythtv
button = 7
repeat = 3
config = 7
end
begin
prog = mythtv
button = 8
repeat = 3
config = 8
end
begin
prog = mythtv
button = 9
repeat = 3
config = 9
end
#
### MPlayer lirc setup
#
# Show OSD
begin
prog = mplayer
button = Menu
repeat = 3
config = osd
end
# Pause playback
begin
prog = mplayer
button = Pause
repeat = 3
config = pause
end
# Skip ahead a minute if playing
# If paused, resume playing
begin
prog = mplayer
button = Play
repeat = 3
config = seek +1
end
# Stop playback and exit
begin
prog = mplayer
button = Stop
repeat = 3
config = quit
end
# Mute
begin
prog = mplayer
button = Mute
repeat = 3
config = mute
end
# Seek back 10 seconds
begin
prog = mplayer
button = Rewind
repeat = 3
config = seek -10
end
# Seek forward 30 seconds
begin
prog = mplayer
button = Forward
repeat = 3
config = seek +30
end
# Quit
begin
prog = mplayer
button = Back-Exit
repeat = 3
config = quit
end
# Seek forward 10 minutes
begin
prog = mplayer
button = Next
repeat = 3
config = seek +600
end
# Seek backward 10 minutes
begin
prog = mplayer
button = Previous
repeat = 3
config = seek -600
end
# Toggle full-screen
#begin
#prog = mplayer
#button = FULL
#repeat = 3
#config = vo_fullscreen
#end
#
#
### XINE CONFIGURATION
#
##
# xine key bindings.
# Automatically generated by xine-ui version 0.99.2.
##
# start playback
begin
button = Play
prog = xine
repeat = 3
config = Play
end
# playback pause toggle
begin
button = Pause
prog = xine
repeat = 3
config = Pause
end
# stop playback
begin
button = Stop
prog = xine
repeat = 3
config = Stop
end
# take a snapshot
begin
button = Record
prog = xine
repeat = 3
config = Snapshot
end
# eject the current medium
begin
remote = xxxxx
button = xxxxx
prog = xine
repeat = 3
config = Eject
end
# set position to -60 seconds in current stream
begin
button = Previous
prog = xine
repeat = 3
config = SeekRelative-60
end
# set position to +60 seconds in current stream
begin
button = Next
prog = xine
repeat = 3
config = SeekRelative+60
end
# set position to -30 seconds in current stream
begin
button = Rewind
prog = xine
repeat = 3
config = SeekRelative-30
end
# set position to +30 seconds in current stream
begin
button = Forward
prog = xine
repeat = 3
config = SeekRelative+30
end
# set position to +7 and -7 seconds in current stream
begin
button = 1
prog = xine
repeat = 3
config = SeekRelative-7
end
begin
button = 2
prog = xine
repeat = 3
config = SeekRelative+7
end
begin
button = 4
prog = xine
repeat = 3
config = SetPosition40%
end
begin
button = 5
prog = xine
repeat = 3
config = SetPosition70%
end
begin
button = UP
prog = xine
repeat = 3
config = SpeedFaster
end
begin
button = DOWN
prog = xine
repeat = 3
config = SpeedSlower
end
begin
button = OK
prog = xine
repeat = 3
config = SpeedReset
end
# increment audio volume
begin
button = Volume-UP
prog = xine
repeat = 3
config = Volume+
end
# decrement audio volume
begin
button = Volume-DOWN
prog = xine
repeat = 3
config = Volume-
end
# audio muting toggle
begin
button = Mute
prog = xine
repeat = 3
config = Mute
end
# set video output window to 100%
begin
remote = xxxxx
button = xxxxx
prog = xine
repeat = 3
config = Window100
end
# set video output window to 200%
begin
remote = xxxxx
button = xxxxx
prog = xine
repeat = 3
config = Window200
end
# zoom in
begin
remote = xxxxx
button = xxxxx
prog = xine
repeat = 3
config = ZoomIn
end
# zoom out
begin
remote = xxxxx
button = xxxxx
prog = xine
repeat = 3
config = ZoomOut
end
# fullscreen toggle
begin
remote = xxxxx
button = xxxxx
prog = xine
repeat = 3
config = ToggleFullscreen
end
# Xinerama fullscreen toggle
begin
remote = xxxxx
button = xxxxx
prog = xine
repeat = 3
config = ToggleXineramaFullscr
end
# jump to Title Menu
begin
button = Go
prog = xine
repeat = 3
config = TitleMenu
end
# jump to Root Menu
begin
remote = xxxxx
button = xxxxx
prog = xine
repeat = 3
config = RootMenu
end
# menu navigate up
begin
button = xxxx
prog = xine
repeat = 3
config = EventUp
end
# menu navigate down
begin
button = xxxx
prog = xine
repeat = 3
config = EventDown
end
# menu navigate left
begin
button = LEFT
prog = xine
repeat = 3
config = EventLeft
end
# menu navigate right
begin
button = RIGHT
prog = xine
repeat = 3
config = EventRight
end
# visibility toggle of stream info window
begin
button = Guide
prog = xine
repeat = 3
config = StreamInfosShow
end
# display stream information using OSD
begin
button = Menu
prog = xine
repeat = 3
config = OSDStreamInfos
end
# increase brightness by 10
begin
button = Channel-UP
prog = xine
repeat = 3
config = BrightnessControl+
end
# decrease brightness by 10
begin
button = Channel-Down
prog = xine
repeat = 3
config = BrightnessControl-
end
# quit the program
begin
button = Back-Exit
prog = xine
repeat = 3
config = Quit
end
##
# End of xine key bindings.
##
--------- end -----------------
Then I selected the new HVR-1300 remote from LinHes config Remote menu
That's all
Enjoy