Sundtek Support Forum

English => {Single, Dual, Quad} Sundtek SkyTV Ultimate => Thema gestartet von: tomasl am November 19, 2021, 11:49:38 Nachmittag

Titel: linuxserver/tvheadend + sundtek
Beitrag von: tomasl am November 19, 2021, 11:49:38 Nachmittag
Hi, I have issues getting adapter present in tvheadend, I think I did everything as I supposed to and can't figure out with my poor knowledge what's wrong.
I have HC4 with odroid's ubuntu image, docker installed and use the image from linuxserver.io based on alpine linux.
I tried both ./sundtek_netinst.sh and ./sundtek_netinst_testing.sh. in fact I don't know what's the difference, haven't tried to make a diff check.

so, on the host I ran:
cd /var/lib/docker/volumes/tvh/_data/
wget http://sundtek.de/media/sundtek_netinst.sh
chmod 777 sundtek_netinst.sh
./sundtek_netinst.sh –createnodes

inside the docker container I ran:
docker exec -it tvh /bin/bash
cd /config
./sundtek_netinst.sh -docker -use-custom-path=/config

the docker CLI to create container is:
docker create --name=tvh \
-v tvh:/config \
-v tvhpicons:/picons \
-v /drives/data2/REC/:/recordings \
-e PUID=1000 -e PGID=1000 \
-e TZ=CET \
-p 9981:9981 \
-p 9982:9982 \
--device=/dev/dvb:/dev/dvb \
--device=/dev/sundtek:/dev/sundtek \
--device=/dev/bus/usb:/dev/bus/usb \
--restart unless-stopped \
linuxserver/tvheadend

and obviously it is installed inside the docker container as mediaclient shows it:
root@f53cfe724529:/opt/bin# ./mediaclient -e
**** List of Media Hardware Devices ****
device 0: [SkyTV Ultimate 6 2016/Q1]  DVB-S/S2, ANALOG-TV, REMOTE-CONTROL, OSS-AUDIO
  [INFO]:
     STATUS: STANDBY
  [BUS]:
     ID: 1-2.4
  [SERIAL]:
     ID: U171212190229
  [DVB-S/S2]:
     FESTATUS: STANDBY
     LNBVOLTAGE: DISABLED
     LNBSUPPLY: ACADAPTER
     LNBSTATUS: OK
     FRONTEND: /dev/dvb/adapter0/frontend0
     DVR: /dev/dvb/adapter0/dvr0
     DMX: /dev/dvb/adapter0/demux0
  [ANALOG-TV]:
     VIDEO0: /dev/video0
     VBI0: /dev/vbi0
  [REMOTECONTROL]:
     INPUT0: /dev/mediainput0
  [OSS]:
     OSS0: /dev/dsp0

Anything you see I'm not doing or doing wrong?

Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: Sundtek am November 21, 2021, 11:00:47 Vormittag
Hi,

will check on Monday.
- check which architecture the tvheadend binary and the driver has
./mediaclient --arch

- there needs to be an LD_PRELOAD=/path/to/libmediaclient.so in the tvheadend start script

Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: norbertk am November 21, 2021, 05:22:10 Nachmittag
Zitat
there needs to be an LD_PRELOAD=/path/to/libmediaclient.so in the tvheadend start script

Is this only required for docker ? I have some hard to track down problems with tvheadend too but work under lxc and not docker.
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: tomasl am November 22, 2021, 12:36:38 Vormittag
Hi, thank for response. see the answers for your questions.

tvheadend startup script content:
#!/bin/sh
/opt/bin/mediasrv -d --wait-for-devices --pluginpath=/opt/bin
LD_PRELOAD=/opt/lib/libmediaclient.so /usr/bin/tvheadend.bin $@

sundtek driver is arm64:
root@odroid:/opt/bin# ./mediaclient --arch
Architecture: arm64

and I asumed same for tvheadend container as it started just fine without specifically downloading the arm64 image. but just to be sure I explicitly downloaded arm64 image with arm64v8-latest tag and I can see the sundtek adapter finally. thank you.
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: Sundtek am November 22, 2021, 04:54:04 Vormittag
Also be sure that the permissions of /dev/dvb and /dev are ok, if you still cannot figure out what's wrong maybe you can set up remote access to that system (eg. Anydesk) so we can have a quick look at it.
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: tomasl am November 22, 2021, 09:45:05 Vormittag
everything is working alright now, thank you.
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: tomasl am November 28, 2021, 10:24:44 Nachmittag
aaand it doesn't work again...
I haven't touched it. I turned up the TV and HTSP client couldn't connected.
so I restarted TVH container and I got this error:
root@odroid:~# docker start tvh
Error response from daemon: error gathering device information while adding custom device "/dev/dvb": no such file or directory
Error: failed to start containers: tvh

