PCTV 340e and xc4000 drivers going upstream

The PCTV 340e is one of those unfortunate situations that I (Devin Heitmueller) personally take alot of criticism over. About two years ago I bootstrapped the driver, got it working with the hardware, but then never got around to cleaning up the code enough to get it upstream. This has resulted in the HG tree I created to fall behind current kernels, as well as people being frustrated that the work isn’t available in the upstream kernel where they wouldn’t have to recompile my driver every time they do a kernel update.

While I generally strive to get my changes upstream so that they help out the maximum number of people, this is a case where I clearly failed. I invested between 30-40 hours bringing up the device. This included:

  • Negotiating with Xceive Inc. to get access to reference driver code as well as firmware redistribution rights that would allow inclusion in Linux distributions.
  • Working with DibCom to identify, understand, and workaround bugs in the dib0700 chip’s i2c implementation
  • Working with PCTV Systems to get sample devices as well as engineering details about their specific hardware implementation.
  • Using the above information to actually write a driver which works, and test it under a variety of signal conditions. This included dealing with the fact that I’m actually not in a country that receives DVB-T, so I had to use a signal generator instead.

Most of this effort occurs in private emails with the vendors and is largely invisible to users who just want their device to work. However it’s a necessary evil if the intention is to deliver a driver which actually works and that can be used by regular users.

I’m happy to say that in the last 24 hours, there has been renewed interest in getting the driver upstream. This includes other developers contributing to take my patches, do the cleanup needed, as well as extending the xc4000 driver to support analog tuning (something which is useful for the driver in general but won’t help for the 340e in particular for other reasons).

I look forward to seeing this work in the mainline kernel, and would like to thank those who are actively contributing to making this happen (both in development as well as testing):

  • Istvan Varga
  • Mauro Carvalho Chehab
  • Dmitri Belimov
  • Mohammad Bahathir Hashim

If you’re a 340e user who wants to help out, you should try out the tree that is actively being developed and report in your feedback on the linux-media mailing list.

http://www.spinics.net/lists/linux-media/msg33114.html

