Call for testers: HVR-950q MythTV fixes

I finally found a few hours to sit down and debug the issue people were reporting where switching back and forth between analog and digital modes under MythTV would intermittently fail with the hvr-950q. It turns up there were a couple of race conditions related to the power management of the chip.

http://kernellabs.com/hg/~dheitmueller/hvr-950q-pmfixes/

There was also a neat bug where the first tuning request after switching from analog mode back to digital would *always* get dropped on the floor. This would cause users to see the first tuning request fail, or there would be cases where if you had been watching analog TV and then later the backend went to record a digital program, that recording would fail.

These changes are not heavily tested yet (they do appear to fix the issues found in my environment), so I am looking for people who have seen problems to try them out and report their results in the comments.

Once I’ve gotten some feedback, I will issue a PULL request to get these fixes merged upstream.

22 thoughts on “Call for testers: HVR-950q MythTV fixes

  1. Sorry Devin, I know i’ve been active here on your blog previously, I am not able to test anymore due to the fact that I have moved and no longer have tv access (cable or otherwise).

    • Hi Corey,

      That’s fine of course. There were a couple of other people who reported the issue, so I will see how their testing goes. I just wanted to get a sanity check from those who complained before I submit the fixes upstream.

      Cheers,

      Devin

      • Good News! I’m back up and running. Moved into a new place, finally got cable hooked up, so I will be available to test my HVR950Q when needed.

        However, I’m running Ubuntu 10.04 64-bit alpha right now.

  2. Hello again Devin!

    Thanks for looking into this and making the code changes. I downloaded the above snapshot, compiled, installed, and rebooted. I tested last night by recording several shows back-to-back going from digital to analog and back. Initially everything looked good, the previews in MythTV weren’t for blanks screens and I did not see any errors in dmesg during the recordings. When I went to watch them this morning, the digital recordings were great but the analog recordings had no sound. When I went to test analog using tvtime with the command “tvtime | arecord -D hw:1,0 -f S16_LE -c2 -r32000 | aplay -“, I got some audio but the reception looked like it hadn’t quite tuned into the right frequency. I then tried LiveTV in MythTV switching back and forth from digital to analog. At some point, our old friends started showing up in dmesg:

    ALSA sound/usb/usbaudio.c:354: frame 0 active: -18
    recv_control_msg() Failed receiving control message, error -110.
    au8522_writereg: writereg error (reg == 0xa4, val == 0x0020, ret == -5)
    send_control_msg() Failed sending control message, error -110.
    Au0828 can’t set alternate to 0!

    I haven’t changed anything in MythTV since my last tests, but I’m going to check my analog recording settings again today. After that, I guess I’m in for another reboot since that appears to be the only way to clear up the problem.

    Brian

    • Checked mythtvsetup for the analog side of my HVR-950Q. For some reason the sound device was /dev/dsp1. I’m running Fedora 11, and by default they don’t load the OSS emulation modules anymore. I turned them on at one point, but a package update since then must have disabled them after my last round of MythTV testing. I’ve changed the audio capture to be ALSA:hw:1,0 and I’ll reboot and test more this evening.

      • After more testing and using the “tvtime | arecord D hw:1,0 -r 32000 -c 2 -f S16_LE | sox -q -c 2 -r 32000 -w -t wav – -t alsa hw:0,0” test, I determined that bad things can still happen when trying to use ALSA with the HVR-950Q (in analog mode of course). I uncommented a line in /etc/modprobe.d/dist-oss.conf to re-enable OSS emulation support, rebooted, and changed the MythTV sound device for the analog side of the HVR-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.

        Thanks for the fix and I will continue testing. Looks like I should buy you a beer (or coke).

        Brian

  3. What am I doing wrong??…..
    ….I went to http://linuxtv.org/hg/v4l-dvb, and downloaded and extracted the bz2 file.
    when trying to # make, I got an error…
    Updating/Creating .config
    Preparing to compile for kernel version 2.6.31
    File not found: /lib/modules/2.6.31.12-0.1-desktop/build/.config at ./scripts/make_kconfig.pl line 32, line 4.
    …so I tried # make all, and received the same error, AND i tried # make install (with a few seemingly small errors), rebooted and still mythtv frontend complains:
    “Error: MythTV is using all inputs. but there are no active recordings”
    2010-03-17 00:49:43.884 MythContext: Connecting to backend server: 127.0.0.1:6543 (try 1 of 1)
    2010-03-17 00:49:50.887 MythSocket(f52d50:36): readStringList: Error, timed out after 7000 ms.
    2010-03-17 00:49:50.887 Protocol version check failure. The response to MYTH_PROTO_VERSION was empty.
    2010-03-17 00:49:50.890 MythContext: Connecting to backend server: 127.0.0.1:6543 (try 1 of 1)
    2010-03-17 00:49:57.894 MythSocket(f51e40:36): readStringList: Error, timed out after 7000 ms.
    2010-03-17 00:49:57.894 Protocol version check failure. The response to MYTH_PROTO_VERSION was empty.

    Can you shed some light into a solution? and If I find the solution, I will post it for others to benefit from. Thanks for all your help.

  4. Thanks for your help online Dev, it is getting better, but the sound is awfully tricky with ALSA, nothing is making much sense to me yet again…haha. Any ideas here?

  5. Any luck with this (regarding the lack of reliability when two hvr-950q tuners), if there was I could throw it at my system:

    I’m wondering at this point whether perhaps the problem has to do with
    the bus allocation – perhaps the driver is selecting an alternate
    which consumes too much bandwidth, and therefore both devices cannot
    capture at the same time on the same USB bus segment.

    I’ll have to look at the code and see which alternate it’s picking.

    • Hello Andrew,

      I originally thought it might be a misconfigured alternate, until I realized that the TS stream uses a bulk pipe.

      That said, I don’t know exactly what the problem is and haven’t had any cycles to debug it.

      Just an FYI though, you can see the currently set alternate by doing a “cat /sys/kernel/debug/usb/devices” (at least that is the path on relatively recent kernels).

      Devin

  6. Just an update with my tuner card. The HVR-950Q is working with
    TVtime and Analog cable, virtually out of the box. But I really want
    to get it working with MythTV, and so far no luck. I will tell you
    the lengths to which I have gone in requesting your troubleshooting
    expertise.

    I have reverted back to Ubuntu, reinstalled a few times to get vdpau
    and the latest nvidia drivers working. Just tried a fresh install of
    MythBuntu (to rule out mythtv issues), with MythTV0.23 and Ubuntu10.04
    hoping to make a difference. Configured the latest v4l-dvb drivers
    successfully. Added line “options xc5000 no poweroff=1 debug=1” to
    /etc/modprobe.d/local.conf and xc5000.conf, to stop the card from
    turning off. (it seems at least part of the problem with mythtv is
    that it often times out). I even bought an HVR-850 to try it out; same
    problem.

    Please help me troubleshoot with your fresh perspective!, below are
    some terminal outputs and dmesg’s, that you would probably require,
    chronologically after plugging in the card and trying to “Watch TV”
    with mythtv. Thanks in advance!

    Here is the card loading after I plugged it in.
    [73313.540252] usb 2-5.5: new high speed USB device using ehci_hcd and address 8
    [73313.676067] usb 2-5.5: configuration #1 chosen from 1 choice
    [73314.040271] au0828: i2c bus registered
    [73314.350231] tveeprom 0-0050: Hauppauge model 72101, rev B3F0, serial# 6793570
    [73314.350239] tveeprom 0-0050: MAC address is 00-0D-FE-67-A9-62
    [73314.350245] tveeprom 0-0050: tuner model is Xceive XC5000 (idx 150, type 76)
    [73314.350251] tveeprom 0-0050: TV standards NTSC(M) ATSC/DVB Digital
    (eeprom 0x88)
    [73314.350256] tveeprom 0-0050: audio processor is AU8522 (idx 44)
    [73314.350261] tveeprom 0-0050: decoder processor is AU8522 (idx 42)
    [73314.350266] tveeprom 0-0050: has no radio, has IR receiver, has no
    IR transmitter
    [73314.350271] hauppauge_eeprom: warning: unknown hauppauge model #72101
    [73314.350275] hauppauge_eeprom: hauppauge eeprom: model=72101
    [73314.428851] au8522 0-0047: creating new instance
    [73314.428857] au8522_decoder creating new instance…
    [73314.446358] tuner 0-0061: chip found @ 0xc2 (au0828)
    [73314.446539] xc5000: xc5000_attach(0-0061)
    [73314.446544] xc5000 0-0061: creating new instance
    [73314.452086] xc5000: Successfully identified at address 0x61
    [73314.452092] xc5000: Firmware has not been loaded previously
    [73314.452730] au8522 0-0047: attaching existing instance
    [73314.462374] xc5000: xc5000_attach(0-0061)
    [73314.462381] xc5000 0-0061: attaching existing instance
    [73314.468973] xc5000: Successfully identified at address 0x61
    [73314.468979] xc5000: Firmware has not been loaded previously
    [73314.468987] DVB: registering new adapter (au0828)
    [73314.468994] DVB: registering adapter 0 frontend 0 (Auvitek AU8522
    QAM/8VSB Frontend)…
    [73314.471658] Registered device AU0828 [Hauppauge HVR950Q]
    [73314.567227] xc5000: xc5000_sleep()

    Looks good huh?

    Here is the terminal with mythfrontend giving up on watching livetv,
    (after 5-10secs).

    2010-04-10 22:19:00.640 MythContext: Connecting to backend server:
    127.0.0.1:6543 (try 1 of 1)
    2010-04-10 22:19:00.641 Using protocol version 56
    2010-04-10 22:19:12.403 TV: Attempting to change from None to WatchingLiveTV
    2010-04-10 22:19:12.403 MythContext: Connecting to backend server:
    127.0.0.1:6543 (try 1 of 1)
    2010-04-10 22:19:12.406 Using protocol version 56
    2010-04-10 22:19:12.427 Spawning LiveTV Recorder — begin
    2010-04-10 22:19:19.432 MythSocket(35144f0:57): readStringList: Error,
    timed out after 7000 ms.
    2010-04-10 22:19:19.433 RemoteEncoder::SendReceiveStringList(): No response.
    2010-04-10 22:19:19.433 Spawning LiveTV Recorder — end
    2010-04-10 22:19:19.433 GetEntryAt(-1) failed.
    2010-04-10 22:19:19.449 EntryToProgram(0@Wed Dec 31 16:00:00 1969)
    failed to get pginfo
    2010-04-10 22:19:19.449 TV Error: HandleStateChange(): LiveTV not
    successfully started
    2010-04-10 22:19:19.449 We have a RingBuffer
    2010-04-10 22:19:19.511 TV Error: LiveTV not successfully started
    2010-04-10 22:19:27.768 AudioPulseUtil: Resume Success
    2010-04-10 22:19:27.769 Deleting UPnP client…

    Here is the following dmesg after the attempt of Mythtv to “Watch TV”
    [73314.567227] xc5000: xc5000_sleep()
    [73472.705275] sr 0:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
    [73472.705285] sr 0:0:0:0: [sr0] Sense Key : Illegal Request [current]
    [73472.705294] sr 0:0:0:0: [sr0] Add. Sense: Read of scrambled sector
    without authentication
    [73472.705308] sr 0:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 02 00 00 00 02 00
    [73472.705327] end_request: I/O error, dev sr0, sector 2048
    [73472.705335] Buffer I/O error on device sr0, logical block 512
    [73472.705344] Buffer I/O error on device sr0, logical block 513
    [73604.945418] xc5000: xc5000_is_firmware_loaded() returns False id = 0x2000
    [73604.951190] xc5000: xc5000_is_firmware_loaded() returns False id = 0x2000
    [73604.951196] xc5000: waiting for firmware upload (dvb-fe-xc5000-1.6.114.fw)…
    [73604.951205] usb 2-5.5: firmware: requesting dvb-fe-xc5000-1.6.114.fw
    [73605.044586] xc5000: firmware read 12401 bytes.
    [73605.044591] xc5000: firmware uploading…
    [73605.044595] xc5000: xc5000_TunerReset()
    [73613.112712] xc5000: firmware upload complete…
    [73613.112737] xc5000: xc_initialize()
    [73613.299665] xc5000: xc5000_set_analog_params() frequency=6400 (in
    units of 62.5khz)
    [73613.299672] xc5000: xc_SetSignalSource(1) Source = CABLE
    [73613.308667] xc5000: xc_SetTVStandard(0x8020,0x0400)
    [73613.308673] xc5000: xc_SetTVStandard() Standard = M/N-NTSC/PAL-BTSC
    [73613.326289] xc5000: xc_tune_channel(400000000)
    [73613.326295] xc5000: xc_set_RF_frequency(400000000)
    [73613.875793] xc5000: *** ADC envelope (0-1023) = 844
    [73613.881534] xc5000: *** Frequency error = 1750 Hz
    [73613.887159] xc5000: *** Lock status (0-Wait, 1-Locked, 2-No-signal) = 2
    [73613.897158] xc5000: *** HW: V03.02, FW: V01.06.0072
    [73613.902782] xc5000: *** Horizontal sync frequency = 15824 Hz
    [73613.908782] xc5000: *** Frame lines = 65535
    [73613.915262] xc5000: *** Quality (0:56dB) = 32895
    [73614.017941] xc5000: xc5000_sleep()

    Please Help!

  7. Devin,

    I just posted a comment in your other HVR 950Q thread and then found this thread. As such, I’ll go over the suggestions in this thread with my setup and post a follow-up to getting the 950Q to work well with MythTV.

    Pete

  8. 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.

    • Devin Heitmueller

      Hi Jason,

      If you’re using a DTA, then you need to treat the 950q as an “Analog V4L2 device”, since you are connecting the DTA to the analog input.

      Devin

  9. Just wanted to say thanks to Mark for his quick guide. It worked like a charm for the most part. The only thing not working properly is the switching between digital and analog. I’m currently running Mythbuntu 10.4 with all the updates the Ubuntu supplies and I have not added or changed any drivers. It seems that after booting the system the 950q cannot get a lock on the first digital station. If I change channels it locks and then works fine. Same thing happens if I switch to analog then back to digital.

    Does anyone have any thoughts on this? This is basically the last step I have before I can make this my primary DVR.

  10. Mark’s guide above is a direct quotation of the recipe I gave out for this earlier this year. Good to see it making the rounds!

    But there’s a new wrinkle now.. /dev/dsp1 no longer exists in many distros, and MythTV fumbles badly when trying to use ALSA:xxxxx style devices for capture. As a result, many of us again have to figure out how to get analog audio working from the 950Q.

    The solution, is to reinstate /dev/dsp1 (or /dev/dsp2 in my case), using the OSS compatibility module(s) from ALSA:

    modprobe snd-mixer-oss

    If that fails (Module snd-mixer-oss not found.), then you’ll have to reconfigure/rebuild the kernel to get the missing feature.

    Cheers

Leave a Reply