HTPC

I used this covid-19 quarantine to reinstall from scretch my HTPC base on Mythtv. I made the very first installation in 2008 and since than I watch TV only using Mythtv. Why? Because of it’s recording feature and the sound/image quality mainly in upscaling from low quality to full-hd and Nvidia card de-interlacing features.

Since than I added two DVBS2 cards, one for Astra and one for Hotbird and upgraded the DVBT cars to a dual DVBT2 card. Lately the boot time  raised a lot and I also wanted to upgrade to the new version of steam and plenty of other features. So this a small guide to build what from my point of view is one of the best media centre available today if  compared with smart TV including Android ones. Why?

  • You can install as many tuners as you wish, ie: one for recording, one for watching live tv, satellite, cable,…
  • You can choose the remote control you wish, I choose one with gyroscope pointer, rechargeable, illuminated keys  and full keyboard on the back, costs about €20
  • You can add touch capability to your old tv by adding a IR touch frame, I bought on that costs around 50€ on aliexpress for my 37” tv
  • You can use any gamepad for gaming you wish, also the once without cable, my choice was for two xbox controller

With this hardware the base installation was pretty simple, just Ubuntu minimal out of the box with proprietary “Nvidia” drivers and than this list of packages:

  • Mythtv: with all plugins to watch TV and have some multimedia features
  • Mysql: As database back-end for mythtv
  • Steam: for gaming
  • Chorme or Firefox: As a browser for Netflix, Prime, RaiPlay, MediasetPlay,….
  • Skype and Zoom: For conferencing with the family during Covid-1

Mythtv

After the installation I only had to recover the backup of the previous database, just because I didn’t want to reprogram everything. I also had to configure the DVB cards, this was somehow more tricky because the used all the same tuners and ad each boot the card numbers got mixed up. To avoid this I needed a hook in udev to intercept the driver installation and create unique links to the right devices. This is the script

Other software

With Steam everything works fine out of the box, using Vulcan even for non tested vulcan applications allowed me to install lot of games. Controller get identified correctly, no particular action to be taken. Skype, Chrome a Firefox just need a user to be configured and nothing else

Configurations

The main part has been done, now some configuration tunig that make the system much more usable and ‘smart TV’ like.

Poweron / poweroff

First is the power button doesn’t turn off the Media Center instead I just want to turn off the monitor. This allows an instant on/off. Ubuntu manges the power button through the Display Manager and in this setting you cannot run a custom command. So my choice was to intercept the ‘Power button’ via ACPI and add hoot that turns off/on the monitor or TV. The hook is pretty simple, just add this script in the /etc/… folder

When I power on I also want some tool to auto-start, so I added Mythvt, Steam, Skype, Firefox in kiosk mode

Remote control

Finally ome extr

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password

usermod -a -G mythtv htpc

usermod -a -G mythtv dialout

Linux suspend issues

It’s been quite a lot of time that mi HTPC remained turned on, when I tried to suspend the system I had plenty of issues.

First issue is that dvb didn’t resume correctly generating a lot of “m88ds3103 0-0069: i2c wr failed=-6″ errors.” after resume and DVB not working at all. For a HTPC it’s a big issue since the main purpose of the HTPC is view dvb content. It seemed I just needed to remove the m88ds3103 module and insert it again after suspend. Sadly the module showed three usages

htpc@htpc:~$ lsmod |grep m88
m88ds3103 32768 3 cx23885

Removing the cx23885 module still show 2 usages without any clear indication of what is going on:

htpc@htpc:~$ lsmod |grep m88
m88ds3103 32768 2

No way to remove the module. After various tentative I identified the module that kept m88ds3103 busy, it’s the smipcie module, so to remove the m88ds3103 module I first need to remove the smipcie module. From my point of view this should be considered a defect either in the lsmod or in the module itself, since no dependency module is identified.

the second issue is related to the HTPC waking up just after suspending. Again after some researches I found the the HTPC wakes up on any kind on USB UHC event, this means constantly. I found no way to disable this as configuration. So I created my own hook for the suspend, it just disables wake up on USB/UHC before going to sleep executing echo “UHC1” > /proc/acpi/wakeup for all the peripherals.

With this two patches the suspend works smoothly, it just take a while to stop mythtv-backend, but otherwise no issues.

The script is named /usr/lib/pm-utils/sleed.d/50htpc to be put in the folder /usr/lib/pm-utils/sleed.d/

This is the code:

. "${PM_FUNCTIONS}"
suspend_htpc()
{
    service mythtv-status stop
    service mythtv-backend stop
    rmmod cx23885
    rmmod smipcie
    rmmod m88ds3103
     devices="UHC1 UHC2 USB3 UHC4 USB5 UHC6 UHC7"
    for device in ${devices}; do
            if grep -qw ^$device.*enabled /proc/acpi/wakeup; then
                    sudo sh -c "echo $device > /proc/acpi/wakeup"
            fi
    done
}
resume_htpc()
{
   modprobe m88ds3103
   modprobe smipcie
   modprobe cx23885
   service mythtv-backend start
   service mythtv-status start
}
case "$1" in
 hibernate|suspend)
 suspend_htpc
 ;;
 thaw|resume)
 resume_htpc
 ;;
 *) exit $NA
 ;;
 esac
WP to LinkedIn Auto Publish Powered By : XYZScripts.com