[mythtv] Adding support for R5000 STB

Alan Nisota alannisota at gmail.com
Sat Feb 23 00:55:00 UTC 2008


1st off, sorry for not threading this properly.  I had some mailbox 
issues and wasn't able to reply to previous posts.

Anyhow, I have uploaded a patch to Trac, but it isn't ready for anything 
other than further testing:
http://svn.mythtv.org/trac/ticket/4752

Note that the ticket includes:
1) a patch for the kernel ehci module.  This is required for all 
versions of Linux to date.
2) the firmware for the r5000.  The myth patch won't load it, so you 
need to use fxload after plugging in the device before starting myth.
3) the myth patch itself.  Hopefully it'll apply to SVN.

It has only been tested on a ViP211, but may work with other DishNetwork 
STBs with the R5000 mod (if not, it should be easy to fix)

What works:
Recording HD and SD.
Playback of SD
Playback of HD with CoreAVC patch
Channel changing
Power on/off the STB
Detect STB power state.

What doesn't work:
Only 1 R5000 box can be present in the system.  I plan to use the R5k 
serial number to identify which box to use, thus allowing multiple 
R5000s on one system
Any provider other than Dish Network (it's likely that BEV will work too 
though).  Any provider using DVB type streams should be easy to fix.  
DirecTV will require a lot of work, and Cablebox may or may-not require 
a lot of work.
Multi-channel audio may or may not work properly.  For sure it will be 
identified as 'English' regardless of actual language.  See below.

Some info:
The channel changing (and power on/off) is controlled much like an IR 
blaster.  The R5000 is attached to the IR receiver and simulates the 
necessary button presses.  It is more reliable than an IR blaster, but I 
have found it to be pretty sensitive to how fast commands are sent over 
USB. I currently use a 400msec delay between presses which seems 
sufficient to get reliable recordings.

I ended up writing my own PMT by snooping present PIDs.  This works ok 
except that (a) I need some heuristics to detect MPEG4 streams, (b) I 
don't know how many audio streams are present so I may send a partial 
PMT before all audio is found (it waits for at least one audio and one 
video), (c) I have no idea what language the audio is in.  In the 
future, I'll implement a hybrid approach using both a detected PMT and a 
generated one which should resolve this.

The R5000 uses a Cypress Ez-USB FX2 board for communication.  The 
firmware for all R5000 devices appears to be the same, and is loaded at 
cold-boot (via the fxload application).  If someone had the inclination, 
it should be possible to hack the firmware so that the kernel mod isn't 
needed, but I'm not familiar enough with the FX2 to do it myself.  It 
appears to snoop the output of the broadcom decoder, so it should be 
completely independent of any firmware updates the network provider 
sends down.

All of the commands were determined by snooping the USB in Windows.  As 
such, I don't really know that I'm doing thisngs in the most efficient 
or robust manner.  There is no way to use the device via a Windows 
emulator in Linux today.  wine, qemu, VirtualBox. VMWare all will not 
communicate with the device properly (as far as I can tell this is just 
because EHCI isn't implemented properly, though I thought VirtualBox had it)

I am using libusb 0.1.12 which doesn't support asynchronous bulk 
transfers.  Because I needed them, I'm using libusb_augment (which can 
be found here: http://www.gaesi.org/~nmct/cvista/cvista/) with some 
additional changes.  It means that the Myth patch will only work with 
libusb 0.1.xx.  Using the alpha 1.0 code won't work at all.

Note:
The R5000 is NOT supported by the manufcaturer (nextcom wireless) under 
Linux.  I'll try to help as much as I can, but I cannot give any 
gaurantee, and it is a pretty pricey investment  to do with no gaurantee 
it'll even work.



More information about the mythtv-dev mailing list