MythTV is UP AND RUNNING! Changing Channels via Serial Cable

June 26th, 2008 Tanstaafl

mythtv

It is official - I am a MythTV user.  Well…let’s ammend that:  I am in the possession of a fully installed and functional MythTV backend server.  There were two things wrong with the Channel Changer program:

  1. I didn’t know that the current directory is not in your path.  SO–just because you are in the same directory as a binary file, it can still be “unfound.”  When I typed in /usr/local/bin/channel to define the path explicitly it worked–I should have tried that.  I probably would have, but I was pressed for time that day.
  2. Once I could get the channel binary to work, then I faced a different issue.  By using the -p switch on the channel changer program, the individual serial ports can be specified.  Here’s what I got:
    • /dev/ttyS0 - Input / Output Error
    • /dev/ttyS1 - No communciation
    • /dev/ttyS2 - Input / Output Error
    • /dev/ttyS3 - Input / Output Error

Great.  What now?  I found several postings on the web talking about the dialout group–but I checked and my user account was already in that group.  I was pretty sure that the serial cable to the Motorola box was hooked up to COM1 (/dev/ttyS0) so I thought I better do some more investigation.  I found this tidbit:

http://www.linuxquestions.org/questions/linux-hardware-18/cat-devttys0-inputoutput-error-397212/

Which instructed me more perfectly in the way of the SETSERIAL command.  I ran SETSERIAL -a for each port and got the following info:

/dev/ttyS0, Line 0, UART: , Port: 0x03f8, IRQ: 4
Baud_base: 115200, close_delay: 500, divisor: 0
closing_wait: 30000
Flags: spd_normal

/dev/ttyS1, Line 0, UART: 16550A, Port: 0x02f8, IRQ: 3
Baud_base: 115200, close_delay: 500, divisor: 0
closing_wait: 30000
Flags: spd_normal

/dev/ttyS2, Line 0, UART: , Port: 0x03e8, IRQ: 4
Baud_base: 115200, close_delay: 500, divisor: 0
closing_wait: 30000
Flags: spd_normal

/dev/ttyS3, Line 0, UART: , Port: 0x03e8, IRQ: 3
Baud_base: 115200, close_delay: 500, divisor: 0
closing_wait: 30000
Flags: spd_normal

Wow.  Do you see what I saw?  Three out of four of my serial ports aren’t detecting the UART.  I can understand COM3 and COM4 not being there–they were not setup in the computer’s BIOS, but COM1 and COM2 should be fine.

A quick shutdown and boot to CMOS configuration proved my memory to be correct–but obviously there was something wrong.  This motherboard only had one physical serial port (the other one can be added with via a pin header) which I assumed to be set to COM1.  So, I reset it to COM2 (2F8 / IRQ3) and disabled all the rest.

And presto, it works.  I added that line into MythTV and away we go.

Playback on the computer monitor is a bit jerky, but I don’t think that it will be a problem.  This is an underpowered machine, after all, that is only supposed to be the backend.  Dividing the workload up as planned and letting the frontend machine do the playback should fix any jerkiness in the video.

The tactical plan for this box is to get a 150GB or larger hard drive in this box as soon as possible.  While I’m doing that, I might as well get a 1GB stick of RAM as there’s only 256MB in it right now.  (I thought there was more.)  Ideally, if this is all working pretty well over the next month or two I’ll buy a second PVR card, split the cable, and be able to record basic cable as well as the digital.  This will essentially duplicate the TiVo we used to have–one basic line and one digital line.

Long-term strategy will be to add a third PVR card and move one of the other cable boxes down to the backend server, fix whatever is wrong with COM1, and be able to do 3 recordings at once (or 2 recordings and one live TV).  As long as they are MPEG hardware-based encoders, this shouldn’t tax the system too much.

Oh, and I’ve still got to pay SchedulesDirect my $20.00 for this year…

Anyway, time to move on to the Xbox MythTV Frontend.  But first, I think I have one more MythTV article in me–I found two or three really nifty applications for Myth that I wasn’t expecting.  One is a Windows player for Myth that can watch recordings and livetv (no scheduling, but that’s what MythTV has a webpage for).  The other main one is a MythTV to iPod appliation that can synch your TV shows up like video podcasts.  I’ll test them out and post the results.

See you, Space Cowboy.

Popularity: 24% [?]

MythTV Makes Me Cry - Motorola DCT2xxx Serial Port

June 25th, 2008 Tanstaafl

It shouldn’t be this hard.  Unlike peeling an onion, I feel more like I’m slicing a bushel of them.  <sniff>  Ok, I’m better now.  I was just feeling a little fragile there for a moment…

onion

Allow me to make with the status.

First, the Cable box is connected back up, along with a serial cable to COM1.  Inside MythTV Backend Setup, I set the input pretune to channel 4 (which is what the cable box requires).  Going just that far, I can start the Myth frontend and watch Live TV, but I have to change the channel manually by pushing the buttons on the front of the cable box.

Ok.

