Linux / DVB: Playing with a HD-901T2 DVB-T2 USB stick

This post was written by eli on March 10, 2017
Posted Under: DVB,Linux

This is the successful version of a previous post, using a DVB USB stick that works, for a change.

IMPORTANT: If you’re using a computer with USB 3.0, consider connecting the DVB stick to the computer through an external USB 2.0 hub. In particular if things break after an hour or so of playback (see “USB disaster” below). This shouldn’t make any difference in theory, but solved the problem for me. Actually, this is the second time I solve a USB 3.0 issue with a USB 2.0 hub. If anyone has an idea on why this hub makes a difference, please post below. All USB cables were short, by the way.

Plugging in the card:

$ dmesg
[ ... ]
[ 2466.203556] usb 1-2: dvb_usb_v2: found a 'Astrometa DVB-T2' in warm state
[ 2466.287494] usb 1-2: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
[ 2466.287522] DVB: registering new adapter (Astrometa DVB-T2)
[ 2466.305556] i2c i2c-9: Added multiplexed i2c bus 10
[ 2466.305567] rtl2832 9-0010: Realtek RTL2832 successfully attached
[ 2466.310149] mn88473: module is from the staging directory, the quality is unknown, you have been warned.
[ 2466.313533] mn88473 9-0018: Panasonic MN88473 successfully attached
[ 2466.313551] usb 1-2: DVB: registering adapter 0 frontend 0 (Realtek RTL2832 (DVB-T))...
[ 2466.313718] usb 1-2: DVB: registering adapter 0 frontend 1 (Panasonic MN88473)...
[ 2466.322520] r820t 10-003a: creating new instance
[ 2466.335747] r820t 10-003a: Rafael Micro r820t successfully identified
[ 2466.335780] r820t 10-003a: attaching existing instance
[ 2466.343872] r820t 10-003a: Rafael Micro r820t successfully identified
[ 2466.351883] media: Linux media interface: v0.10
[ 2466.365085] Linux video capture interface: v2.00
[ 2466.388370] rtl2832_sdr rtl2832_sdr.1.auto: Registered as swradio0
[ 2466.388382] rtl2832_sdr rtl2832_sdr.1.auto: Realtek RTL2832 SDR attached
[ 2466.388386] rtl2832_sdr rtl2832_sdr.1.auto: SDR API is still slightly experimental and functionality changes may follow
[ 2466.395405] Registered IR keymap rc-empty
[ 2466.395640] input: Astrometa DVB-T2 as /devices/pci0000:00/0000:00:14.0/usb1/1-2/rc/rc0/input11
[ 2466.395932] rc0: Astrometa DVB-T2 as /devices/pci0000:00/0000:00:14.0/usb1/1-2/rc/rc0
[ 2466.401023] IR NEC protocol handler initialized
[ 2466.402794] IR RC5(x/sz) protocol handler initialized
[ 2466.405693] IR RC6 protocol handler initialized
[ 2466.408419] IR JVC protocol handler initialized
[ 2466.414092] IR Sharp protocol handler initialized
[ 2466.414716] IR MCE Keyboard/mouse protocol handler initialized
[ 2466.418597] input: MCE IR Keyboard/Mouse (dvb_usb_rtl28xxu) as /devices/virtual/input/input12
[ 2466.418906] usb 1-2: dvb_usb_v2: schedule remote query interval to 200 msecs
[ 2466.418972] lirc_dev: IR Remote Control driver registered, major 244
[ 2466.422821] rc rc0: lirc_dev: driver ir-lirc-codec (dvb_usb_rtl28xxu) registered at minor = 0
[ 2466.422827] IR LIRC bridge handler initialized
[ 2466.424978] IR XMP protocol handler initialized
[ 2466.426269] IR Sony protocol handler initialized
[ 2466.426274] IR SANYO protocol handler initialized
[ 2466.429076] usb 1-2: dvb_usb_v2: 'Astrometa DVB-T2' successfully initialized and connected
[ 2466.429300] usbcore: registered new interface driver dvb_usb_rtl28xxu

