HVR-950q and MythTV

Over the last few nights, I finally got a MythTV box setup that I could use for some testing of the HVR-950q. I did some work a few months ago to basically get the analog support working, but there were some reports of problems related to switching back and forth between analog and digital mode.

After adding some debugging to the driver, I found basically three classes of problems:

1. The power management on the au8522 was setup such that the chip would get completely powered down when switching modes. Essentially what would happen is when switching from analog to digital mode, the v4l stack would tell the au8522 to completely power down while in the middle of bringing up the digital half of the chip. The power management for both the analog and the digital side of the chip need to be changed such that they only power down their respective parts, rather than the entire chip. It’s basically a race condition, which is why it works sometimes but not others.

2. The digital side of the board won’t actually perform the first tuning request when switching from analog mode, because the driver’s internal state thinks it’s already tuned to the target frequency (so the set_frontend call just does a “return 0” without actually doing the tune). We will need to explicitly clear out the driver state associated with the digital side of the chip when powering down or switching over to analog mode. That’s why you don’t get a digital lock when switching from analog to digital mode, but then if you change the channel the next tuning request works.

3. MythTV’s “input group functionality” appears to be generally broken. Input groups are designed to handle cases where there are multiple inputs sharing a tuner, so that they don’t get used at the same time. However I can pretty clearly see that even after switching to analog mode, some thread in the mythtv backend continues to run the digital side of the board, performing tuning requests and polling the digital demodulator’s status.

So in other words, this is going to be more annoying than originally thought. Fixing the couple of driver issues is pretty straightforward, but digging into the MythTV code and figuring out why it’s screwed up is going to take some real effort (and users wouldn’t get the benefit of those changes unless they either build mythtv from source or wait until 0.23 comes out).

At least now I have a better idea as to exactly what is going on.