So, obviously I need something to send a signal out COM1 and into the Motorola serial port that tells it to change the channel.  Doesn’t sound too hard, right?  Sure didn’t to me–however, it is seriously hard to track down information on this subject.

I finally found this link:

http://www.mythtv.org/wiki/index.php/Motorola_DCT-25xx

However, it seems to be pretty old information–it certainly didn’t work flawlessly.  Matter of fact, MAKE returned tons of errors and missing files.

So, went back to the well and fished up this little beauty:

https://help.ubuntu.com/community/MythTV_External_Channel_Changer

However, when I try to test the program, the console returns:  COMMAND NOT FOUND.  I don’t know what the deal is…  I’ll get back to you.

Popularity: 22% [?]

MythTV - Storage Groups and Linux Hard Drives

June 24th, 2008 Tanstaafl

Last night completed the second to the last step of my Mythbuntu adventure:  Adding in the second hard drive.

hard drive

Well, this would all be easier if I wasn’t trying to do it so low rent.  Right now in the Myth box there is only 512MB of RAM and two 40GB Western Digital Hard drives.  After everything is setup that only gives me about 65-ish GB for video recording.  Not alot, but not great either–right around 40 hours of recording space.

So, I should get a larger hard drive…

Well, when I do, I’ll have to repeat this same process.  Obviously, first one has to install the hardware and make sure that the BIOS can see it.  If you don’t have this, you don’t have anything.  Now to the Linux part:

  1. Partition - Setup the drive to hold data.  The main drive is probably /dev/sda, making the OS install to be on /dev/sda1 and the swap partition to be on /dev/sda5 (at least on my box).  The second hard drive will probably be /dev/sdb, and so a third physical hard disk will be /dev/sdc, and etc.  I created one big partition on the new drive.
    1. sudo fdisk /dev/sdb
    2. n (new partition)
    3. p (primary partition)
    4. 1 (first primary partition)
    5. <enter> (default first cylinder)
    6. <enter> (default last cylinder)
    7. w (write the new partition table to disk)
  2. Format - Prepare the new partition for data.  Nothing big here, but one small caveat.  Since this is not a the boot drive, theres no need for reserve space.  Usually a format reserves 5% space incase the drive fills up–this helps keep from crashing on full drives.  I set the second drive to 1% reserve.
    1. sudo mkfs -t ext3 /dev/sdb1
    2. sudo tune2fs -m 1 /dev/sdb1
  3. Mounting - Add the new space to the filesystem.  Linux sees everything like one big directory tree–there are no C: and D: drives.  So, to mount this new drive I created a directory called /video on the root and some subdirectories called /video/livetv and /video/media.  And while I was doing it, I made a backup spot for my Myth database.  After the directories are made, I changed the file rights so they could be used by Myth.
    1. sudo mkdir /video
    2. sudo mkdir /video/livetv
    3. sudo mkdir /video/media
    4. sudo mkdir /var/dbbackup
    5. chmod a+wrx /video/livetv
    6. chmod a+wrx /video/media
    7. chmod a+wrx /var/dbbackup
  4. FSTAB - Edit the /etc/fstab so that the drive is mounted on bootup.  I don’t know if you like Vi, but I hate it.  So, I installed GEdit to make my life easier.
    1. sudo apt-get install gedit
    2. gksudo gedit /etc/fstab
    3. <add a line>/dev/sdb1   /video/media  ext3    defaults     0     0
    4. Save and Reboot (or sudo mount -a)
  5. Test - Make sure that the new drive is seen (sudo mount -l)
  6. MythTV Storage Groups.  I wanted to help utilize my space as well as possible.  Inside the MythTV Backend Setup, I set:
    1. LiveTV to /video/livetv/
    2. Default to /video/media/
    3. DBBackup to /var/dbbackup/

My theory is that the Live TV buffering will all happen on the drive with the least amount of space, as well as the dbbackups.  And (hopefully) all of the actual recordings will go to the second hard drive.  We’ll see how it works out.

It has been running Live TV on The Weather Channel for the last sixteen hours and the capture files are all going to the right spot.  One problem is that my demo subscription to Schedules Direct has ran out–I’ll have to pay the twenty dollars before I can go on to the last step–changing channels on the cable box.

moto cable

Bryan said he doesn’t remember if he ever got this working a few years ago.  It is probably easier to do, now, with the new releases.  After I accomplish this last step, I will post a quick recap and include some other extremely cool stuff I found that works with MythTV.  Until then.

See you, Space Cowboy.

Popularity: 21% [?]

Myth Works! All the Weather, All the Time

June 23rd, 2008 Tanstaafl

weather channel logo

I found it.  And was subsequently able to record over 12 Gigs of The Weather Channel!  Yippie!  (That was just the channel I left it on for testing.)

Ok, here’s how it went down:  I finally swallowed my pride and dug through the mythtv-backend.log.  Well, actually, I opened up a terminal, switched to Myth, tried to watch Live TV, and then used “tail /var/log/mythtv/mythtv-backend.log” to see what just happened.  Much easier than “digging.”

