Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Dev

Adding support for R5000 STB

 

 

MythTV dev RSS feed   Index | Next | Previous | View Threaded


alannisota at gmail

Feb 21, 2008, 7:02 PM

Post #1 of 6 (2831 views)
Permalink
Adding support for R5000 STB

I recently got access to an R5000 STB for Dish Network. For those who
aren't familiar with it, this is a modification where you send in your
set top box and the R5000 folks add a USB port to the back which allows
you to record the stream from it. This mean that using the R5000, you
can use a legitimate subscription and record HD material from Dish
Network to your PC.

The R5000 folks only support Windows, but I have the box working in
Linux now, and it is almost working with MythTV.

There are a few caveats:
1) a modification to th eUSB kernel modules is needed because the R5k
uses a packet size of 1024 which is not valid according to the USB
spec. The linux-usb folks said they'd likely be willing to take a patch
to support this (in fact one was already posted to the mailing list) and
if it isn't accepted, I'll write one myself.. the R5000 folks said the
next firmware release would allow support of 512byte packets so no
changes would be needed.

Also, for HD, you need my CoreAVC patch since ffmpeg's H264 AVC code
isn't sufficient to decode Dish Network.

Anyhow, with that sorted, the patch for Myth wasn't too complicated (I
wrote some libusb code to read from the device and basically copied the
firewire code in myth and modified it for the r5k).

The problem I have at the moment is that while the STB constantly
monitors the PAT, it only reads the PMT when a channel is changed. I
can sort of fake it by manually changing the channel after starting a
recoding in myth, but Myth seems to need several (at regular intervals?)
PMT packets in order to generate a stream it is happy with.

I'm not really clear on how all the DTV stuff works in Myth, but the
streams I record with Myth can be played in mplayer, so I assume the
problem is simply that the recorder/playback code doesn't know which
PIDs are needed for audio/video

I'm thinking about either caching the last PMT and replaying it every
time I see a PAT, or possibly building it from scratch based on the
currently available PIDs, but I was wondering if there was a better way
or if I'm perhaps missing something here.

