Warning: this is a guide for advanced users. Use at your own risk.
Read this first.
https://support.wdc.com/knowledgebase/answer.aspx?ID=26054
If you have a Hauppauge DVB tuner, you’re set. Otherwise read on.
I have a DVBSky T330 USB DVB-C/T/T2 tuner and I’ve always wanted to record TV with my NAS… but the drivers were missing.
dmesg
[ 5081.302245] usb 1-2: new high-speed USB device number 4 using xhci_hcd
Which drivers do you need
I plugged the USB tuner in my (ubuntu) PC and checked the drivers my system uses.
dmesg
[341393.762637] usb 3-7: new high-speed USB device number 5 using xhci_hcd
[341393.911267] usb 3-7: New USB device found, idVendor=0572, idProduct=0320
[341393.911271] usb 3-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[341393.911274] usb 3-7: Product: DVB-T2/C USB-Stick
[341393.911277] usb 3-7: Manufacturer: Bestunar Inc
[341393.911279] usb 3-7: SerialNumber: 20140126
[341394.282625] usb 3-7: dvb_usb_v2: found a 'DVBSky T330' in warm state
[341394.282868] usb 3-7: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
[341394.282882] dvbdev: DVB: registering new adapter (DVBSky T330)
[341394.284121] usb 3-7: dvb_usb_v2: MAC address: 00:cc:10:a5:33:0c
[341394.295425] i2c i2c-7: Added multiplexed i2c bus 8
[341394.295426] si2168 7-0064: Silicon Labs Si2168-B40 successfully identified
[341394.295427] si2168 7-0064: firmware version: B 4.0.2
[341394.297863] media: Linux media interface: v0.10
[341394.300312] si2157 8-0060: Silicon Labs Si2147/2148/2157/2158 successfully attached
[341394.300327] usb 3-7: DVB: registering adapter 0 frontend 0 (Silicon Labs Si2168)...
[341394.326665] Registered IR keymap rc-dvbsky
[341394.326728] rc rc0: DVBSky T330 as /devices/pci0000:00/0000:00:14.0/usb3/3-7/rc/rc0
[341394.326779] input: DVBSky T330 as /devices/pci0000:00/0000:00:14.0/usb3/3-7/rc/rc0/input17
[341394.326897] usb 3-7: dvb_usb_v2: schedule remote query interval to 300 msecs
[341394.326901] usb 3-7: dvb_usb_v2: 'DVBSky T330' successfully initialized and connected
[341394.326947] usbcore: registered new interface driver dvb_usb_dvbsky
You see dvb_usb_v2, usbcore, si2168, … a bunch of modules acting up.
lsmod | grep dvb
rc_dvbsky 16384 0
dvb_usb_dvbsky 20480 0
dvb_usb_v2 40960 1 dvb_usb_dvbsky
m88ds3103 32768 1 dvb_usb_dvbsky
dvb_core 126976 3 dvb_usb_dvbsky,m88ds3103,dvb_usb_v2
rc_core 36864 4 dvb_usb_dvbsky,rc_dvbsky,dvb_usb_v2
The dvb_usb_dvbsky and rc_dvbsky modules are what I’m looking for, the rest are dependencies.
I don’t use the remote control, so I skipped that part.
How to build the drivers on Ubuntu 18
Get kernel build tools
sudo apt-get install git build-essential kernel-package fakeroot libncurses5-dev libssl-dev ccache
Get the latest GPL sources
curl -L http://downloads.wdc.com/gpl/WDMyCloud_PR4100_GPL_v2.30.193_20180502.tar.gz -o gpl.tar.gz
tar xf gpl.tar.gz && cd WDMyCloud*
Setup WD gcc toolchain
cd toolchain
source source.me
Prepare kernel setup
cd ../kernel
tar xf linux-4.1.13.tar.gz && cd linux-4.1.13
make nconfig
Now you’re in the kernel configuration menu. Find the modules you need, in my case it’s mainly the dvb_usb_dvbsky module.
Press F8 to search for dvbsky
Symbol: DVB_USB_DVBSKY [=m]
| Type : tristate
| Prompt: DVBSky USB support
| Location:
| -> Device Drivers
| -> Multimedia support (MEDIA_SUPPORT [=m])
| -> Media USB Adapters (MEDIA_USB_SUPPORT [=y])
| -> Support for various USB DVB devices v2 (DVB_USB_V2 [=m])
| Defined at drivers/media/usb/dvb-usb-v2/Kconfig:144
| Depends on: USB [=y] && MEDIA_SUPPORT [=m] && MEDIA_USB_SUPPORT [=y] && I2C [=y] && MEDIA_DIGITAL_TV_SUPPORT [=y] && DVB_USB_V2 [=m]
| Selects: DVB_M88DS3103 [=m] && DVB_SI2168 [=m] && DVB_TS2020 [=m] && MEDIA_TUNER_SI2157 [=m] && DVB_SP2 [=m]
That’s the one! Go to that location and enable it as a module.
If you need remote control, look for the RC_DEVICES option.
Save (F6) and Exit (F9).
Now build the module
make prepare
make modules_prepare
make M=drivers/media
Collect the kernel modules
mkdir ../dvb
find . -name "*.ko" -exec mv {} ../dvb \;
Load the drivers
Copy the kernel modules in the dvb dir to your PR4100 NAS. (e.g. /shares/Public/dvb)
Then SSH into the PR4100.
Several DVB tuners need to load firmware. See also the openelec repo.
Let’s set this up first
mkdir /shares/Public/dvb/firmware
ln -s /shares/Public/dvb/firmware /lib/firmware
wget http://www.dvbsky.net/download/linux/dvbsky-firmware.tar.gz
tar -zxvf dvbsky-firmware.tar.gz
cd dvbsky-firmware
sh copy-firmware.sh
The proper way is to load the drivers in the correct order. Some modules depend on others.
The lazy way is to try loading all of them a few times until they all complain that they’ve been loaded… like this:
find /shares/Public/dvb -exec insmod {} \;
Now the moment of truth.
dmesg
[188876.180114] usb 1-3: new high-speed USB device number 7 using xhci_hcd
[188876.530094] usb 1-3: dvb_usb_v2: found a 'DVBSky T330' in warm state
[188876.537599] usb 1-3: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
[188876.548132] DVB: registering new adapter (DVBSky T330)
[188876.555394] usb 1-3: dvb_usb_v2: MAC address: 00:cc:10:a5:33:0c
[188876.564041] i2c i2c-9: Added multiplexed i2c bus 10
[188876.569602] si2168 9-0064: Silicon Labs Si2168 successfully attached
[188876.579547] si2157 10-0060: Silicon Labs Si2147/2148/2157/2158 successfully attached
[188876.588317] usb 1-3: DVB: registering adapter 0 frontend 0 (Silicon Labs Si2168)...
[188876.597165] usb 1-3: dvb_usb_v2: 'DVBSky T330' successfully initialized and connected
Aight!
ls /dev/dvb/adapter0
demux0 dvr0 frontend0 net0
Cool beans.
TVHeadend
Get docker from www.wdcommunity.com
docker volume create tvh_conf
docker volume create tvh_recordings
docker create --name=tvheadend --net=bridge -v tvh_conf:/config -v tvh_recordings:/recordings -p 9981:9981 -p 9982:9982 --device=/dev/dvb --device=/dev/dri linuxserver/tvheadend
docker start tvheadend
Lookin’ good. Let’s check the web interface at port 9981
In the future I’d like to add the backport patches for increased stability, but this guide should give you the general idea.