Anyway, I got the following junk:

2008-06-20 12:52:10.501 TVRec(2): Changing from None to WatchingLiveTV
2008-06-20 12:52:10.531 TVRec(2): HW Tuner: 2->2
2008-06-20 12:52:10.797 SampleRate: Attempted to add a rate 32000 Hz, which is not in the list of allowed rates.
2008-06-20 12:52:12.846 AutoExpire: CalcParams(): Max required Free Space: 2.0 GB w/freq: 15 min
2008-06-20 12:52:13.248 NVR(/dev/video0): Won't work with the streaming interface, falling back
strange error flushing buffer ...
VIDIOCGMBUF:: Invalid argument
2008-06-20 12:52:53.280 TVRec(2): Changing from WatchingLiveTV to None
2008-06-20 12:52:53.310 Finished recording WGN News at Noon: channel 1004
2008-06-20 12:54:09.771 Expiring 0 MBytes for 1004 @ Fri Jun 20 12:00:00 2008 => WGN News at Noon

The sample rate thing didn’t seem too important as I knew where that setting was in the interface–however, I was strangely drawn to the bit about /dev/video0 (which is the location of my capture card).  So, apparently, it tries to access the card, fails, and drops back to the interface.

All of this time I was starting to form a picture that the Hauppauge PVR-350 was more than a little bit different than the average card.  I’ve seen quite a bit of stuff seeming to indicate why Kaffeine wouldn’t work for me, because the PVR-350 or the IVTV driver may not be Video4Linux (V4L) compatible.  Now, after searching on the above error, I find this thread where the user wilkinnh posted:

the “Unknown video codec” is what caught my attention, and i did a quick search and figured out that mythtv had automatically associated my capture card with the V4L (video4linux i believe…), but it’s actually an MPEG2 card with built-in hardware MPEG2 compression. so, i redid the mythtvsetup (the backend) and made sure when i selected my capture card that i selected it as MPEG2. once i did that and saved it, everything started working!

Suddenly, it was clear what was wrong!  Even though it said PVR-350 on the Capture Card Setup screen, I was still trying to use a V4L card!  I quickly go back in to setup and…but…wait a minute…what?

Where do you change this?  And then I discovered that I was missing some graphical clues that probably would have prevented this from happening in the first place.  The drop-down button was completely missing–making the dialog look like a static field!  I didn’t think that “field” was changeable–so I never even tried!!!

capture card setup

This picture is straight from the installation manual–I circled the part that I don’t have.  It’s not off the edge of the screen or anything.  It just isn’t there.  On my machine, under “Probed Info” it reported finding a PVR-350, leading me to believe that everything was hunky-dory.

Now I don’t feel so stupid.

Edit:  I forgot to mention that this also happened in KnoppixMyth, so there is something up with the Nvidia video card driver or the MythTV setup in general.  I did not try MythDora in this case, but I suspect the same problem would occur there too.

Next step is to get my second hard drive in use for storage groups.  Should be easy enough.  After that, I’ll hook the digital cable box back up and work on changing channels with the serial cable.

See you, Space Cowboy.

Popularity: 13% [?]

MythTV Update - MPlayer works, IRC Support isn’t, and Wireless

June 20th, 2008 Tanstaafl

mytbuntu logo

Just a quick update:  I can watch TV through MPlayer now.  Now that I have all of the IVTV drivers installed correctly, it is a simple matter of opening a terminal and telling MPlayer to access that device:

mplayer /dev/video0

But I still can’t get LiveTV inside Myth.  And when I tell it to record, it starts a .NUV file, but the size never grows (stays around 9K or 12K).  So, in other words, Myth simply isn’t accessing the PVR-350 correctly.

Naturally I tried to get on IRC for some help, but in the mythbuntu channel there were 40 people all idling–no one responded.  In the main mythtv channel a user named “dustybin” responded and was helpful, but had never used a PVR-350 or Mythbuntu.

During time I was working on this, I was also running up and down the stairs trying to get my Wireless DMZ back in operation.  PFSense simply wasn’t cooperating–I couldn’t get the DMZ to see anything else.  Matter of fact, DMZ hosts couldn’t even ping their own gateway (destination host unreachable) even though they were getting DHCP addresses.  That should have told me something was hung up.  I eventually figured out that the BSD network stack had some hung states and rebooted.  Suddenly everything was fine.

I let all of my wireless devices (including the Wii) grab a DHCP lease and then copied their MAC addresses into a notepad.  For the DHCP server on the DMZ interface, I told it not to issue addresses to unknown hosts and added the MAC addresses to the known list.

The firewall ruleset on the DMZ was an any-to-any.  It had been opened up that way for troubleshooting.  So, I changed it to a rule to not allow access to the LAN subnet, or in other words, any-to-!LAN.

This works for now–I may want to crank it down more later by assigning DHCP reservations to devices.  But, maybe not.

Popularity: 12% [?]