The things I do to myself.

A bit of background first…. When it comes to media center software,  this isn’t my first rodeo.  I’ve been running Kodi since it was XBox Media Center.   If I search hard enough, I’m sure I can find an XBox laying around here somewhere that still has the software on it.  That being said, I should have known better than to embark on my current quest to run a MythTV backend on a Raspberry Pi B+, on the same network as a OpenElec install on the same network.  First up, I need a TV tuner.   Some research later, but not very good research, I settled on this little guy.   This turned into an epic fail since I live in the US, and the DVB-T adapter, while having many useful features as a Software Defined Radio dongle (SDR), it is completely useless as a TV tuner stateside.  Oh well, it will eventually be turned into a ADS-B receiver to track flights overhead, or maybe grabbing NOAA weather satellite images out of thin air.   At 11$, it’s not too big a mistake, and it has other applications.   

Back to the current quest.   I was looking for a ATSC usb tuner, not DVB-T, this is an important distinction for those of us stateside, as just as we can’t adopt the SI units for measuring, we also have to broadcast our TV on different standards.    The most cost effective one I could find was this guy.  It seems to be well supported with Linux kernel 3.16 or newer, since this ended up being the v3 revision.   OK, so the dongle arrives, and life once again gets in the way.  Although I normally complain about being underemployed, in this case, I was not.   Approximately 2 months after my toy arrived, I was finally able to set it up on an Acer Aspire Revo AR1600 running Mythbuntu.  This install went very smoothly.   OpenElec on a Raspberry Pi B+ was connected perfectly with the Revo running Mythbuntu, and everyone was happy.  For the first time in 3 years, there was live TV in the house.   Of course, good enough rarely is,  and a new Raspberry PI was released, the Raspberry Pi 2.

So now, it was time to acquire a few of these boards.  In the interim, I managed to turn a few friends on to the beauty of the Pi to make a dumb TV smart, that’s a story for another time.    After paying a premium price through Amazon to get the boards without a couple week lead time, because I have to be an early adopter, my Pi2 arrived, and it was time to let the hacking begin.

The Revo, meanwhile, had been re-purposed to a family member who was running on a Pentium 4 box, with Windows Vista.  A quick install of Xubuntu and it worked perfectly for their needs.   Now I have a Raspberry Pi B+ and a pair of Raspberry Pi 2’s.  The Pi 2’s get setup with OpenElec, since the increase in processing power makes for a much better input experience.  The Pi B+, this is where my MythTV install is going.  Planet Gary had an excellent post about getting MythTV running on a PI B, and since the hardware is essentially the same as the B+, it should have been an easy configuration.

Everything was going swimmingly, following along from installing the base operating system, grabbing the repo, setting it locally, and configuring MythTV over a painfully slow ssh session forwarding xwindows.  It was here that the problems started to arise.   The ATSC adapter I received was not recognized as easily as I was lead to believe, necessitating updates to the kernel on the most recent Raspbian distro as well as a manual install of the video 4 Linux utilities (v4l).  This was done first through an ssh session to the Pi B+ and issuing sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade  && sudo apt-get install v4l* -y .  After upgrading, installing v4l and rebooting, MythTV finally loaded and could see and use my dongle.

The next issue came up when I tried to connect to the mySQL database that had been created when the MythTV packages were installed as a dependency.   MythTV was trying to use a username and password that should have been created by MythTV.  Somehow it wasn’t.  So being incredibly naive, I modified the config.xml file to reflect the root username and password for mySQL (yes I’m aware this is a big no-no but it was midnight, and I just wanted things to work).  This also failed.  Now, it’s creeping up on 1 a.m. and it’s still not working.   Login to mysql as root, create a new user and password with a new database like so:   GRANT ALL ON mythconverg.* TO ‘mythtv’@’ipaddressonnetwork’ IDENTIFIED BY ‘mythtv’;

Next change the corresponding lines in config.xml to match the user and database we just created.  Success.    Now we channel scan with the mythtv-setup app through the ssh xwindows forwarding.    Everything on the backend is setup, now the frontend in OpenElec wants to enable all of the PVR clients.  Rebooting doesn’t help, can’t disable any of the unneeded ones, and the PI2 is randomly rebooting due to all the extra addons being enabled and not connecting.

A winning suggestion came from an old xbmc thread.   Rename ~/.kodi/userdata/Database/Addons16.db and reboot the OpenElec machine.  Addons get reinstalled and now can be disabled.

One last problem to overcome, after enabling Live TV in OpenElec, and configuring the MythTV addon to match our IP address, channel list displays in OpenElec but cannot tune.  Back to the mythtv-setup app, and remove the ipv6 address under general.  Everything now works.

The very important lesson from all of this: while there is great satisfaction to be had in hacking together a solution, sometimes the correct answer is buy a TiVo.