Seems pretty good. Judging by the device ID (15f4:0131 per lsusb), it’s exactly the device mentioned in Antti’s blog.

$ dvb-fe-tool
Device Realtek RTL2832 (DVB-T) (/dev/dvb/adapter0/frontend0) capabilities:
     CAN_FEC_1_2
     CAN_FEC_2_3
     CAN_FEC_3_4
     CAN_FEC_5_6
     CAN_FEC_7_8
     CAN_FEC_AUTO
     CAN_GUARD_INTERVAL_AUTO
     CAN_HIERARCHY_AUTO
     CAN_INVERSION_AUTO
     CAN_MUTE_TS
     CAN_QAM_16
     CAN_QAM_64
     CAN_QAM_AUTO
     CAN_QPSK
     CAN_RECOVER
     CAN_TRANSMISSION_MODE_AUTO
DVB API Version 5.10, Current v5 delivery system: DVBT
Supported delivery system:
    [DVBT]

Scanning went fine too:

$ dvbv5-scan /usr/share/dvb/dvb-t/il-All
Cannot calc frequency shift. Either bandwidth/symbol-rate is unavailable (yet).
Scanning frequency #1 514000000
       (0x00)
Scanning frequency #2 538000000
Lock   (0x1f)
Service Ch 1, provider Idan +: digital television
Service Ch 2, provider Idan +: digital television
Service Ch 10, provider Idan +: digital television
Service Ch 33, provider Idan +: digital television
Service Ch 99, provider Idan +: digital television
Service Ch 23, provider Idan +: digital television
Service Idan+test_2, provider Idan+: digital television
WARNING  Channel Idan+test_2 (service ID 7) not found on PMT. Skipping it.
Service Aleph, provider Idan +: digital radio
Service Bet, provider Idan +: digital radio
Service Gimmel, provider Idan +: digital radio
Service Dalet, provider Idan +: digital radio
Service Moreshet, provider Idan +: digital radio
Service 88FM, provider Idan +: digital radio
Service Musica, provider Idan +: digital radio
Service Reka, provider Idan +: digital radio
Service Galatz, provider Idan +: digital radio
Service Galgalatz, provider Idan +: digital radio
Service Radios, provider Idan +: digital radio
Service Kol Barama, provider Idan +: digital radio
Service Lev HaMdina, provider Idan +: digital radio
Service CLASSICAL bu, provider Idan +: digital radio

And some info:

$ dvb-fe-tool -g
FREQUENCY = 538000000
MODULATION = QAM/16
BANDWIDTH_HZ = 8000000
INVERSION = OFF
CODE_RATE_HP = 2/3
CODE_RATE_LP = 1/2
GUARD_INTERVAL = 1/4
TRANSMISSION_MODE = 8K
HIERARCHY = NONE
DELIVERY_SYSTEM = DVBT
$ dvb-fe-tool -m
       (0x00) Signal= 92.55% C/N= 32.98dB postBER= 0
       (0x00) Signal= 92.55% C/N= 32.98dB postBER= 0
       (0x00) Signal= 92.55% C/N= 32.98dB postBER= 0
       (0x00) Signal= 92.55% C/N= 32.98dB postBER= 0
       (0x00) Signal= 92.55% C/N= 32.98dB postBER= 0

Hmmm… Why isn’t it locked? And the data doesn’t change as I move the antenna around.

On the other hand,

$ dvbv5-zap -c dvb_channel.conf -r 'Ch 10'
using demux '/dev/dvb/adapter0/demux0'
reading channels from file 'dvb_channel.conf'
service has pid type 06:  2642 2641 2640
tuning to 538000000 Hz
video pid 2625
  dvb_set_pesfilter 2625
audio pid 2626
  dvb_set_pesfilter 2626
       (0x00)
Lock   (0x1f)
Lock   (0x1f)
DVR interface '/dev/dvb/adapter0/dvr0' can now be opened
Lock   (0x1f) Signal= 92.55% C/N= 38.67dB postBER= 0

