Completely HTPC with XBMCbuntu + TVHeadend + Tevii S660 + DVB T + PS3 Remote
Written by vaheeD on June 4, 2014
First Step
Install XBMCbuntu 12 From this LINK
Next Step
OS tweaks …
# Fix SSH keys. All XBMCbuntu installs are shipped with same key.
# Which is bad m’kay?
/bin/rm /etc/ssh/ssh_host_* dpkg-reconfigure openssh-server
# Set root password.
passwd root
# Allow sudo without password.
echo "%adm ALL=(ALL) NOPASSWD: ALL" >/etc/sudoers.d/nopassword chmod 0440 /etc/sudoers.d/nopassword
# Clean files older than two # weeks from /tmp and
# autofix filesystem on boot after crash.
sed -i /etc/default/rcS -e's/^TMPTIME=.*/TMPTIME=14/g' \ -e's/^FSCKFIX=.*/FSCKFIX=yes/g'
# Enable TRIM for rootfs and swap
sed -i.bak /etc/fstab \ -e's/remount-ro/remount-ro,discard,commit=15/g' \ -e's/sw /sw,discard/g'
# Next we make sure existing packages are up-to-date and
# add few packages that aren’t included in stock install.
# Some of these are for making command line use easier
# while some are essential for later steps.
apt-get update apt-get -y dist-upgrade apt-get -y install joe screen lftp smartmontools samba \ locate telnet mtr python-dbus python-gobject traceroute \ aptitude htop vim-nox build-essential subversion cmake \ libusb-1.0-0-dev libpcsclite-dev
# Disable IPv6 support
echo "net.ipv6.conf.all.disable_ipv6=1" >>/etc/sysctl.conf
# Disable bunch of unwanted services started by default
rm -f /etc/rc2.d/S19lirc rm -f /etc/rc2.d/S50rsync rm -f /etc/rc2.d/S70pppd-dns echo manual >/etc/init/console-font.override echo manual >/etc/init/cryptdisks-enable.override echo manual >/etc/init/cryptdisks-udev.override echo manual >/etc/init/tvheadend.override echo manual >/etc/init/setvtrgb.override echo manual >/etc/init/hybrid-gfx.override echo manual >/etc/init/gssd.override echo manual >/etc/init/gssd-mounting.override echo manual >/etc/init/idmapd.override echo manual >/etc/init/idmapd-mounting.override echo manual >/etc/init/mountall-net.override echo manual >/etc/init/portmap.override echo manual >/etc/init/portmap-wait.override echo manual >/etc/init/statd.override echo manual >/etc/init/statd-mounting.override
# Allow wakeup from suspend using USB devices
cat <<'__EOF__' >/etc/rc.local #!/bin/bash # /etc/rc.local # # Enable USB wakeup, part 1 grep -e "USB.*disabled" /proc/acpi/wakeup |\ while read line; do echo $line >/proc/acpi/wakeup done # # Enable USB wakeup, part 2 for i in /sys/bus/usb/devices/*/power/wakeup; do echo "enabled" > $i; done # # Exit with success exit 0 __EOF__
# More USB wakeup changes
cat <<'__EOF__' >/etc/usbwakeup-fixup.sh #!/bin/bash # /etc/usbwakeup-fixup.sh (sleep 3; for i in /sys/bus/usb/devices/*/power/wakeup; do echo "enabled" > $i; done) & __EOF__
# One more USB wakeup related change left
cat <<'__EOF__' >/etc/udev/rules.d/10-usb-wakeup.rules # /etc/udev/rules.d/10-usb-wakeup.rules ACTION=="add", SUBSYSTEM=="usb", IMPORT{program}="/bin/bash -c /etc/usbwake-fixup.sh" __EOF__
# Ha! Fooled you! Still more USB wakeup. Promise this is last.
chmod a+x /etc/rc.local /etc/usbwakeup-fixup.sh
# Reload ath9k wlan drivers after suspend. This is needed as
# otherwise WLAN gets stuck at around 10Mbit/s instead of
# proper 300Mbit/s.
echo 'SUSPEND_MODULES="ath9k ath9k_hw ath9k_common"' >>/etc/pm/config.d/modules
Next Step
Install TVHeadend
If you had previously added the launchpad PPA, please be sure to remove it (as it no longer exists)
sudo apt-add-repository -r http://ppa.launchpad.net/adamsutton/tvheadend sudo apt-get remove tvheadend
Before you can use the repositories you probably want to import the GPG signing key:
curl http://apt.tvheadend.org/repo.gpg.key | sudo apt-key add -
You will then need to add which ever repository you feel is most appropriate, for example if you want to be cautious and have a reliable system:
sudo apt-add-repository http://apt.tvheadend.org/stable sudo apt-get update sudo apt-get install tvheadend
now open http://youripaddress:9981
for enable time shift on tvheadend with xbmc go 1>Configuration 2>Recording 3>Timeshift
then all Checkbox in this page …
Next Step
Install Tevii S660
Download Drive from Tevii Site LINK
Extract Drive and Just copy two file 1>dvb-fe-ds3000.fw 2>dvb-fe-ds3103.fw 3>dvb-usb-s660.fw
wget http://www.tevii.com/Tevii_Product_20140130_media_build_b51.tar.bz2.rar mv Tevii_Product_20140130_media_build_b51.tar.bz2.rar Tevii_Product_20140130_media_build_b51.tar.bz2 tar xjfv Tevii_Product_20140130_media_build_b51.tar.bz2.rar sudo cp -rfv media_build/*.fw /lib/firmware/
now reboot the system and test with command
dmesg | grep -i dvb [ 10.719165] DVB: registering new adapter (Afatech AF9015 DVB-T USB2.0 stick) [ 10.904830] dvb-usb: downloading firmware from file 'dvb-usb-s660.fw' [ 11.036039] dvb-usb: found a 'TeVii S660 USB' in warm state. [ 11.036122] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer. [ 11.036288] DVB: registering new adapter (TeVii S660 USB) [ 11.130885] DVB: registering adapter 0 frontend 0 (Afatech AF9013)... [ 11.154384] dvb-usb: MAC address: 00:18:bd:5c:47:ad [ 11.359287] DVB: registering adapter 1 frontend 0 (Montage Technology DS3000/TS2020)... [ 11.361022] input: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:10.4/usb1/1-4/input/input6 [ 11.361218] dvb-usb: schedule remote query interval to 150 msecs. [ 11.361223] dvb-usb: TeVii S660 USB successfully initialized and connected. [ 11.411357] input: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:10.4/usb1/1-2/rc/rc0/input7 [ 11.411470] rc0: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:10.4/usb1/1-2/rc/rc0 [ 11.411472] dvb-usb: schedule remote query interval to 500 msecs. [ 11.411476] dvb-usb: Afatech AF9015 DVB-T USB2.0 stick successfully initialized and connected. [ 11.418592] usbcore: registered new interface driver dvb_usb_af9015
Next Step
Install PS3 Remote for Controlling XBMC
# For PS3 BD remote we need to force older, patched Bluetooth stack.
# First make really sure no existing bluetooth package exist
apt-get -y purge bluez
# Add new repository and force use of Ubuntu 12.04 packages
# on XBMCbuntu 12 (Ubuntu 12.10)
add-apt-repository -y ppa:kitlaan/ppa sed -i /etc/apt/sources.list.d/kitlaan-ppa-quantal.list -e's/quantal/precise/g' cat <<'__EOF__' >/etc/apt/preferences.d/bluez Package: bluez* Pin: release o=LP-PPA-kitlaan Pin-Priority: 1000 __EOF__
# Install bluetooth stack
apt-get update apt-get -y install bluez
# Pairing PS3 remote on Linux
# Grab required software
mkdir -p /opt/ps3pair cd /opt/ps3pair wget http://dump.asiantuntijakaveri.fi/le_bueno_dumpo/ps3pair.tar.gz
# or
# wget http://kitlaan.twinaxis.com/projects/bluez-ps3remote/ps3pair.tar.gz
tar xvzf ps3pair.tar.gz mv ps3pair/* . rmdir ps3pair
# Start pairing. Press and hold Start+Enter on
# PS3 BD remote for at least 5 seconds to enter pairing mode.
python ps3_pair.py
# You should see something like this:
# Please HOLD the START and ENTER buttons on the PS3 remote.
# Searching for devices, please wait…
# Found:
# 1: 00:06:BF:55:BD:12 [Unknown]
# Select the device you wish to add [1]:
# Registering device… Done
# Linux bluetooth pairing with PS3 remote is broken…
# Pairing does results in proper Linux side configuration, but PS3
# remote side never completes pairing.
#
# To workaround this problem you need to pair same USB bluetooth
# dongle with same PS3 remote on Windows 7. Only then remote is
# properly paired with dongle and also Linux side configuration
# is ok.
# For AR3011 in Windows use driver version 8.0.0.214 from
# http://www.station-drivers.com/page/atheros.htm or from mirror
# http://dump.asiantuntijakaveri.fi/le_bueno_dumpo/atheros_bluetooth_8.0.0.214-w7-8(www.station-drivers.com).exe
#
# Do pairing as with any other bluetooth device on Windows 7 using
# built-in add new device feature. Press and hold Start+Enter on
# PS3 BD remote for at least 5 seconds to enter pairing mode.
# Remove and re-insert batteries on PS3 BD remote to reset it
# after partial pairing attempt with Linux bluetooth stack.
# After pairing is complete both on Linux and Windows side we need
# to create custom input configuration file. This is just one example,
# you probably want different keymap.
# Fix configuration file
cat <<'__EOF__' >/etc/bluetooth/input.conf [General] IdleTimeout=180 # 3 minute timeout, shorten to improve battery life [PS3 Remote Map] OverlayBuiltin = FALSE 0x16 = KEY_ESC # EJECT 0x64 = KEY_A # AUDIO 0x65 = KEY_Z # ANGLE 0x63 = KEY_T # SUBTITLE 0x0f = KEY_O # CLEAR 0x28 = KEY_I # TIME 0x00 = KEY_1 # NUM-1 0x01 = KEY_2 # NUM-2 0x02 = KEY_3 # NUM-3 0x03 = KEY_4 # NUM-4 0x04 = KEY_5 # NUM-5 0x05 = KEY_6 # NUM-6 0x06 = KEY_7 # NUM-7 0x07 = KEY_8 # NUM-8 0x08 = KEY_9 # NUM-9 0x09 = KEY_0 # NUM-0 0x81 = KEY_S # RED 0x82 = KEY_MUTE # GREEN 0x80 = KEY_VOLUMEUP # BLUE 0x83 = KEY_VOLUMEDOWN # YELLOW 0x70 = KEY_I # DISPLAY 0x1a = KEY_M # TOP MENU 0x40 = KEY_M # POP UP/MENU 0x0e = KEY_ESC # RETURN 0x5c = KEY_C # TRIANGLE/OPTIONS 0x5d = KEY_BACKSPACE # CIRCLE/BACK 0x5f = KEY_TAB # SQUARE/VIEW 0x5e = KEY_SPACE # CROSS 0x54 = KEY_UP # UP 0x56 = KEY_DOWN # DOWN 0x57 = KEY_LEFT # LEFT 0x55 = KEY_RIGHT # RIGHT 0x0b = KEY_ENTER # ENTER 0x5a = KEY_VOLUMEUP # L1 0x58 = KEY_VOLUMEDOWN # L2 0x51 = KEY_MUTE # L3 0x5b = KEY_VOLUMEUP # R1 0x59 = KEY_VOLUMEDOWN # R2 0x52 = KEY_MUTE # R3 0x43 = KEY_HOMEPAGE # PS button 0x50 = KEY_ENTER # SELECT 0x53 = KEY_PLAY # START 0x33 = KEY_R # SCAN BACK 0x32 = KEY_PLAY # PLAY 0x34 = KEY_F # SCAN FORWARD 0x30 = KEY_DOWN # PREVIOUS 0x38 = KEY_X # STOP 0x31 = KEY_UP # NEXT 0x60 = KEY_LEFT # SLOW/STEP BACK 0x39 = KEY_PLAY # PAUSE 0x61 = KEY_RIGHT # SLOW/STEP FORWARD __EOF__
# Restart bluetooth service
service bluetooth restart
# Now press some button on PS3 BD remote. Blue led on USB bluetooth
# dongle has been solid blue so far and should start flashing.
# To save battery life we need to disconnect PS3 BD remote on
# shutdown and suspend
mkdir -p /opt/bt-disconnect cd /opt/bt-disconnect wget http://dump.asiantuntijakaveri.fi/le_bueno_dumpo/bt-disconnect-all.py
# or
# wget http://kitlaan.twinaxis.com/projects/bluez-ps3remote/bt-disconnect-all.py
chmod a+x bt-disconnect-all.py
# Disconnect on shutdown
cat <<'__EOF__' >/etc/rc6.d/K99btdisconnect #!/bin/sh date >>/opt/bt-disconnect/log exec /opt/bt-disconnect/bt-disconnect-all.py >>/opt/bt-disconnect/log 2>&1 __EOF__
# exec bit needed as usual
chmod a+x /etc/rc6.d/K99btdisconnect
# Disconnect on suspend
cat <<'__EOF__' >/etc/pm/sleep.d/bt-disconnect.sh #!/bin/bash case $1 in suspend) date >>/opt/bt-disconnect/log /opt/bt-disconnect/bt-disconnect-all.py >>/opt/bt-disconnect/log ;; resume) # do nothing ;; esac __EOF__
# And finally make it executable
chmod a+x /etc/pm/sleep.d/bt-disconnect.sh
# If you managed to follow instructions your PS3 BD remote can now
# control XBMC.