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:
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:
$ dmesg
[ 12.715719] media: loading out-of-tree module taints kernel.
[ 12.717949] media: Linux media interface: v0.10
[ 13.085476] Linux video capture interface: v2.00
[ 13.085498] 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 [email protected]):
af0dfe23cbf1d0188407f125d02d24d950438e6a Remove cxd2820r and lgd3306 from depends for cx231xx and em28xx drivers.
[ 13.224398] em28xx 1-1.3.4:1.0: New device HCW dualHD @ 480 Mbps (2040:0265, interface 0, class 0)
[ 13.224421] em28xx 1-1.3.4:1.0: DVB interface 0 found: isoc
[ 13.224652] em28xx 1-1.3.4:1.0: chip ID is em28174
[ 14.623777] em28xx 1-1.3.4:1.0: EEPROM ID = 26 00 01 00, EEPROM hash = 0x67e2c3c8
[ 14.623797] em28xx 1-1.3.4:1.0: EEPROM info:
[ 14.623807] em28xx 1-1.3.4:1.0: microcode start address = 0x0004, boot configuration = 0x01
[ 14.635191] em28xx 1-1.3.4:1.0: AC97 audio (5 sample rates)
[ 14.635209] em28xx 1-1.3.4:1.0: 500mA max power
[ 14.635226] em28xx 1-1.3.4:1.0: Table at offset 0x27, strings=0x0e6a, 0x1888, 0x087e
[ 14.636797] em28xx 1-1.3.4:1.0: Identified as Hauppauge WinTV-dualHD DVB (card=99)
[ 14.653163] tveeprom: Hauppauge model 204109, rev B3I6, serial# 11569671
[ 14.653180] tveeprom: tuner model is SiLabs Si2157 (idx 186, type 4)
[ 14.653190] tveeprom: TV standards PAL(B/G) NTSC(M) PAL(I) SECAM(L/L') PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xfc)
[ 14.653196] tveeprom: audio processor is None (idx 0)
[ 14.653202] tveeprom: has no radio, has IR receiver, has no IR transmitter
[ 14.653222] em28xx 1-1.3.4:1.0: dvb set to isoc mode.
[ 14.674639] usbcore: registered new interface driver em28xx
[ 14.699875] 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 [email protected]):
af0dfe23cbf1d0188407f125d02d24d950438e6a Remove cxd2820r and lgd3306 from depends for cx231xx and em28xx drivers.
[ 14.704657] em28xx 1-1.3.4:1.0: Binding DVB extension
[ 14.757035] i2c i2c-4: Added multiplexed i2c bus 5
[ 14.757061] si2168 4-0064: Silicon Labs Si2168-B40 successfully identified
[ 14.757072] si2168 4-0064: firmware version: B 4.0.2
[ 14.802899] si2157 5-0060: Silicon Labs Si2147/2148/2157/2158 successfully attached
[ 14.802991] dvbdev: DVB: registering new adapter (1-1.3.4:1.0)
[ 14.803018] em28xx 1-1.3.4:1.0: DVB: registering adapter 0 frontend 0 (Silicon Labs Si2168)...
[ 14.803047] dvbdev: dvb_create_media_entity: media entity 'Silicon Labs Si2168' registered.
[ 14.810031] dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
[ 14.823628] em28xx 1-1.3.4:1.0: DVB extension successfully initialized
[ 14.823651] em28xx: Registered (Em28xx dvb Extension) extension
[ 14.864340] 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 [email protected]):
af0dfe23cbf1d0188407f125d02d24d950438e6a Remove cxd2820r and lgd3306 from depends for cx231xx and em28xx drivers.
[ 14.878124] em28xx 1-1.3.4:1.0: Registering input extension
[ 14.884456] rc rc0: 1-1.3.4:1.0 IR as /devices/platform/soc/20980000.usb/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.0/rc/rc0
[ 14.964877] Registered IR keymap rc-hauppauge
[ 14.975553] input: 1-1.3.4:1.0 IR as /devices/platform/soc/20980000.usb/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.0/rc/rc0/input0
[ 14.975631] em28xx 1-1.3.4:1.0: Input extension successfully initalized
[ 14.975642] em28xx: Registered (Em28xx Input Extension) extension
[ 17.805052] Adding 102396k swap on /var/swap. Priority:-1 extents:2 across:217084k FS
[ 18.675205] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[ 20.327190] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1
[ 21.109300] si2168 4-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
[ 22.180035] si2168 4-0064: firmware version: B 4.0.25
[ 22.195671] si2157 5-0060: found a 'Silicon Labs Si2157-A30'
[ 22.247278] si2157 5-0060: firmware version: 3.0.5
[ 182.151349] TCP: request_sock_TCP: Possible SYN flooding on port 9981. Sending cookies. Check SNMP counters.
Display More
lsmod:
$ lsmod
Module Size Used by
cfg80211 524391 0
rfkill 21259 1 cfg80211
evdev 11740 1
rc_hauppauge 2383 0
em28xx_rc 9318 0
rc_core 29893 3 rc_hauppauge,em28xx_rc
si2157 6171 1
si2168 9791 1
i2c_mux 5586 1 si2168
em28xx_dvb 23825 10
dvb_core 102796 1 em28xx_dvb
em28xx 73109 2 em28xx_rc,em28xx_dvb
tveeprom 11435 1 em28xx
v4l2_common 6215 1 em28xx
videodev 182258 2 v4l2_common,em28xx
media 28159 4 videodev,em28xx,dvb_core,si2157
sg 20786 0
snd_bcm2835 22966 0
snd_pcm 96071 1 snd_bcm2835
snd_timer 22514 1 snd_pcm
snd 68426 3 snd_timer,snd_bcm2835,snd_pcm
i2c_bcm2835 6305 0
bcm2835_gpiomem 3791 0
uio_pdrv_genirq 3718 0
uio 10134 1 uio_pdrv_genirq
fixed 3029 0
i2c_dev 6642 0
ipv6 378505 24
Display More
How I x-compile media build:
# On Ubuntu 14.04 x64
cd ~
git clone git://linuxtv.org/media_build.git
git clone --depth 1 https://github.com/crazycat69/linux_media.git
cd media_build
sudo make release DIR=<path to x-compiled 4.9 kernel source>
sudo make rminstall && sudo make distclean
sudo make release DIR=<path to x-compiled 4.9 kernel source>
cd linux
make tar DIR=~/linux_media
make untar
cd ..
wget https://bitbucket.org/CrazyCat/media_build/downloads/dvb-firmwares.tar.bz2 -O dvb-firmwares.tar.bz2
(cd v4l/firmware/; tar xvfj ../../dvb-firmwares.tar.bz2)
make ARCH=arm CROSS_COMPILE=<path to folder>/arm-linux-gnueabihf- allyesconfig
#Issue with 'frame_vector.c: No rule to make target' fix
nano v4l/Makefile
# comment out following lines:
ifeq ($(makefile-mm),1)
-include $(obj)/Makefile.mm
endif
make -j3 ARCH=arm CROSS_COMPILE=/<path to folder>/arm-linux-gnueabihf-
# Once completed, transfer the media_build folder onto pi: ~/media_build
# On pi:
sudo chown -R pi:pi ~/media_build
rm ~/media_build/v4l/firmware/ihex2fw
gcc ~/media_build/linux/firmware/ihex2fw.c -o ~/media_build/v4l/firmware/ihex2fw
cd media_build
sudo make release DIR=/lib/modules/$(uname -r)
sudo make rminstall
sudo make install
sudo cp -rv /lib/kernel/drivers/media /lib/modules/$(uname -r)/kernel/drivers/media
/sbin/depmod -a
Display More
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 ~ :
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.