FireWire

From MythTV Official Wiki
Revision as of 22:47, 27 June 2006 by Zwhite (talk | contribs) (Troubleshooting: fixing the wrong word (again, proofread before you submit))

Jump to: navigation, search


FireWire (also known as i.Link or IEEE 1394) is a personal computer and digital video serial bus interface standard offering high-speed communications and isochronous real-time data services. FireWire can be considered a successor technology to the obsolescent SCSI Parallel Interface. Up to 63 devices can be daisy-chained to one FireWire port.

FireWire works very well in connecting a MythTV backend to certain cable boxes (including the Motorola DCT-6200). MythTV 0.18 and up contains built-in support for changing channels on the DCT-6200 (generally reliable, although occasionally digits get dropped, however I have not noticed this with 0.19). Here is how to get a fully working firewire setup going either with a single set top box, or several boxes by daisy chaining.

Dependencies

  • '--enable-firewire' when building mythbackend.
  • libraw1394
  • libavc1394
  • libiec61883

Needed kernel modules

> mythbox:~# lsmod|grep 1394
> dv1394                 20728  0
> raw1394                25120  2
> eth1394                19856  0
> ohci1394               32716  1 dv1394
> ieee1394              353144  4 dv1394,raw1394,eth1394,ohci1394

Usually to have modules load automatically the file resides in /etc/modules/autoload.d/kernel-2.6 or similar. This is distribution dependent.

Plugreport

> Host Adapter 0
> ==============
> Node 2 GUID 0x000e5cfffed720aa
> ------------------------------
> oMPR n_plugs=1, data_rate=2, bcast_channel=63
> oPCR[0] online=1, bcast_connection=0, n_p2p_connections=0
>       channel=63, data_rate=2, overhead_id=0, payload=376
> iMPR n_plugs=0, data_rate=2

Node and adapter should be apparent.

Plugctl

To explain what the switch's do for plugctl, -n will allow you to specify your node and -p will allow you to specify your host adapter. If you are using host adapter 0 then there is no need to use the -p switch. Gaining information to use with plugctl is done by using plugreport.

For the most reliable firewire operation, use Point2Point/p2p. By default your n_p2p_connections will be set to '0'. This mode presented unreliable operation with dct6200's for recording and watching. Set p2p to 1.

Single STB setup

> plugctl -n 1 oPCR[0].n_p2p_connections=1

This will allow setting it so you maintain a stable connection by setting the Point2Point "Active".

Daisy chain setup

If you intend to use multiple STBs, daisy chain the firewire connections. To daisy chain the dct6200 just plug the firewire cable into the back of one port and into the computer then the second free firewire port plug from one set top box to the other. Make sure each device is assigned to a unique channel

> plugctl -n 1 oPCR[0].channel=0
> plugctl -n 1 oPCR[0].n_p2p_connections=1
> plugctl -n 2 oPCR[0].channel=1
> plugctl -n 2 oPCR[0].n_p2p_connections=1

It is important to set the unique channel first, followed by the p2p. Missing this step will cause it to be non functional.

Broadcast setup

  • Note: Only advised if all else fails attempt the bcast method, this is not reccommended for daisy chain as it is very unreliable.
> plugctl -n 1 oPCR[0].channel=63  
> plugctl -n 1 oPCR[0].bcast_connection=1  

The ideal place to add the plugctl settings for any of the above methods would be to the mythbackend start up script.

Test-mpeg2

This tool is very simple to use and at first glance is never a good idea to assume things are working. As said above with plugctl you can have your n_p2p_connections=0 set and it may work the first 3-5 trys but then it will start to fail. It would be a good idea to test it at least 10 times. I tested it myself 50 times total to verify it was reliable.

  • If it is needed to use test-mpeg2, invoke the command I find it makes it easier to use it with .mpg vs .ts
> test-mpeg2 -r 1 > test.mpg

Raw1394 udev

I ran into permissions issues with raw1394 and adding read permissions was just not enough. I had to specify that /dev/raw1394 be owned by mythtv:mythtv. To do this I did a custom udev rule.

  • Open a terminal and do the following
> nano /etc/udev/rules.d/10-raw.rules
  • Then enter the following information into the file being creating.
> KERNEL="raw[0-9]*",     NAME="%k", GROUP="mythtv", MODE="0666" OWNER="mythtv"


Adding To MythTV

Run mythtv-setup. Select "Capture Cards". Select (New Capture Card) from the list. The type should be "Firewire".

For the settings you want to tell it to use the port you're plugged into. (For me this always seems to be port 0, has anyone ever had to use a port that wasn't 0? --zwhite) The node should be the node you got from plugreport. This is also the same as what you pass to the -n argument for plugctl and -r for test-mpeg2. For most people you'll want to use a p2p connection. If you can't get p2p working select broadcast.

The default speed of 100mpbs should be fine, but some combinations of boxes and firewire cards need 400mbps. For example, my 6200 with a Agere Systems FW323 card requires that 400mbps be used for the highest reliability.

Once you have setup your capture card, be sure to pair it with a Video Source under the Input Connections menu.

Troubleshooting

If tuning a 5C=0 station and MythTV is not consistent in grabbing the mpeg stream try shutting down the computer and unplugging the cable box power and disconnect the firewire cable from one end. Once both are powered down turn them all back on and reconnect the firewire cable. This should reset/clear any firewire plug settings and allow MythTV to properly set them.

  • Note: The above can be caused by not setting to bcast or p2p before tuning as stated above.

Finally, there is a bug in the linux kernel that causes some firewire chips/doitdonsetups (?) to overflow their buffer and cause excessively high CPU usage. There was a bug in MythTV itself but I believe it has been patched(?). The bug though will cause dropped data in the mpeg stream resulting in many errors during playback.

If you encounter stream errors playing back LiveTV from the firewire while testing, ensure you haven't reniced mythfrontend below 0. When I use nice -n -2 mythfrontend, I cannot properly playback from my firewire capture card. --mmead 18:26, 27 April 2006 (UTC)

For information relating to 5C check source here [1]

It seems that some firewire cards are not 100% reliable in mythtv, even when they are reliable using test-mpeg2. If test-mpeg2 works but you can't watch LiveTV, try the following.

With mythbackend running, try test-mpeg2 and see if you get data. With my copy of libiec61883 (1.0.0) you must redirect test-mpeg2 to a file. Let it run 10-30 seconds and ^C the program. ls -l the file and see if there's any data there. If there is no data, unplug your firewire cable and plug it in again. Try test-mpeg2 a couple times to see if you get data now. If not, unplug your firewire cable, remove power from your cable box, plug your cable box back in and give it enough time to start up again, and plug in your firewire cable. Run plugreport to ensure your node hasn't changed. Run test-mpeg2 and see if you get data. If you still don't get data go over your kernel setup again and make sure everything is setup properly and you have the proper permissions.

If you get data from test-mpeg2 but can't watch LiveTV, you may be giving up too soon. Sometimes I have to select LiveTV three or four times before it actually works for me.

If you have the problem I do where firewire isn't reliable, it looks like you need to use a different firewire card.

(Has anyone compile a list of firewire cards that are known to be reliable in mythtv? --zwhite 2006 Jun 27, 20:39 UTC)