21 thoughts on “PCTV 340e and xc4000 drivers going upstream

  1. Hi back Devin,
    It’s been a while since I haven’t posted any comment here yet.
    I read the mailing list and there seemed to be a lot of work this year, especially regarding the coding style and performance support.
    I’m interested in testing this driver; I’m downloading the latest experimental tree from Mauro’s git.
    Be sure I’ll feedback in some days on the mailing list; however, I no longer expect analog TV to work as I got a pvrusb2 coming from someone else, which works pretty well, so I won’t post any info regarding 340e analog (which still doesn’t seem to be supported).

    Thanks a lot for your work and also for all the developers’ work 😉
    Cocodidou

    • You’ve done a lot of work, I recognize and thank you a lot, but I am sorry to say that with the git version of the xc4000 driver I downloaded from mauro, none of my video devices would work (either the pvrusb2 or the pctv 340e). VLC would crash on pvrusb2 open without giving any details, while trying to open pctv 340e causes a system kernel panic).
      Furthermore, when I cloned the git tree from mauro, I was provided a full kernel I had to compile… wojtbar, how did you manage to compile the driver keeping your current kernel?
      Still, thanks alot for your work, i’ll stay tuned 😉

      • Devin Heitmueller

        Hi Cocodidou,

        You should report these issues to linux-media, including any dmesg/panic output you have.

        I actually haven’t tried any of the changes since they went upstream, so I cannot comment on the general stability of the current build (have been too busy with other projects).

        Devin

      • Hi! If I read correctly, you cannot get any video devices working, not just xc4000 ones ? Perhaps the problem is not related to the xc4000 driver or PCTV 340e.
        For the current GIT version of the xc4000 driver, did you use the old kernellabs.com firmware (the patched driver has not been tested with that), the firmware from my web site, or the new firmware from the Xceive source code I have posted on the linux-media mailing list ? Also, did you make sure that the driver is actually finding the firmware (the name defaults to “dvb-fe-xc4000-1.4.fw”, but you can override it with the “firmware_name” module parameter). In any case, the lack of firmware should just result in an error, rather than a kernel panic.

        • Hi back and thanks for your replies,
          It just seems I am a particular case and each of my video devices has a different problem.
          I have been doing a bunch of tests tonight and finally it seemed that the firmware Istvan provided (the one I had used before, xc4000-1.4.fw) was the only one to work under my current configuration without causing a kernel panic or error (one firmware I extracted from a PCTV CD caused a K.P., maybe I did something wrong while extracting it by hand, the other one found from linux-media just caused an error which prevented the xc4000 tuner from initializing but the problem stpped there). DTV works as before with that driver and a 340e, the only change I made in the source code was the firmware file name (in order not to have to rename it).

          Regarding the pvrusb2, there were changes since the driver found along with the 2.6.38 kernel, removing any v4l1 support, change which might cause the problem. Here, the issue comes from VLC, as grabbing some video from the block device /dev/videoX works. A workaround I have done is a program called “pvrusbctl” using Qt, which uses sysfs to control the pvrusb2 while VLC just reads the stream provided by a fifo.
          There are no errors in the code, that’s probably why there is a git repository for testing, and I thank all the persons who spent time developing a driver (Devin, Mauro, and all the others).

          Anyway, sorry for any inconvenience I may have caused with the drivers not working at the first time 😉

          • How did you extract the firmware from the PCTV driver ? If you used my xc4000fw.c utility that is available on the SourceForge web site, then it does not support the PCTV driver, because it contains a modified version of the firmware that the utility does not extract correctly (it should print an error message as well).
            If the new firmware from the linux-media mailing list does not work, and it is not because of the file not being found, I will check what the problem may be.

          • I have tested the new xc4000 driver from GIT with the dvb-fe-xc4000-1.4.fw firmware file I have posted to the linux-media list and it works (radio, analog and digital TV) without problems. I do not have a PCTV 340e, though, but the new firmware does seem to be OK.

  2. Hello Devin,

    I’m trying to get a Leadtek PxDVR3200H card working in Ubuntu 11.10 and am not having any luck at all.
    It’s a cx23885 based xc4000 card, and I’ve tried all the patches and things that I could find by doing google searches but nothing will compile or work.
    I’m in Australia so I’m trying to get DVB-T working with 7M spacing.
    I can get the card working in Windows, so I know it’s not signal strength issues.
    I’m having trouble getting a driver that will load the x4000 firmware, as all the kernel drivers that load from the Ubuntu standard install assume (wrongly) that the card uses the xc3028-v27.fw.
    Is there a definitive process that I can follow that will get me further along the way? I’m prepared to be a tester for any processes that might help geet this thing working.

    Regards,

    John

    • Hi jkent,

      Your best bet is to send some email to the linux-media mailing list. I’m not really in a position to debug that particular card, and the person who added the driver support for that board is on the mailing list.

      Cheers,

      Devin

    • Hello Inykryn,

      If they have introduced a regression since the support was initially introduced into the kernel, you should email the linux-media mailing list.

      Regards,

      Devin

  3. Hello. Can anyone help me?
    I have PCTV 340e and Kaffeine not find any dvb-t tv channels

    Log
    dmesg | grep dvb
    [ 12.012396] dvb-usb: found a ‘Pinnacle PCTV 340e HD Pro USB Stick’ in cold state, will try to load a firmware
    [ 12.093202] dvb-usb: downloading firmware from file ‘dvb-usb-dib0700-1.20.fw’
    [ 12.864162] dvb-usb: found a ‘Pinnacle PCTV 340e HD Pro USB Stick’ in warm state.
    [ 12.864462] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
    [ 13.880511] dvb-usb: schedule remote query interval to 50 msecs.
    [ 13.880518] dvb-usb: Pinnacle PCTV 340e HD Pro USB Stick successfully initialized and connected.
    [ 13.880790] usbcore: registered new interface driver dvb_usb_dib0700
    What i have to do to fix it? I have to admit im newbie Ubuntu user,

    Please Help

Leave a Reply