Much better. I have a lock, and both the signal level and C/N change as I move the antenna. Actually, disconnecting the antenna and short-circuiting the input jack yields

Lock   (0x1f) Signal= 92.94% C/N= 28.19dB postBER= 1.01x10^-3

so with a momentary non-zero BER as shown above, so it looks like it’s legit.

So I have zero BER? I should see TV perfectly, then?

$ mplayer -cache 800 /dev/dvb/adapter0/dvr0
MPlayer 1.2.1 (Debian), built with gcc-5.3.1 (C) 2000-2016 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 /dev/dvb/adapter0/dvr0.
Cache fill: 16.00% (131072 bytes)   

libavformat version 56.40.101 (external)
Cache empty, consider increasing -cache and/or -cache-min. [performance issue]
TS file format detected.
Cache empty, consider increasing -cache and/or -cache-min. [performance issue]
Cache empty, consider increasing -cache and/or -cache-min. [performance issue]
Cache empty, consider increasing -cache and/or -cache-min. [performance issue]
Cache empty, consider increasing -cache and/or -cache-min. [performance issue]

Oh no. What’s really weird is that going

$ cat /dev/dvb/adapter0/dvr0 > this

and in parallel

$ ffplay this

Actually does play TV more or less live (see this post for more on ffplay in this context). But

$ mplayer this
MPlayer 1.2.1 (Debian), built with gcc-5.3.1 (C) 2000-2016 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 this.
libavformat version 56.40.101 (external)
TS file format detected.
VIDEO MPEG2(pid=2625) AUDIO MPA(pid=2626) NO SUBS (yet)!  PROGRAM N. 0
MPEG: FATAL: EOF while searching for sequence header.
Video: Cannot read properties.
Load subtitles in ./

No sequence header? The clip is a minute long! Googling around, I found this tip, saying maybe there’s no PAT/PMT in the stream, and suggested adding “-demuxer lavf” flags to mplayer. That turned out to be corect:

$ mplayer -demuxer lavf this

Plays the clip, but

$ mplayer -demuxer lavf -cache 800 /dev/dvb/adapter0/dvr0

still complains about the cache being empty, like before. Only difference: When I hit CTRL-C, it plays the channel for a split second and closes. So I gave up this direction for now.

In hindsight, I don’t think I every tried to copy with my previous dongle. Maybe it worked, after all, even though there was a crucial difference: I never managed to get Tvheadend to display a picture either with the previous dongle. And with this one Tvheadend works like a charm.

I will never know, as I messed it up in the end.

USB disaster

It can start with a few like these:

Mar 10 10:44:21 tv kernel: [ 6133.433107] rtl2832 9-0010: i2c reg read failed -32

But after some time (an hour or so of playback)  ends with a full scale spontaneous disconnection of the USB device (without me touching anything, needless to say):