Note that my work so far is only for Dish Network. I'm not sure whether
the R5000 works for DirecTV HD, and I know that DirectTV SD usess DSS
rather than DVB (I have some code I worked on over a year ago to convert
DSS to DVB but I never got it all that reliable so it would need some
work, and I don't have access to a DirecTV enabled R5000 box to play with.

Once I can actually watch the recordings I'm making with MythTV, I will
post the relevant patches.

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


danielk at cuymedia

Feb 22, 2008, 6:28 AM

Post #2 of 6 (2732 views)
Permalink
Re: Adding support for R5000 STB [In reply to]

On Thu, 2008-02-21 at 19:02 -0800, Alan Nisota wrote:

> The problem I have at the moment is that while the STB constantly
> monitors the PAT, it only reads the PMT when a channel is changed. I
> can sort of fake it by manually changing the channel after starting a
> recoding in myth, but Myth seems to need several (at regular intervals?)
> PMT packets in order to generate a stream it is happy with.

MythTV only needs a PMT following a PAT update. Are you working with
MythTV svn? You should be able to base your recorder on the Firewire
or HDHomeRun recorders.

> I'm not really clear on how all the DTV stuff works in Myth, but the
> streams I record with Myth can be played in mplayer, so I assume the
> problem is simply that the recorder/playback code doesn't know which
> PIDs are needed for audio/video

MythTV gets the PIDs from the PMT, it does not try to detect them any
other way. If your broadcaster does not produce PMT's at all you can
detect the video and audio streams in the signal monitor and synthesize
PMT's. There are methods for creating PMT's from scratch within
libs/libmythtv/mpeg/mpegtables.h

> I'm thinking about either caching the last PMT and replaying it every
> time I see a PAT, or possibly building it from scratch based on the
> currently available PIDs, but I was wondering if there was a better way
> or if I'm perhaps missing something here.

If there are some PMT's that should allow MythTV to get a signal lock
and record the stream. The frontend likes to see PMT's shortly after
it sees a PAT, so you will want to replay those in the recorder if they
are infrequent in the broadcast stream itself.

-- Daniel

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


alannisota at gmail

Feb 22, 2008, 4:55 PM

Post #3 of 6 (2716 views)
Permalink
Re: Adding support for R5000 STB [In reply to]

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.

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


david at thegeorges

Mar 5, 2008, 8:49 AM

Post #4 of 6 (2621 views)
Permalink
Re: Adding support for R5000 STB [In reply to]

On 02/21/2008 10:02 PM, Alan Nisota wrote:
> Note that my work so far is only for Dish Network. I'm not sure whether
> the R5000 works for DirecTV HD, and I know that DirectTV SD usess DSS
> rather than DVB (I have some code I worked on over a year ago to convert
> DSS to DVB but I never got it all that reliable so it would need some
> work, and I don't have access to a DirecTV enabled R5000 box to play with.
>

I saw your patch updates for DirecTV and wanted to let you know that I
should have a R5000 modified DirecTV receiver soon. Also wanted to let
anyone know before they get too excited the R5000 folks have already
looked into the DirecTV MPEG4 receivers and said they cannot be
supported. I am hoping that maybe someday there will be a DirecTV MPEG4
receiver that can be supported, but it is a small hope. Just in case
you are wondering all the new HD channels that DirecTV has enabled the
last few months are MPEG4 only. There are a few MPEG2 HD channels, like
ABC,NBC,CBS,FOX from NYC and LA, ESPN, ESPN2, TNT and a couple of other
older HD channels.

--
David

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


myth at dermanouelian

Mar 5, 2008, 8:55 AM

Post #5 of 6 (2655 views)
Permalink
Re: Adding support for R5000 STB [In reply to]

On Mar 5, 2008, at 8:49 AM, David George wrote:

> On 02/21/2008 10:02 PM, Alan Nisota wrote:
>> Note that my work so far is only for Dish Network. I'm not sure
>> whether
>> the R5000 works for DirecTV HD, and I know that DirectTV SD usess DSS
>> rather than DVB (I have some code I worked on over a year ago to
>> convert
>> DSS to DVB but I never got it all that reliable so it would need some
>> work, and I don't have access to a DirecTV enabled R5000 box to
>> play with.
>>
>
> I saw your patch updates for DirecTV and wanted to let you know that I
> should have a R5000 modified DirecTV receiver soon. Also wanted to
> let
> anyone know before they get too excited the R5000 folks have already
> looked into the DirecTV MPEG4 receivers and said they cannot be
> supported. I am hoping that maybe someday there will be a DirecTV
> MPEG4
> receiver that can be supported, but it is a small hope. Just in case
> you are wondering all the new HD channels that DirecTV has enabled the
> last few months are MPEG4 only. There are a few MPEG2 HD channels,
> like
> ABC,NBC,CBS,FOX from NYC and LA, ESPN, ESPN2, TNT and a couple of
> other
> older HD channels.

Thanks for the clarification on that. I was debating whether or not to
get an R5000 modded box after seeing that code checked in or still
wait for the Hauppauge PVR-HD or similar device.

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


alannisota at gmail

Mar 5, 2008, 9:12 AM

Post #6 of 6 (2631 views)
Permalink
Re: Adding support for R5000 STB [In reply to]

David George wrote:
> I saw your patch updates for DirecTV and wanted to let you know that I
> should have a R5000 modified DirecTV receiver soon. Also wanted to let
> anyone know before they get too excited the R5000 folks have already
> looked into the DirecTV MPEG4 receivers and said they cannot be
> supported. I am hoping that maybe someday there will be a DirecTV MPEG4
> receiver that can be supported, but it is a small hope. Just in case
> you are wondering all the new HD channels that DirecTV has enabled the
> last few months are MPEG4 only. There are a few MPEG2 HD channels, like
> ABC,NBC,CBS,FOX from NYC and LA, ESPN, ESPN2, TNT and a couple of other
> older HD channels.
>
>
Yeah, while the Dish Network boxes should be able to record all HD for
the foreseeable future, the DirecTV solution is pretty much end-of-life
for HD. Also, I have recently added support for Starchoice and the HDD
external decoders (supports 4DTV, some C-band, and some cable boxes), so
my patch should support the majority of R5K capable boxes now.

Please be aware that the code I have has been tested with DirecTV
streams, but the only box I have available is for Dish Network so the
code for all other types of boxes is only very lightly tested. I will
help as much as I can to get it working for you, but I can't make any
guarantees.

The biggest issue is likely to be channel-changing, turning the box
on/off, and starting-stopping streams. Hopefully these issues won't be
too hard to resolve if they exist.

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

MythTV dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.