12 thoughts on “HVR-950q and MythTV

  1. The code that makes the digital tunes in background in mythtv is the eitscanner. It doesn’t seem to be integrated into the input groups concept.
    Try disabling active eitscanning under the recording options in mythtv-setup. “close device when idle” or whatever it is called probably helps to with using the analog side of a hybrid device. ping me on irc.

    Janne

    • Hi Janne,

      Yeah, I completely forgot about the EIT scanner. Let me try that out and see if that is really the issue.

      If so, that would be great as it would just mean I would need to make the driver fixes described above and tell everybody to make sure the EIT scanner is disabled.

      Thanks,

      Devin

  2. Devin,

    Thanks very much for finding the time to look at this!! If, as Janne has suggested, the MythTV portion of the problem can be solved by disabling the EIT scanner option (I believe I already had this one turned off in my setup), then it sounds like I might be able to take advantage of both modes on my HVR-950Q sometime in the near future (aka nirvana).

    Keep up the good work!

  3. I think I am running into this same problem… but I would love some clarification! Basically I have a 9.10 Karmic setup, mythtv .022+fixed, as per the ubuntu packages, a 950Q (actually an wintv-usb-850, but apparently its the same thing?). Everything seems to work, except livetv simply looks awful, showing two images with lots of weird colors, and no sound. I haven’t even bothered to try to record anything, as I doubt it would look any better. Is this the same as the issue you describe above?

    • Hi Ernie,

      First off, you should install the latest v4l-dvb code, since there are a couple of fixes specific to MythTV (see http://linuxtv.org/repo for instructions). Also, you should make sure that you changed the MythTV capture profile from 480×480 to 720×480, which will correct the stretched picture (this is actually a MythTV bug). And in terms of sound, make sure you configure mythtv-setup such that the capture device is associated with the proper ALSA device.

      Devin

      • Thanks for the response Devin, I did not chance the capture profile, so I’ll try that and update the v4l code and see if that does the trick. I did at least confirm last night that cat’ing the device to a file works, as does xine … Thanks for your work on this!

        • Wow, I really don’t know what I’m doing I guess … myth does now look decent after changing the capture profile everywhere to 720×480, but still no audio, and it just seems to fail at tuning in channels. Using windows and the wintv software seems to work fine with the antenna in the same spot as where I have it now (by a window). Just so weird that I can’t seem to get it to tune a channel for more than a few seconds without it crashing or hanging. using something like xine or tvtime seems to work a lot better (although still no audio).

  4. Hello,

    I thought I’d check the state of things with respect to the 950Q. I recently ended up with one and currently have it connected to my MythTV box (I’m now running Ubuntu 10.04 RC — kernel 2.6.32-21). The version of MythTV on this system is

    mythbackend –version
    Please include all output in bug reports.
    MythTV Version : 24158
    MythTV Branch : branches/release-0-23-fixes
    Network Protocol : 56
    Library API : 0.23.20100314-1
    QT Version : 4.6.2
    Options compiled in:
    linux debug using_oss using_alsa using_pulse using_jack using_pulseoutput using_backend using_dvb using_firewire using_frontend using_glx_proc_addr_arb using_hdhomerun using_hdpvr using_iptv using_ivtv using_joystick_menu using_libudev using_lirc using_mheg using_opengl_video using_opengl_vsync using_qtdbus using_qtwebkit using_v4l using_x11 using_xrandr using_xv using_xvmc using_xvmc_vld using_xvmcw using_bindings_perl using_bindings_python using_opengl using_vdpau using_ffmpeg_threads using_libavc_5_3 using_live using_mheg

    In any event, I am able recognize this card via the MythTV setup with the Analog V4L system. I have also tested the over-the-air HD digital reception with this card, but I am currently interested in the analog input capabilities. When I try to get an analog signal to playback with MythTV, I receive the following:

    2010-04-25 14:31:27.977 MythContext: Connecting to backend server: 127.0.0.1:6543 (try 1 of 1)
    2010-04-25 14:31:27.980 Using protocol version 56
    2010-04-25 14:31:32.882 TV: Attempting to change from None to WatchingLiveTV
    2010-04-25 14:31:32.883 MythContext: Connecting to backend server: 127.0.0.1:6543 (try 1 of 1)
    2010-04-25 14:31:32.886 Using protocol version 56
    2010-04-25 14:31:32.916 Spawning LiveTV Recorder — begin
    2010-04-25 14:31:39.919 MythSocket(ffffffffad32d3a0:55): readStringList: Error, timed out after 7000 ms.
    2010-04-25 14:31:39.919 RemoteEncoder::SendReceiveStringList(): No response.
    2010-04-25 14:31:39.920 Spawning LiveTV Recorder — end
    2010-04-25 14:31:39.923 GetEntryAt(-1) failed.
    2010-04-25 14:31:39.927 EntryToProgram(0@Wed Dec 31 18:00:00 1969) failed to get pginfo
    2010-04-25 14:31:39.927 TV Error: HandleStateChange(): LiveTV not successfully started
    2010-04-25 14:31:39.927 We have a RingBuffer
    2010-04-25 14:31:39.984 TV Error: LiveTV not successfully started
    2010-04-25 14:31:39.998 ScreenSaverX11Private: DPMS Deactivated 1
    2010-04-25 14:31:40.001 ScreenSaverX11Private: DPMS Reactivated 1

    However, when I use tvtime with no additional arguments, I am able to see the analog video and head the audio without any problems.

    For what it is worth, I have followed the instructions off the website, with respect to the firmware and currently I am using the dvb-fe-xc5000-1.6.114.fw firmware.

    My primary reason for this post is to see how I can help out to get MythTV working well with the analog side of this device. Let me know. I am a programmer so if there are parts of the myth code I can assist with or provide info to you about, please let me know. I do have the svn version of myth available but am not currently using it. I may try that shortly, but wanted to report on my current efforts.

    Thanks for all your work on these TV devices!!!

    Pete

  5. Hello,

    I too am struggling with the 950Q and /MythTV/Analog_Cable. After replacing the model 72101 with a 72001, I am able to see video with MythTV but no audio though I DO see the levels moving in my Gnome Sound Preferences/Input/WinTV_HVR950…Source. And it does work with TVtime and -aplay. Can anyone help me troubleshoot the MythTV side. I am getting so close, and am building an ubuntu for my brother with the same card and want to convert him to linux,. This working would make a big difference, PLEASE AND THANKS.
    Mark …. markackerman8@gmail.com

  6. As a final update for anyone who is struggling with this card, as I did. Here is my summary of notes, and thanks to all who helped.
    1/ add the line: “options xc5000 no_poweroff=1 debug=1” no quotes , to:
    ∘ # sudo gedit /etc/modprobe.d/local.conf and
    ∘ # sudo gedit /etc/modprobe.d/xc5000.conf
    2/ The digital side is easy to set up — if your 950Q is your only tuner, then it will show up (digital) as the only DVB device. The only trick here, is to create a custom recorder group (instead of the default of “generic”) for it.
    3/ Then tackle the analog side. If it is your only tuner device, then this will be /dev/video0, and probably /dev/dsp1 for the audio — yes you need this field.
    4/ Then put it in the same recorder group as the digital side.
    5/ After doing mythfilldatabase and setting up the channels for everything, fire up mythfrontend. Go into the Setup -> … -> Recording Profiles, and set the resolution for the analog to be 720×480 for everything (default, live-tv, etc..). Change the audio sampling rate to 48000.
    5b/ You need to make sure your capture resolution for LiveTV mode and the various capture modes is set to 720×480 (the default in MythTV is 480×480)
    6/ you’ll need to create an “input source” for digital, and a second “input source” for analog. Yes, they can both point at exactly the same schedulesdirect.org channel lineup, but they do need to be separate otherwise.
    7/ Then use the “input connections” menu in mythtv-setup to point the digital side of the 950Q at the digital “source”, and the analog side at the analog “source”.

    • sound with tvtime using :
    ∘ tvtime | arecord -D hw:1,0 -r 32000 -c 2 -f S16_LE | aplay

    • change the MythTV sound device for the analog side of the HVR-1500-950Q to be /dev/dsp1 again. MythTV now has working sound in analog mode and I have been able to change between analog and digital modes (and vice versa) without any of the problems seen in the past.

  7. Pingback: Kylie Batt
  8. Pingback: Kylie Batt

Leave a Reply