so I checked directory and it's not present...
root@odroid:~# cd /dev/dvb
-bash: cd: /dev/dvb: No such file or directory

I stopped container, ran ./sundtek_netinst.sh –createnodes and started the container and adapter was missing.

so I installed it inside the container again with ./sundtek_netinst.sh -docker -use-custom-path=/config and still nothing.
I removed container, added it again, ran ./sundtek_netinst.sh -u, then ./sundtek_netinst.sh –createnodes again and ./sundtek_netinst.sh -docker -use-custom-path=/config inside the container, restarted the container and nothing.
I checked tvheadend startup script under /usr/bin and LD_PRELOAD is there with correct values, I checked mediaclient -e and it shows the adapter on the host as well as inside docker container. what the...
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: Sundtek am November 29, 2021, 06:19:21 Nachmittag
If you can set up anydesk we can have a look at it.
Be sure you're using the OTG Port of the Odroid system, which one do you have?

Odroid N2 has known USB Bugs, there's a followup product available from Hardkernel
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: tomasl am November 29, 2021, 09:35:38 Nachmittag
I'll get Anydesk set up and then I'll ping you. please let me know when you're usually available and how I could contact you. it will be difficult to align as with my 3 year old I can't do anything next to him as he wants to do everything with me and instead of me...
btw I'm using HC4 and it has only one USB port and I'm using small powered USB hub. I'm afraid to plug the sundtek dongle directly to the USB port of HC4.
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: Sundtek am November 30, 2021, 02:44:46 Vormittag
Hi,

maybe you can check the online chat today?

The tuner needs around 450mA (two tuners powered), if you connect it directly the host should provide enough power. Active USB Hubs ... they have a certain quality. However we can check what's going on on your side.
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: tomasl am November 30, 2021, 11:54:16 Vormittag
what do you mean two tuners? both analog and DVB-S2 on SkyTV 6? I don't need that analog one.
HC4 USB port is rated 500mA, so I don't want to take the risk something happens to the USB port or the HW behind that.
do you know of some reliable USB self-powered hub?

I'll try to catch you on the chat one day evening.
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: Sundtek am November 30, 2021, 07:09:57 Nachmittag
early in the morning is best!

oh you have another tuner, sorry I thought you have a dual dvb-s2 tuner.
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: tomasl am November 30, 2021, 09:35:20 Nachmittag
nope, I'm waiting for the quad tuner. ;)

I'll try to get to you early in the morning then. in upcoming 3 days.
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: tomasl am Dezember 06, 2021, 01:12:43 Vormittag
I didn't have chance to contact you. my kid's kindergarten has covid holidays. but I was able to make it work again. so those are steps I took:

1) uninstall sundtek driver
./sundtek_netinst.sh -u

2) delete the /dev/dvb directory

3) I didn't install the driver with the -createnodes parameter but found manual way to do it on your wiki pages for synology
mkdir -p /dev/dvb/adapter0
mknod /dev/dvb/adapter0/frontend0 c 212 1
mknod /dev/dvb/adapter0/dvr0 c 212 5
mknod /dev/dvb/adapter0/demux0 c 212 3

4) created docker container
docker create --name=tvh \
-v tvh:/config \
-v tvhpicons:/picons \
-v /drives/data2/REC/:/recordings \
-e PUID=1000 -e PGID=1000 \
-e TZ=CET \
-p 9981:9981 \
-p 9982:9982 \
--device=/dev/dvb:/dev/dvb \
--device=/dev/bus/usb:/dev/bus/usb \
--restart always \
linuxserver/tvheadend:arm64v8-latest

5) started and entered the docker container and installed the driver there
./sundtek_netinst.sh -docker -use-custom-path=/config

6) restarted the container and the adapter appeared in the tvheadend web interface and it's working again.

