HVR-900 R2 and PCTV 330e support upstream

After sitting in a public KernelLabs tree for almost 13 months, I finally got around to merging the Micronas DRX-D driver upstream, so now DVB support for the PCTV 330e and HVR-900 R2 are in the upstream kernel (for 2.6.40).

So if you’ve been using the KernelLabs HG tree (which required considerable modification to work with recent kernels), it is no longer an issue and you should either wait for 2.6.40 to be released or use the main LinuxTV media_build tree as opposed to the tree hosted on KernelLabs.

Instructions for installing the LinuxTV media_build tree can be found in the LinuxTV wiki.

Thanks go out to Ralph Metzler for writing the original DRX-D driver, as well as to Mauro Carvalho Chehab for helping clean up the code to make it acceptable upstream.

Update: the original post referred to the code going into 2.6.39, but we missed the merge window so it actually went into 2.6.40. Blog post updated to reflect the correct version (thanks to Gerd for pointing this out).

22 thoughts on “HVR-900 R2 and PCTV 330e support upstream

  1. These are really good news. It has been a long time since last time I was able to use my HVR-900 R2…

    Waiting for 2.6.39, I’m compiling the media_build tree. 🙂 I’ll let you know how it works.

    Thank you very much for all your work.

    • I’ve tried with both kernel 2.6.37 and 2.6.38.2, but it is not working for me.

      As soon as I attach the device the system properly detect it:
      usb 2-1: new high speed USB device using ehci_hcd and address 5
      hub 2-1:1.0: USB hub found
      hub 2-1:1.0: 4 ports detected
      usb 2-1.3: new high speed USB device using ehci_hcd and address 6
      WARNING: You are using an experimental version of the media stack.
      As the driver is backported to an older kernel, it doesn’t offer
      enough quality for its usage in production.
      Use it with care.
      Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
      0b1b920610a4d41c584e97d38b5ce497c4a303d7 [media] drxd: use mutex instead of semaphore
      a8e8541bc7af59ec07e810bd29aa827878389d82 Remove the now obsolete drx397xD
      9b2dd144435e397b6ed2a75d522b49868aef98a5 [media] drxd: CodingStyle cleanups
      IR NEC protocol handler initialized
      IR RC5(x) protocol handler initialized
      IR RC6 protocol handler initialized
      em28xx: New device WinTV HVR-900 @ 480 Mbps (2040:6502, interface 0, class 0)
      em28xx #0: chip ID is em2882/em2883
      IR JVC protocol handler initialized
      IR Sony protocol handler initialized
      lirc_dev: IR Remote Control driver registered, major 249
      IR LIRC bridge handler initialized
      em28xx #0: i2c eeprom 00: 1a eb 67 95 40 20 02 65 d0 12 5c 03 82 1e 6a 18
      em28xx #0: i2c eeprom 10: 00 00 24 57 66 07 01 00 00 00 00 00 00 00 00 00
      em28xx #0: i2c eeprom 20: 46 00 01 00 f0 10 02 00 b8 00 00 00 5b e0 00 00
      em28xx #0: i2c eeprom 30: 00 00 20 40 20 6e 02 20 10 01 01 01 00 00 00 00
      em28xx #0: i2c eeprom 40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      em28xx #0: i2c eeprom 50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      em28xx #0: i2c eeprom 60: 00 00 00 00 00 00 00 00 00 00 18 03 34 00 30 00
      em28xx #0: i2c eeprom 70: 32 00 38 00 36 00 32 00 37 00 39 00 33 00 32 00
      em28xx #0: i2c eeprom 80: 00 00 1e 03 57 00 69 00 6e 00 54 00 56 00 20 00
      em28xx #0: i2c eeprom 90: 48 00 56 00 52 00 2d 00 39 00 30 00 30 00 00 00
      em28xx #0: i2c eeprom a0: 84 12 00 00 05 50 1a 7f d4 78 23 fa fd d0 28 89
      em28xx #0: i2c eeprom b0: ff 00 00 00 04 84 0a 00 01 01 20 77 00 40 dc fb
      em28xx #0: i2c eeprom c0: 1f f0 74 02 01 00 01 79 54 00 00 00 00 00 00 00
      em28xx #0: i2c eeprom d0: 84 12 00 00 05 50 1a 7f d4 78 23 fa fd d0 28 89
      em28xx #0: i2c eeprom e0: ff 00 00 00 04 84 0a 00 01 01 20 77 00 40 dc fb
      em28xx #0: i2c eeprom f0: 1f f0 74 02 01 00 01 79 54 00 00 00 00 00 00 00
      em28xx #0: EEPROM ID= 0x9567eb1a, EEPROM hash = 0x6a9737dd
      em28xx #0: EEPROM info:
      em28xx #0: AC97 audio (5 sample rates)
      em28xx #0: 500mA max power
      em28xx #0: Table at 0x24, strings=0x1e82, 0x186a, 0x0000
      em28xx #0: Identified as Hauppauge WinTV HVR 900 (R2) (card=18)
      tveeprom 0-0050: Hauppauge model 65018, rev B2C0, serial# 2096092
      tveeprom 0-0050: tuner model is Xceive XC3028 (idx 120, type 71)
      tveeprom 0-0050: TV standards PAL(B/G) PAL(I) PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xd4)
      tveeprom 0-0050: audio processor is None (idx 0)
      tveeprom 0-0050: has radio
      tvp5150 0-005c: chip found @ 0xb8 (em28xx #0)
      tvp5150 0-005c: tvp5150am1 detected.
      i2c-core: driver [tuner] using legacy suspend method
      i2c-core: driver [tuner] using legacy resume method
      tuner 0-0061: Tuner -1 found with type(s) Radio TV.
      xc2028 0-0061: creating new instance
      xc2028 0-0061: type set to XCeive xc2028/xc3028 tuner
      xc2028 0-0061: Loading 80 firmware images from xc3028-v27.fw, type: xc2028 firmware, ver 2.7
      xc2028 0-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
      xc2028 0-0061: Loading firmware for type=MTS (4), id 000000000000b700.
      xc2028 0-0061: Loading SCODE for type=MTS LCD NOGD MONO IF SCODE HAS_IF_4500 (6002b004), id 000000000000b700.
      Registered IR keymap rc-hauppauge
      input: em28xx IR (em28xx #0) as /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.3/rc/rc0/input13
      rc0: em28xx IR (em28xx #0) as /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.3/rc/rc0
      em28xx #0: Config register raw data: 0xd0
      em28xx #0: AC97 vendor ID = 0xffffffff
      em28xx #0: AC97 features = 0x6a90
      em28xx #0: Empia 202 AC97 audio processor detected
      em28xx #0: v4l2 driver version 0.1.2
      em28xx #0: V4L2 video device registered as video1
      em28xx #0: V4L2 VBI device registered as vbi0
      usbcore: registered new interface driver em28xx
      em28xx driver loaded
      em28xx-audio.c: probing for em28x1 non standard usbaudio
      em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
      Em28xx: Initialized (Em28xx Audio Extension) extension
      WARNING: You are using an experimental version of the media stack.
      As the driver is backported to an older kernel, it doesn’t offer
      enough quality for its usage in production.
      Use it with care.
      Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
      0b1b920610a4d41c584e97d38b5ce497c4a303d7 [media] drxd: use mutex instead of semaphore
      a8e8541bc7af59ec07e810bd29aa827878389d82 Remove the now obsolete drx397xD
      9b2dd144435e397b6ed2a75d522b49868aef98a5 [media] drxd: CodingStyle cleanups
      xc2028 0-0061: attaching existing instance
      xc2028 0-0061: type set to XCeive xc2028/xc3028 tuner
      em28xx #0: em28xx #0/2: xc3028 attached
      DVB: registering new adapter (em28xx #0)
      DVB: registering adapter 0 frontend 0 (Micronas DRXD DVB-T)…
      em28xx #0: Successfully loaded em28xx-dvb
      Em28xx: Initialized (Em28xx dvb Extension) extension

      But later, when I try to use the device (i.e.: using mplayer dvb://), I get this error:
      drxd: deviceId = 0000
      DRX3975D-A2
      xc2028 0-0061: error: bandwidth not supported.
      xc2028 0-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
      xc2028 0-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
      xc2028 0-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
      xc2028 0-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
      xc2028 0-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
      xc2028 0-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
      xc2028 0-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
      xc2028 0-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
      xc2028 0-0061: Loading firmware for type=BASE MTS (5), id 0000000000000000.
      divide error: 0000 [#1] SMP
      last sysfs file: /sys/devices/platform/applesmc.768/light
      CPU 0
      Modules linked in: nvidia(P) drxd em28xx_dvb dvb_core em28xx_alsa rc_hauppauge tuner_xc2028 tuner tvp5150 ir_lirc_codec lirc_dev ir_sony_decoder ir_jvc_decoder em28xx ir_rc6_decoder v4l2_common ir_rc5_decoder videobuf_vmalloc ir_nec_decoder videobuf_core rc_core tveeprom ipv6 cpufreq_powersave cpufreq_conservative cpufreq_userspace kvm_intel kvm uinput fuse dm_crypt hfsplus reiserfs loop firewire_sbp2 dm_mod btusb bluetooth hid_apple appletouch snd_usb_audio snd_hwdep snd_usbmidi_lib usbhid hid uvcvideo videodev arc4 media v4l2_compat_ioctl32 snd_hda_codec_realtek ecb ath9k snd_hda_intel snd_hda_codec snd_pcm_oss snd_mixer_oss snd_pcm sg mac80211 snd_seq_dummy snd_seq_oss snd_seq_midi sr_mod cdrom ath9k_common ath9k_hw ath cfg80211 snd_rawmidi sky2 snd_seq_midi_event rfkill snd_seq option usb_wwan usbserial snd_timer snd_seq_device snd uhci_hcd soundcore snd_page_alloc joydev ehci_hcd intel_agp i2c_i801 i2c_core firewire_ohci firewire_core applesmc crc_itu_t intel_gtt button rtc_cmos rtc_core rtc_lib input_polldev mbp_nvidia_bl evdev pcspkr battery video ac

      Pid: 2157, comm: kdvb-ad-0-fe-0 Tainted: P 2.6.38.2geppetto #1 Apple Inc. MacBookPro3,1/Mac-F4238BC8
      RIP: 0010:[] [] drxd_set_frontend+0x651/0x1620 [drxd]
      RSP: 0018:ffff880071e7fd60 EFLAGS: 00010206
      RAX: 00005b8d80000000 RBX: ffff88007af1d000 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: 0000000000000070 RDI: ffff88007afba240
      RBP: 0000000000000000 R08: ffff880071e7e000 R09: dead000000200200
      R10: dead000000100100 R11: 0000000000000001 R12: ffff88007af1d6e9
      R13: ffff88007af1d6d0 R14: 000000000000022c R15: 0000000000000000
      FS: 0000000000000000(0000) GS:ffff88007ec00000(0000) knlGS:0000000000000000
      CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      CR2: 00007f6574bdc000 CR3: 000000000148c000 CR4: 00000000000006f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Process kdvb-ad-0-fe-0 (pid: 2157, threadinfo ffff880071e7e000, task ffff88007a4aa160)
      Stack:
      00000000ffffffff 00000000000001fb 000000000000019f 0000000081048c4e
      01ef000500470061 000501bb00050195 00000000ffff262d 0000000071e70016
      00000000ffff262d ffff88007ae0b800 0000000000000001 ffff88007af1d000
      Call Trace:
      [] ? dvb_frontend_swzigzag_autotune+0xfd/0x260 [dvb_core]
      [] ? process_timeout+0x0/0x10
      [] ? dvb_frontend_swzigzag+0x1da/0x280 [dvb_core]
      [] ? dvb_frontend_thread+0x358/0x5e0 [dvb_core]
      [] ? autoremove_wake_function+0x0/0x30
      [] ? dvb_frontend_thread+0x0/0x5e0 [dvb_core]
      [] ? dvb_frontend_thread+0x0/0x5e0 [dvb_core]
      [] ? kthread+0x96/0xa0
      [] ? kernel_thread_helper+0x4/0x10
      [] ? kthread+0x0/0xa0
      [] ? kernel_thread_helper+0x0/0x10
      Code: ff ff c7 83 40 07 00 00 01 00 00 00 0f b7 83 48 07 00 00 8b 4c 24 1c 48 69 c0 e8 03 00 00 31 d2 48 c1 e0 15 0f b6 b3 e9 06 00 00 f7 f1 48 8b bb d0 06 00 00 44 8d 88 00 00 80 ff 45 31 c0 41
      RIP [] drxd_set_frontend+0x651/0x1620 [drxd]
      RSP
      —[ end trace 5d3da5bc4b76850e ]—

      The message I get from mplayer is:
      $ mplayer dvb://
      MPlayer SVN-r33057 (C) 2000-2010 MPlayer Team
      mplayer: could not connect to socket
      mplayer: No such file or directory
      Failed to open LIRC support. You will not be able to use your remote control.

      Playing dvb://.
      dvb_tune Freq: 498000

      The first channel in my configuration file is:
      Rai 1;RAI:498000:I999B8C999D999M999T999G999Y999:T:27500:512:650=ita,694=Oth:576:0:3401:0:0:0
      and was detected by w_scan using the same device some month ago.

      Any hint?

    • Devin Heitmueller

      Hi Giulio,

      Bear in mind the changes were just merged last night, so it may take up to 24 hours for them to appear in the media_build tree.

      Devin

  2. Hi Devin.

    Is there anything I can do to be sure that I’m using the right version of the drivers?

    The device is automatically detected, modules are automatically loaded (em28xx_dvb and drxd included), /dev/video1 is also created, the git_log file in media_build/linux/ directory reports:
    0b1b920610a4d41c584e97d38b5ce497c4a303d7 [media] drxd: use mutex instead of semaphore
    a8e8541bc7af59ec07e810bd29aa827878389d82 Remove the now obsolete drx397xD
    9b2dd144435e397b6ed2a75d522b49868aef98a5 [media] drxd: CodingStyle cleanups

    Thank you,
    Giulio.

    • By the way, I just tried w_scan with the same environment: it seems to correctly complete the job (it reports few minor errors, but detects all the channels that I’m aware it should detect).

      dmesg reports:
      DRX3975D-A2
      xc2028 0-0061: Loading firmware for type=BASE F8MHZ MTS (7), id 0000000000000000.
      xc2028 0-0061: Loading firmware for type=D2620 DTV7 (88), id 0000000000000000.
      xc2028 0-0061: Loading firmware for type=D2620 DTV78 (108), id 0000000000000000.DVB: adapter 0 frontend 0 frequency 858000000 out of range (47125000..855250000)
      DVB: adapter 0 frontend 0 frequency 1600000000 out of range (47125000..855250000)
      DVB: adapter 0 frontend 0 frequency 1600000000 out of range (47125000..855250000)
      DVB: adapter 0 frontend 0 frequency 100000 out of range (47125000..855250000)
      DVB: adapter 0 frontend 0 frequency 100000 out of range (47125000..855250000)
      xc2028 0-0061: Loading firmware for type=D2620 DTV8 (208), id 0000000000000000.
      DVB: adapter 0 frontend 0 frequency 100 out of range (47125000..855250000)
      DVB: adapter 0 frontend 0 frequency 100 out of range (47125000..855250000)
      DVB: adapter 0 frontend 0 frequency 0 out of range (47125000..855250000)
      DVB: adapter 0 frontend 0 frequency 0 out of range (47125000..855250000)
      DVB: adapter 0 frontend 0 frequency 8640 out of range (47125000..855250000)
      DVB: adapter 0 frontend 0 frequency 8640 out of range (47125000..855250000)

  3. Mohammad Bahathir Hashim

    I hope we can see PCTV 340e driver in mainline V4L soon. I have patched/ported your last-last Christmas gift’s driver to support latest Linux kernel 2.6.38.

    Thank you. 🙂

  4. Hi,
    I tried kernel 2.6.39 but dvb-t doesn’t work for my HVR-900 R2. (no dvb device)
    The media_build tree fails to compile against 2.6.39.
    I used the gentoo vanilla-sources.

    Regards

    • Devin Heitmueller

      It’s in 2.6.40, not 2.6.39 (originally planned for 2.6.39 but missed the merge window). Sorry, my original blog post was incorrect in asserting it would be in 2.6.39.

      Regarding building the media_build tree against your kernel, that is something you will have to take up with the linuxtv.org maintainer (either email the linux-media mailing list or you can try the #linuxtv irc channel). I just don’t have the cycles to deal with people not being able to build the media build tree (a product of there being too many different possible user configurations out there as well as the linuxtv maintainer breaking the media build tree against various kernels on a regular basis).

      Devin

  5. Hello,
    I tried to build the v4l-dvb on an ubuntu machine with kernel 2.6.38.8 generic
    and I get make error:
    =========================================
    /home/z/media_build/v4l/kinect.c:38:19: error: ‘D_ERR’ undeclared here (not in a function)
    /home/z/media_build/v4l/kinect.c:38:27: error: ‘D_PROBE’ undeclared here (not in a function)
    /home/z/media_build/v4l/kinect.c:38:37: error: ‘D_CONF’ undeclared here (not in a function)
    /home/z/media_build/v4l/kinect.c:38:46: error: ‘D_STREAM’ undeclared here (not in a function)
    /home/z/media_build/v4l/kinect.c:38:57: error: ‘D_FRAM’ undeclared here (not in a function)
    /home/z/media_build/v4l/kinect.c:38:66: error: ‘D_PACK’ undeclared here (not in a function)
    /home/z/media_build/v4l/kinect.c:39:2: error: ‘D_USBI’ undeclared here (not in a function)
    /home//media_build/v4l/kinect.c:39:11: error: ‘D_USBO’ undeclared here (not in a function)
    /home//media_build/v4l/kinect.c:39:20: error: ‘D_V4L2’ undeclared here (not in a function)
    make[3]: *** [/home//media_build/v4l/kinect.o] Error 1
    make[2]: *** [_module_/home//media_build/v4l] Error 2
    =================================================================
    how can I bypass this error?

    • Devin Heitmueller

      Hello Dancer_69,

      Questions of this nature need to be directed to the linux-media mailing list (or you can try the #linuxtv IRC channel). I simply cannot take responsibility for the all-too-common cases where the LinuxTV maintainer commits changes that break builds against the kernel. Unless users such as yourself continue to complain loudly and frequently, this problem will continue.

      Devin

  6. I have problems to load the driver on a fedora 15 system with kernel 2.6.38.8.
    I’ve successfully built and load the driver several times on Ubuntu(32&64bit) and Mind(64bit), but on Fedora the driver doesn’t load.
    The build is successfull and I can find the em28xx files at /lib/modules/kernel_version/media.. directory but after reboot the driver isn’t loaded neither video or dvb devices have created.
    Any ideas why this happens and what can I do about it?
    Thanks in advance

    • Devin Heitmueller

      Hello Dancer_69,

      I don’t have the time to do this sort of end-user “how to I build the code” support. The code is now upstream, so your best bet is to wait for a distro to be released which includes 2.6.40 or higher.

      Regards,

      Devin

  7. Hi Devin!

    1. Thanks for the great work!
    2. I have a working 330e (works great on my mac with eyetv).
    3. I have an Apple TV 1 with CB2. It’s running Ubuntu 12.04.2 LTS (GNU/Linux 3.2.27 i686). I want to use the 330e to watch DVBT-only and to control it via the 330s IR remote on Tvheadend.
    4. I installed V4L drivers without errors.
    5. I installed (placed) the three firmware files in /lib/firmware
    6. When I plug in the 330e (dmesg below) it seems that id doesn’t start as it should. Also, there is no directory created /dev/dvb/ so I guess I have missed something. Can you please help me? I’d really appreciate it!

    [ 979.763312] usb 1-1: new high-speed USB device number 4 using ehci_hcd
    [ 979.896032] em28xx: New device Pinnacle Systems PCTV 330e @ 480 Mbps (2304:0226, interface 0, class 0)
    [ 979.896044] em28xx: Audio interface 0 found (Vendor Class)
    [ 979.896051] em28xx: Video interface 0 found: isoc
    [ 979.896058] em28xx: DVB interface 0 found: isoc
    [ 979.896242] em28xx: chip ID is em2882/3
    [ 980.045252] em2882/3 #0: EEPROM ID = 1a eb 67 95, EEPROM hash = 0x3bb3a6bf
    [ 980.045261] em2882/3 #0: EEPROM info:
    [ 980.045266] em2882/3 #0: AC97 audio (5 sample rates)
    [ 980.045272] em2882/3 #0: 500mA max power
    [ 980.045280] em2882/3 #0: Table at offset 0x27, strings=0x168e, 0x1ca4, 0x246a
    [ 980.045290] em2882/3 #0: Identified as Pinnacle Hybrid Pro (330e) (card=56)
    [ 980.045299] em2882/3 #0: analog set to isoc mode.
    [ 980.045305] em2882/3 #0: dvb set to isoc mode.
    [ 980.045533] em2882/3 #0: Binding audio extension
    [ 980.045539] em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
    [ 980.045545] em28xx-audio.c: Copyright (C) 2007-2014 Mauro Carvalho Chehab
    [ 980.045578] em2882/3 #0: Endpoint 0x83 high-speed on intf 0 alt 7 interval = 8, size 196
    [ 980.045587] em2882/3 #0: Number of URBs: 1, with 64 packets and 192 size
    [ 980.046117] em2882/3 #0: Audio extension successfully initialized
    [ 980.046126] em2882/3 #0: Registering input extension
    [ 980.051852] Registered IR keymap rc-pinnacle-pctv-hd
    [ 980.052131] input: em28xx IR (em2882/3 #0) as /devices/pci0000:00/0000:00:1d.7/usb1/1-1/rc/rc0/input3
    [ 980.052456] rc0: em28xx IR (em2882/3 #0) as /devices/pci0000:00/0000:00:1d.7/usb1/1-1/rc/rc0
    [ 980.060823] em2882/3 #0: Input extension successfully initalized

    • Devin Heitmueller

      Hi Johnbee,

      Not sure what is going on there – the demsg output looks ok at first glance, but I don’t see any mention of em28xx-dvb being loaded – do you see that module loaded in the output of “lsmod”?

      You might have better luck directing this request to the linux-media mailing list, as there are others there who might have some insight, and that is a much easier mechanism for discussion of such an issue than the blog comments.

      Devin

Leave a Reply