Posts by Puffin Chunks


    SUCCESS!!!!

    Some of the final mistakes were at my end and some (super-noobish-)mistakes.

    A couple of notes for anyone else as dumb as me:

    • Make sure you're using a Raspbian (not LibreELEC) build on your SD card. I think my errors were due to the compiled kernel not having support for squashfs
    • Make sure you're clear what version your Raspberry Pi is. I thought I was using an old Raspberry Pi 2 and was, therefore, compiling in 64-bit. But it is actually a RPi original, model B, so I should have been compiling in 32-bit.

    Other than that, everything looks promising, so thank you very much, Puffin Chunks, for your help!

    No problem, dude. Sorry I haven't been about for a bit, so glad you got there! It's a great feeling when they both finally show up!

    It didn't work out of the box on a new LibreELEC install on my RPi3. :( Not even detecting the dualHD at all now?

    Any help you can provide with how to compile my own kernel, or the idiot's guide to getting this working on an RPi3 (any distro) would be amazing!

    Also - and forgive my ignorance - but if I custom compile and patch a kernel, what happens when the system updates?

    And (last dumb question): am I compiling all of these on a separate build machine? If so, how am I transferring the right files to the RPi?

    Ok, I have created a patch for version 4.9.y for Rasperry Pi. Some notes for anyone looking to use this.

    • This patch was created for my use only, anyone is free to use it, change it and amend it for reposting, but I will not troubleshoot or fix any issues anyone has. It has just been created from my amends to the 4.9 kernel to get dual tuner support working on an rPi Model B+
    • This patch has been built, tested and confirmed working on a rPi Model B+ for Kernel 4.9.13
    • Whilst this patch was compiled for a Model B+, I see no reason why it would not work on other models of Pi as the sources are the same.
    • This adds support for DVB only! I am in the UK so do not have a need for ATSC nor have any means for testing it. The amended code for ATSC is in my patch, but it has been commented out and has not been tested. The source for lgdt3306a would need to be amended to get ATSC working and I have not touched this. So to reiterate ATSC will NOT work with this patch. Do not try it.


    With that said, follow the instructions for compiling your own kernel as detailed in the Raspberry Pi documentation here: Kernel building - Raspberry Pi Documentation but make the following changes:

    • When instructed to get the sources, use the following command instead to ensure that you grab the sources for the 4.9 kernel:
      Code
      git clone --depth 1 -b rpi-4.9.y https://github.com/raspberrypi/linux
    • Once you have retrieved the sources, but before running any other commands, grab my patch from here: hauppage_winTV_dualHD_DVB_PuffinChunks_4.9.y.diff - Google Drive and copy it one folder up from where you have downloaded the rpi kernel source (eg: if your source downloaded to /home/user/linux then copy the patch to /home/user)
    • Enter the kernel source directory and apply the patch
      Code
      cd linux
      patch -p1 < ../hauppage_winTV_dualHD_DVB_PuffinChunks_4.9.y.diff


      The following output should tell you whether you've successfully applied the patch:

      Code
      patching file drivers/media/usb/em28xx/em28xx-cards.c
      patching file drivers/media/usb/em28xx/em28xx-core.c
      patching file drivers/media/usb/em28xx/em28xx-dvb.c
      patching file drivers/media/usb/em28xx/em28xx.h
    • With the patch successfully applied to the source you can now continue to follow the instructions on the Raspberry Pi documentation. It is up to you whether you compile locally on the Pi or on a different machine. My advice is the latter as it takes just minutes, but can take many hours to compile on a Pi.
    • Once compiled and installed on the Pi, don't forget to grab the firmware for the card from here: dvb-demod-si2168-b40-01.fw and copy it to your /lib/firmware folder on your Pi. You may still be missing some firmware. If this is the case, then I recommend getting CrazyCat's firmware tarball and just installing the whole lot, so you have all bases covered (dvb-firmwares.tar.bz2)

    As to your other questions, be aware, an apt-get upgrade will update the kernel if a new one has been released for Raspbian, so you will want to suppress this from your updates to avoid overwriting your custom kernel.

    The Raspberry Pi documentation will tell you how to either compile on your pi or on another system and transfer it over. As I stated above, I recommend cross-compiling on a different machine, but do whatever you feel most comfortable with, just be prepared for a long wait if compiling on the Pi.

    If you run in to any issues, let me know, but I can't promise anything as I am by no means an expert!

    Cheers

    Ok, I decided to put together a guide to how to get this to work on a Pi.

    Some notes to be aware of:

    • This is tested and working on a Raspberry Pi Model B+
    • The code below assumes that you are cross compiling, so you will either need access to a linux machine (either VM or actual computer. Mine was built on Ubuntu Server 14.04) or you will need to amend the code to compile on the Pi itself.
    • This guide only gives support for DVB (and DVB-T2). I am in the UK so do not have access to ATSC, so have no need for, nor any means to test, any amends made to the relevant ATSC sources.
    • The instructions below are not technically how you are meant to use git. I know this. My interest is not in a git tutorial, but how to get the Hauppage Win-TV Dual working on a Raspberry Pi.


    The guide:

    • If you do not already have a working Raspbian distribution installed on your Pi, then head over to FrontPage - Raspbian and follow their instructions for installing an image. NB: I run /root off a USB stick. I recommend this for a more stable and faster install.
    • Run raspi-config to set up your Pi
      Code
      sudo raspi-config


      Set your various optional options such as hostname, SSH access and overclock (I use the Modest Overclock, but it probably isn't necessary)
      Enable automatic loading of I2C Modules. The location of this will vary depending on your version of raspi-config, but mine is located in Interfacing Options

    • Reboot your Pi then shutdown.
    • On your Ubuntu machine, make a folder for compiling your kernel and navigate to it
      Code
      mkdir -p ~/git/rpi && cd ~/git/rpi
    • Download required packages for compiling your own kernel (NB this may not be a complete list, if more packages are required, let me know and I will amend)
      Code
      sudo apt update && sudo apt install git bc -y
    • Grab the toolchain required for cross compiling
      Code
      git clone --depth 1 https://github.com/raspberrypi/tools
    • Get the Raspberry Pi Kernel sources for Kernel 4.9
      Code
      git clone --depth 1 -b rpi-4.9.y https://github.com/raspberrypi/linux
    • Download my amended sources
      Code
      wget https://drive.google.com/open?id=0B4QJttpe0CpLdDNKbHVpWFNlaGs && \
      wget https://drive.google.com/open?id=0B4QJttpe0CpLWEhheHJMa2RKTjQ && \
      wget https://drive.google.com/open?id=0B4QJttpe0CpLS0FsenJ1Z0JwRkk && \
      wget https://drive.google.com/open?id=0B4QJttpe0CpLZS1Yck91bGhiWWc

    Hi everybody,

    I've just purchased a WinTV-dualHD here in New Zealand, and I'm trying to get it running on a Raspberry Pi 3 running OSMC (based off Raspbian) and I'm wondering if there is anything I can do with the great work already outlined in this thread to get a similar result on this setup? Or should I wipe it and run LibreELEC?

    I'd really appreciate any help you could provide.

    Cheers!

    Hi

    I never actually tried using the LibreElec build as my LibreElec install runs on a different device, so I can't say whether this works out of the box with it, but I would try that first, because if it does, then life will be a lot easier.

    If not, then post back and I'll see if I can create a patch for the 4.9.11 kernel. Based off my experience, you will need to compile your own kernel to get this working on a Raspbian based Pi (not as daunting as it sounds).

    Ugggh, 3 posts on the roll... sorry!

    Finally got this working on kernel 4.9.11.

    In the end I had to apply the patch to 4.2 (as posted earlier in the thread). Whilst this showed both adapters, they wouldn't tune.

    I took the patched files and looked to apply the relevant amends to the source files in kernel 4.9.11. My c knowledge is next to non-existent so this was fun. I compiled kernel 4.9.11 with my amended sources (for DVB only, I don't have ATSC).

    Compiled, recognised both tuners and both tune.

    I'm sure there was an easier way to do this, but I'm just happy I got there in the end.

    Ok, after almost a week fighting with my RPi B+ I am now truly stumped by this. I cannot, no matter what I do, get 2 adapter support going with the WinTV Dual HD Adaptor.

    I hate having to admit defeat, but here I am, tired and broken.

    My setup:

    RPi B+ running Raspbian-lite as TVHeadEnd back end.
    Multiple devices running various LibreElec/Kodi installs as front end.

    What I have done (as briefly as possible):

    Default Raspian image
    Doesn't work (obviously). Struggled with media_build for a bit on default kernel 4.4 and didn't get very far. The media_build drivers clearly loaded, but the /dev/dvb folder would not show up. After moving on to another Kernel, I think I stumbled on why this may have been... needing to add Automatic Loading of I2C kernel module in Raspi-Config. I may be wrong, haven't tested, but I would guess this is why the adapter was not showing.

    I then discovered the joys of X-Compiling.

    X-Compiled 4.7 Kernel:
    Compiled kernel 4.7 (a bad choice in retrospect, but Media_Build threw up that it would not install lgdt3306a on anything less than 4.7, so seemed like the sensible move). Got 1 adapter to show up in /dev/dvb but neither TVHeadEnd nor w_scan would find any channels on any of the muxes... still, 2 steps forward and 1 step back.

    X-Compiled 4.9 Kernel:
    Success! 1 Adaptor fully functional in TVHeadEnd! Surely it should be easy to get both adapters to work now? Nope.

    Tried some (admittedly fairly noobish) experimenting with compiling the following sources, from CrazyCat's linux_media straight into the kernel:

    Code
    lgdt3306a.c
    lgdt3306a.h
    em28xx-cards.c
    em28xx-core.c
    em28xx-dvb.c
    em28xx.h

    Well, it turns out i2c_mux.h, which lgdt3306a.c depends on was changed at Kernel version 4.6, so the functions that it calls are no longer valid. Fixing this issue is well outside of my experience level. I did try compiling them into 4.4 kernel, but this also caused me issues which I am unable to resolve.

    So, back to how media_build should be used... Finally I x-compile crazycat's linux_build through media_build against my default 4.9 kernel source. port the compiled folder over to the pi and sudo make install over there. Success! I'm getting the red text in dmesg, so my drivers must be loading from the media_build version..... but... still only 1 adapter in /dev/dvb, so I am exactly where I was when I installed my 4.9 kernel.

    If anyone could help with how I can get both adaptors working, it would be appreciated. Some outputs (and if anything else is required, please ask):

    dmesg:

    lsmod:

    How I x-compile media build:


    Some notes on x-compiling media_build, to either demonstrate my noobishness, or to help anyone else hitting the same issues:

    • ihex2fw does not x-compile correctly so needs to be compiled on the pi. This is needed for firmware install. Assuming media build is in ~ :
      Code
      rm ~/media_build/v4l/firmware/ihex2fw
      gcc ~/media_build/linux/firmware/ihex2fw.c -o ~/media_build/v4l/firmware/ihex2fw
    • Despite pointing media_build at my currently running compiled kernel (with sudo make release DIR=/lib/modules/$(uname -r) ) it installed the modules to /lib/kernel/drivers/media so I had to manually copy them into /lib/modules/$(uname -r)/kernel/drivers/media. I also re-ran /sbin/depmod -a although I don't know if this was necessary.


    Just tried building crazycat media_build from here : CrazyCat / media_build — Bitbucket

    to my existing custom 3.19.0-61-generic kernel (which I built to increase the number of DVB devices over the normal maximum of 8 - as we have 9 muxes in London and I wanted a DVB-T/T2 device per mux)

    When I plug in the Win-TV Dual HD I get the following dmesg errors : [ 28.529604] usb 1-3: new high-speed USB device number 4 using xhci_hcd [ 2 - Pastebin.com

    I'm assuming this is because I have too old a kernel?

    I hit this error. In my case I believe it was because existing modules were conflicting with the media_build installed ones.

    To remedy it I entered the media_build folder and entered the following to remove the installed modules

    Code
    sudo make rminstall

    I then did a

    Code
    sudo make install

    and the errors went away with the tuner loading.

    Worse case scenario you can try deleting the /lib/modules/<kernel version>/kernel/drivers/media folder prior to installing the media_build modules. Be warned: your mileage may vary and this probably isn't recommended (although it worked for me). I do not take responsibility for a broken system ;)