I have no idea what I did wrong before, I tried many times, but I could swear I did it same except the step 3. I hope this time it will work without issues or at least that this is the way how to replicate the successful installation on HC4 with ubuntu and tvheadend docker image.
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: tomasl am Dezember 06, 2021, 02:10:43 Nachmittag
it again disappeared, but this time it was back again when I restarted container. I don't know why, but I assume because I haven't used the tuner since yesterday. Is there some "keepalive" setting in the driver or tvheadend that would prevent this?
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: Sundtek am Dezember 06, 2021, 03:24:58 Nachmittag
check dmesg if there's a hardware issue or a software issue.
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: tomasl am Dezember 06, 2021, 05:55:19 Nachmittag
it seems that this set of messages repeats. I wonder if it's every time the adapter disappears from TVHeadend. those are today's messages, but it's similar from yesterday when I tested plugging and unplugging the tuner from USB hub directly to HC4 port and back again. so perhaps every time the USB hub somehow loses power the adapter disappears from TVHeadend.
[Mon Dec  6 10:11:49 2021] usb 1-2.3: usbfs: USBDEVFS_CONTROL failed cmd mediasrv rqt 64 rq 2 len 1 ret -71
[Mon Dec  6 10:11:49 2021] usb 1-2.3: usbfs: USBDEVFS_CONTROL failed cmd mediasrv rqt 64 rq 2 len 1 ret -71
[Mon Dec  6 10:11:49 2021] usb 1-2.3: usbfs: USBDEVFS_CONTROL failed cmd mediasrv rqt 64 rq 2 len 1 ret -71
[Mon Dec  6 10:11:49 2021] usb 1-2.3: usbfs: USBDEVFS_CONTROL failed cmd mediasrv rqt 64 rq 2 len 1 ret -71
[Mon Dec  6 10:11:49 2021] usb 1-2.3: USB disconnect, device number 55
[Mon Dec  6 10:11:49 2021] usb 1-2.3: new high-speed USB device number 56 using xhci-hcd
[Mon Dec  6 10:11:49 2021] usb 1-2.3: New USB device found, idVendor=2659, idProduct=1502
[Mon Dec  6 10:11:49 2021] usb 1-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Mon Dec  6 10:11:49 2021] usb 1-2.3: Product: SkyTV Ultimate 6 2016/Q1
[Mon Dec  6 10:11:49 2021] usb 1-2.3: Manufacturer: Sundtek
[Mon Dec  6 10:11:49 2021] usb 1-2.3: SerialNumber: U171212190229
[Mon Dec  6 10:11:49 2021] usb 1-2.3: Unsupported device
[Mon Dec  6 10:11:49 2021] usb 1-2.3: Unsupported device
[Mon Dec  6 10:11:49 2021] usb 1-2.3: Unsupported device
[Mon Dec  6 10:11:49 2021] usb 1-2.3: Unsupported device
[Mon Dec  6 10:11:49 2021] usb 1-2.3: Unsupported device
[Mon Dec  6 10:11:49 2021] usb 1-2.3: Unsupported device
[Mon Dec  6 10:11:49 2021] usb 1-2.3: Unsupported device
[Mon Dec  6 11:59:11 2021] docker0: port 1(vethd684a46) entered disabled state
[Mon Dec  6 11:59:11 2021] veth1d78fb8: renamed from eth0
[Mon Dec  6 11:59:11 2021] docker0: port 1(vethd684a46) entered disabled state
[Mon Dec  6 11:59:11 2021] device vethd684a46 left promiscuous mode
[Mon Dec  6 11:59:11 2021] docker0: port 1(vethd684a46) entered disabled state
[Mon Dec  6 11:59:11 2021] docker0: port 1(vethfec4937) entered blocking state
[Mon Dec  6 11:59:11 2021] docker0: port 1(vethfec4937) entered disabled state
[Mon Dec  6 11:59:11 2021] device vethfec4937 entered promiscuous mode
[Mon Dec  6 11:59:11 2021] IPv6: ADDRCONF(NETDEV_UP): vethfec4937: link is not ready
[Mon Dec  6 11:59:11 2021] docker0: port 1(vethfec4937) entered blocking state
[Mon Dec  6 11:59:11 2021] docker0: port 1(vethfec4937) entered forwarding state
[Mon Dec  6 11:59:12 2021] eth0: renamed from vetha074485
[Mon Dec  6 11:59:12 2021] IPv6: ADDRCONF(NETDEV_CHANGE): vethfec4937: link becomes ready
[Mon Dec  6 11:59:13 2021] amlogic-pcie-v2 fc000000.pcieA: the device class is not reported correctly from the register
[Mon Dec  6 11:59:16 2021] usb 1-2.3: usbfs: process 103060 (mediasrv) did not claim interface 0 before use
[Mon Dec  6 11:59:30 2021] usb 1-2.3: usbfs: process 103067 (mediasrv) did not claim interface 2 before use
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: Sundtek am Dezember 07, 2021, 01:14:29 Vormittag
You are using it via USB Hub no? if so try to remove it, some hubs are troublesome (which might possibly be related to the hardware design of the particular hub and not related to the chipset on the hub)
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: tomasl am Dezember 07, 2021, 02:01:24 Nachmittag
right now it works since yesterday container restart, and I don't want to touch it. if it again stop working I'll try.
but I had it connected directly to the HC4 and it didn't work either. I tried multiple different scenarios.
I suspect something's wrong with the HC4 USB HW/controller. this is my second HC4, first HC4 USB controller died after few weeks  of using it and I returned it under warranty. I liked the idea to have cheapest possible home NAS with TVHeadend server.
I don't think there is a problem with sundtek dongle. it worked for years and is still working on the old box as a backup when it doesn't work with HC4.
what's frustrating is, that I have no idea where is the problem and can't find out with my poor linux knowledge. if it's docker, or tvheadend, or HC4 HW or Odroid HC4 ubuntu image, or something else.
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: Sundtek am Dezember 07, 2021, 04:46:18 Nachmittag
Check the logfiles as mentioned, if the tuner shows up with mediaclient then there's a setup issue
if the tuner disappears in dmesg then there's a hardware (or possibly USB stack driver) issue, and maybe there's some more information about it available.
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: tomasl am Dezember 15, 2021, 10:21:28 Vormittag
what I noticed is, that the /dev/dvb disappears on the host after ubuntu reboot.
the container then won't start of course.
perhaps that was the reason, that somehow the container lost access to this folder previously and I missed something and just always tried to re-create the container and install drivers inside container and never noticed that there is something wrong with /dev/dvb
so after reboot, when I create the /dev/dvb content with the below commands, the tvh container starts fine and adapter is present in tvh interface. I'll observe further.