Mar 11 13:48:01 tv kernel: [ 1793.806742] usb 1-4: USB disconnect, device number 7
Mar 11 13:48:02 tv tvheadend[3325]: linuxdvb: Realtek RTL2832 (DVB-T) : DVB-T #0 - FE_READ_STATUS error No such device
Mar 11 13:48:02 tv kernel: [ 1794.805814] usb 1-4: dvb_usb_v2: rc.query() failed=-110
Mar 11 13:48:02 tv kernel: [ 1794.805885] rtl2832 9-0010: i2c reg read failed -19
Mar 11 13:48:02 tv acpid: input device has been disconnected, fd 7
Mar 11 13:48:02 tv acpid: input device has been disconnected, fd 6
Mar 11 13:48:02 tv kernel: [ 1794.933688] rtl2832 9-0010: i2c reg read failed -19
Mar 11 13:48:02 tv kernel: [ 1794.933706] rtl2832 9-0010: i2c reg read failed -19
Mar 11 13:48:02 tv kernel: [ 1794.933713] r820t 10-003a: r820t_write: i2c wr failed=-19 reg=0c len=1: f0
Mar 11 13:48:02 tv kernel: [ 1794.933720] rtl2832 9-0010: i2c reg read failed -19
Mar 11 13:48:02 tv kernel: [ 1794.937964] rtl2832 9-0010: i2c reg read failed -19
Mar 11 13:48:03 tv kernel: [ 1795.729720] rtl2832 9-0010: i2c reg read failed -19
Mar 11 13:48:03 tv kernel: [ 1795.772054] rtl2832 9-0010: i2c reg read failed -19
Mar 11 13:48:03 tv kernel: [ 1795.772069] rtl2832 9-0010: i2c reg read failed -19
Mar 11 13:48:03 tv kernel: [ 1795.772077] r820t 10-003a: r820t_read: i2c rd failed=-19 reg=00 len=4: f0 e1 2b ff
Mar 11 13:48:03 tv kernel: [ 1795.774643] rtl2832 9-0010: i2c reg read failed -19
Mar 11 13:48:03 tv kernel: [ 1795.933712] rtl2832 9-0010: i2c reg read failed -19
Mar 11 13:48:04 tv kernel: [ 1796.772180] rtl2832 9-0010: i2c reg read failed -19
Mar 11 13:48:04 tv kernel: [ 1796.772190] r820t 10-003a: r820t_read: i2c rd failed=-19 reg=00 len=4: f0 e1 2b ff
Mar 11 13:48:04 tv kernel: [ 1796.774426] rtl2832 9-0010: i2c reg read failed -19
Mar 11 13:48:04 tv kernel: [ 1796.933718] rtl2832 9-0010: i2c reg read failed -19
Mar 11 13:48:05 tv kernel: [ 1797.772322] rtl2832 9-0010: i2c reg read failed -19

sometimes along with a kernel warning regarding the USB hub work thread:

Mar 11 11:25:37 tv kernel: [  480.125459] INFO: task kworker/2:1:91 blocked for more than 120 seconds.
Mar 11 11:25:37 tv kernel: [  480.125485]       Tainted: G         C OE   4.4.0-53-generic #74-Ubuntu
Mar 11 11:25:37 tv kernel: [  480.125495] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Mar 11 11:25:37 tv kernel: [  480.125506] kworker/2:1     D ffff880270613788     0    91      2 0x00000000
Mar 11 11:25:37 tv kernel: [  480.125547] Workqueue: usb_hub_wq hub_event
Mar 11 11:25:37 tv kernel: [  480.125561]  ffff880270613788 ffff880071e34a98 ffff880270f28c80 ffff8802705f8c80
Mar 11 11:25:37 tv kernel: [  480.125581]  ffff880270614000 ffff880272614108 ffff880071e34a98 ffff880071e34000
Mar 11 11:25:37 tv kernel: [  480.125599]  ffff880071e34aa0 ffff8802706137a0 ffffffff81831f75 ffff8802751a0800
Mar 11 11:25:37 tv kernel: [  480.125619] Call Trace:
Mar 11 11:25:37 tv kernel: [  480.125645]  [<ffffffff81831f75>] schedule+0x35/0x80
Mar 11 11:25:37 tv kernel: [  480.125695]  [<ffffffffc08adaf1>] dvb_unregister_frontend+0xd1/0x130 [dvb_core]
Mar 11 11:25:37 tv kernel: [  480.125718]  [<ffffffff810c3ec0>] ? wake_atomic_t_function+0x60/0x60
Mar 11 11:25:37 tv kernel: [  480.125745]  [<ffffffffc096f41d>] dvb_usbv2_exit+0x13d/0x3c0 [dvb_usb_v2]
Mar 11 11:25:37 tv kernel: [  480.125769]  [<ffffffffc096f714>] dvb_usbv2_disconnect+0x74/0xf0 [dvb_usb_v2]

After this, “lsusb” gets stuck with no output. Something really bad happened on the USB interface.

This renders the DVB stick useless. Luckily, there’s a simple solution — an external USB 2.0 hub between the DVB stick and the computer. I’m trying to figure out why this made a difference, but it did.

Add a Comment

required, use real name
required, will not be published
optional, your blog address