mkdir -p /dev/dvb/adapter0
mknod /dev/dvb/adapter0/frontend0 c 212 1
mknod /dev/dvb/adapter0/dvr0 c 212 5
mknod /dev/dvb/adapter0/demux0 c 212 3
Titel: Re: linuxserver/tvheadend + sundtek
Beitrag von: Sundtek am Dezember 16, 2021, 05:30:25 Vormittag
yes that's a stupidity of docker that those nodes have to exist outside of the image before being able to use them inside.

Docker prohibits the use of mknod() inside the docker, if the corresponding major/minor number is not in some kind of list before starting up docker. That special file (with major/minor number) links to the device itself.
That's something where LXR containers are definitely ahead of Docker.

As some workaround for docker you can install the driver on the host and create a config file /etc/sundtek.conf
and put enabledocker=on into it, the driver will just pre-create the nodes and exit.

        media_get_config(dev->config, "enabledocker", &docker, NULL);
        if (docker && strcmp(docker, "on")==0) {
                system("mkdir -p /dev/dvb/adapter0");
                system("mknod /dev/dvb/adapter0/frontend0 c 212 1");
                system("mknod /dev/dvb/adapter0/dvr0 c 212 5");
                system("mknod /dev/dvb/adapter0/demux0 c 212 3");
                system("mkdir -p /dev/dvb/adapter1");
                system("mknod /dev/dvb/adapter1/frontend0 c 212 7");
                system("mknod /dev/dvb/adapter1/dvr0 c 212 11");
                system("mknod /dev/dvb/adapter1/demux0 c 212 9");
                system("mkdir -p /dev/dvb/adapter2");
                system("mknod /dev/dvb/adapter2/frontend0 c 212 13");
                system("mknod /dev/dvb/adapter2/dvr0 c 212 17");
                system("mknod /dev/dvb/adapter2/demux0 c 212 15");
                system("mkdir -p /dev/dvb/adapter3");
                system("mknod /dev/dvb/adapter3/frontend0 c 212 19");
                system("mknod /dev/dvb/adapter3/dvr0 c 212 23");
                system("mknod /dev/dvb/adapter3/demux0 c 212 21");
                exit(0);
        }