Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DVB Tuner not recognized #109

Closed
obert0 opened this issue Feb 14, 2024 · 39 comments
Closed

DVB Tuner not recognized #109

obert0 opened this issue Feb 14, 2024 · 39 comments
Assignees

Comments

@obert0
Copy link

obert0 commented Feb 14, 2024

Hi everyone,
I try to fork the project of @GauthamVarmaK to get the DVB tuner to work and add COMSKIP and network drive mapping in this project. I will be pleased to work with @dfigus too get this addon too it's full potential!
But for the moment I have some problem with my tuner doesn't show up in TvHeadend. I have a Hauppauge WINTV 950Q and I figured the firmware isn't in the Kernel. So as I see in GitHub and thanks to @7wells I enter in the HAOS in SSH to the port 22222 and add "firmware_class.path=/mnt/data/supervisor/share/firmware" in "/mnt/boot/cmdline.txt". I download the firmware and put it in "/share/firmware" with the ssh addon. Now on HAOS startup, the firmware is in place and TvHeadend start on boot. After boot I can't see the tuner in TvHeadend. This is the Kernel logs:

[ 1.798495] snd_hda_codec_realtek hdaudioC0D2: autoconfig for ALC662 rev3: line_outs=1 (0x15/0x0/0x0/0x0/0x0) type:speaker

[ 1.798503] snd_hda_codec_realtek hdaudioC0D2: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[ 1.798506] snd_hda_codec_realtek hdaudioC0D2: hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
[ 1.798509] snd_hda_codec_realtek hdaudioC0D2: mono: mono_out=0x0
[ 1.798511] snd_hda_codec_realtek hdaudioC0D2: inputs:
[ 1.798513] snd_hda_codec_realtek hdaudioC0D2: Mic=0x19
[ 1.802459] au0828: i2c bus registered
[ 1.859720] input: HDA Intel PCH Mic as /devices/pci0000:00/0000:00:1b.0/sound/card0/input3
[ 1.861332] input: HDA Intel PCH Front Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card0/input4
[ 1.861405] input: HDA Intel PCH HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1b.0/sound/card0/input5
[ 1.911797] tveeprom: Hauppauge model 72001, rev B3F0, serial# 4034595432
[ 1.911804] tveeprom: MAC address is 00:0d:fe:7b:0a:68
[ 1.911807] tveeprom: tuner model is Xceive XC5000 (idx 150, type 76)
[ 1.911809] tveeprom: TV standards NTSC(M) ATSC/DVB Digital (eeprom 0x88)
[ 1.911812] tveeprom: audio processor is AU8522 (idx 44)
[ 1.911814] tveeprom: decoder processor is AU8522 (idx 42)
[ 1.911815] tveeprom: has no radio, has IR receiver, has no IR transmitter
[ 1.911817] au0828: hauppauge_eeprom: hauppauge eeprom: model=72001
[ 1.914875] au8522 9-0047: creating new instance
[ 1.914879] au8522_decoder creating new instance...
[ 1.918812] tuner: 9-0061: Tuner -1 found with type(s) Radio TV.
[ 1.918832] xc5000 9-0061: creating new instance
[ 1.923706] xc5000: Successfully identified at address 0x61
[ 1.923710] xc5000: Firmware has not been loaded previously
[ 1.964245] EXT4-fs (sda8): mounted filesystem with ordered data mode. Quota mode: none.
[ 1.982879] EXT4-fs (sda8): resizing filesystem from 58429329 to 58429329 blocks
[ 2.016345] Adding 2627988k swap on /mnt/data/swapfile. Priority:-2 extents:92 across:192290816k SSFS
[ 2.020457] EXT4-fs (zram2): mounted filesystem without journal. Quota mode: none.
[ 2.078602] systemd-journald[133]: Received client request to flush runtime journal.
[ 2.226062] au8522 9-0047: attaching existing instance
[ 2.229806] xc5000 9-0061: attaching existing instance
[ 2.234675] xc5000: Successfully identified at address 0x61
[ 2.234680] xc5000: Firmware has not been loaded previously
[ 2.234683] dvbdev: DVB: registering new adapter (au0828)
[ 2.234689] usb 2-1.3.1: DVB: registering adapter 0 frontend 0 (Auvitek AU8522 QAM/8VSB Frontend)...
[ 2.234700] dvbdev: dvb_create_media_entity: media entity 'Auvitek AU8522 QAM/8VSB Frontend' registered.
[ 2.234989] dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
[ 2.235302] au0828: Registered device AU0828 [Hauppauge HVR950Q]
[ 2.235362] usbcore: registered new interface driver au0828
[ 2.245657] usbcore: registered new interface driver snd-usb-audio
[ 2.298359] au0828: Enabled Source: Xceive XC5000->au8522 9-0047->au0828a vbi Ret 0
[ 2.298482] au0828: Disabled Source: Xceive XC5000->au8522 9-0047->au0828a vbi Ret 0
[ 2.362222] audit: type=1334 audit(1707593858.297:4): prog-id=8 op=LOAD
[ 2.979317] audit: type=1334 audit(1707593858.914:5): prog-id=9 op=LOAD
[ 2.979451] audit: type=1334 audit(1707593858.914:6): prog-id=10 op=LOAD
[ 2.979500] audit: type=1334 audit(1707593858.915:7): prog-id=11 op=LOAD
`

Now if I unplugged and replugged the tunner I can see it in TVHeadend, but it is not usable. When I try to use it more line

usb 2-1.3.1L Tuner is busy. Error -16
appear. Here the Kernel logs:

[ 600.085231] usb 2-1.3: USB disconnect, device number 3

[ 600.085236] usb 2-1.3.1: USB disconnect, device number 5
[ 600.085981] usb 2-1.3.1: cannot submit urb (err = -19)
[ 600.086592] au8522 9-0047: destroying instance
[ 600.086666] xc5000 9-0061: destroying instance
[ 603.328945] usb 2-1.3: new high-speed USB device number 6 using ehci-pci
[ 603.408990] usb 2-1.3: New USB device found, idVendor=05e3, idProduct=0608, bcdDevice= 7.02
[ 603.408995] usb 2-1.3: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 603.408997] usb 2-1.3: Product: USB2.0 Hub
[ 603.409544] hub 2-1.3:1.0: USB hub found
[ 603.409959] hub 2-1.3:1.0: 4 ports detected
[ 603.686935] usb 2-1.3.1: new high-speed USB device number 7 using ehci-pci
[ 603.765363] usb 2-1.3.1: config 1 interface 0 altsetting 0 endpoint 0x81 has invalid wMaxPacketSize 0
[ 603.787738] usb 2-1.3.1: New USB device found, idVendor=2040, idProduct=7200, bcdDevice= 0.05
[ 603.787742] usb 2-1.3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=10
[ 603.787743] usb 2-1.3.1: Product: WinTV HVR-950
[ 603.787745] usb 2-1.3.1: Manufacturer: Hauppauge
[ 603.787746] usb 2-1.3.1: SerialNumber: 4034595432
[ 604.149982] au0828: i2c bus registered
[ 604.247326] tveeprom: Hauppauge model 72001, rev B3F0, serial# 4034595432
[ 604.247331] tveeprom: MAC address is 00:0d:fe:7b:0a:68
[ 604.247332] tveeprom: tuner model is Xceive XC5000 (idx 150, type 76)
[ 604.247333] tveeprom: TV standards NTSC(M) ATSC/DVB Digital (eeprom 0x88)
[ 604.247335] tveeprom: audio processor is AU8522 (idx 44)
[ 604.247336] tveeprom: decoder processor is AU8522 (idx 42)
[ 604.247336] tveeprom: has no radio, has IR receiver, has no IR transmitter
[ 604.247337] au0828: hauppauge_eeprom: hauppauge eeprom: model=72001
[ 604.249051] au8522 9-0047: creating new instance
[ 604.249055] au8522_decoder creating new instance...
[ 604.251769] tuner: 9-0061: Tuner -1 found with type(s) Radio TV.
[ 604.251799] xc5000 9-0061: creating new instance
[ 604.256699] xc5000: Successfully identified at address 0x61
[ 604.256702] xc5000: Firmware has not been loaded previously
[ 604.538997] au8522 9-0047: attaching existing instance
[ 604.542977] xc5000 9-0061: attaching existing instance
[ 604.547822] xc5000: Successfully identified at address 0x61
[ 604.547823] xc5000: Firmware has not been loaded previously
[ 604.547824] dvbdev: DVB: registering new adapter (au0828)
[ 604.547827] usb 2-1.3.1: DVB: registering adapter 0 frontend 0 (Auvitek AU8522 QAM/8VSB Frontend)...
[ 604.547831] dvbdev: dvb_create_media_entity: media entity 'Auvitek AU8522 QAM/8VSB Frontend' registered.
[ 604.548330] dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
[ 604.548749] au0828: Registered device AU0828 [Hauppauge HVR950Q]
[ 604.612512] au0828: Enabled Source: Xceive XC5000->au8522 9-0047->au0828a video Ret 0
[ 604.612648] au0828: Disabled Source: Xceive XC5000->au8522 9-0047->au0828a video Ret 0
[ 606.564413] kauditd_printk_skb: 163 callbacks suppressed
[ 606.564416] audit: type=1334 audit(1707594463.438:573): prog-id=139 op=LOAD
[ 606.564606] audit: type=1334 audit(1707594463.438:574): prog-id=89 op=UNLOAD
[ 606.565084] audit: type=1334 audit(1707594463.439:575): prog-id=140 op=LOAD
[ 606.565095] audit: type=1300 audit(1707594463.439:575): arch=c000003e syscall=321 success=yes exit=12 a0=5 a1=c0001382b8 a2=78 a3=0 items=0 ppid=210 pid=14006 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="runc" exe="/usr/bin/runc" subj=unconfined key=(null)
[ 606.565099] audit: type=1327 audit(1707594463.439:575): proctitle=72756E63002D2D726F6F74002F7661722F72756E2F646F636B65722F72756E74696D652D72756E632F6D6F62792F00757064617465002D2D7265736F7572636573002D00366264333762303732333532623934316263376466306135616362646538646534633338366132666266373536373963363763336666633535333038
[ 606.565153] audit: type=1334 audit(1707594463.439:576): prog-id=141 op=LOAD
[ 606.565163] audit: type=1300 audit(1707594463.439:576): arch=c000003e syscall=321 success=yes exit=14 a0=5 a1=c000138050 a2=78 a3=0 items=0 ppid=210 pid=14006 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="runc" exe="/usr/bin/runc" subj=unconfined key=(null)
[ 606.565167] audit: type=1327 audit(1707594463.439:576): proctitle=72756E63002D2D726F6F74002F7661722F72756E2F646F636B65722F72756E74696D652D72756E632F6D6F62792F00757064617465002D2D7265736F7572636573002D00366264333762303732333532623934316263376466306135616362646538646534633338366132666266373536373963363763336666633535333038
[ 606.565172] audit: type=1334 audit(1707594463.439:577): prog-id=141 op=UNLOAD
[ 606.565224] audit: type=1334 audit(1707594463.439:578): prog-id=140 op=UNLOAD
[ 606.623800] au0828: Enabled Source: Xceive XC5000->au8522 9-0047->USB Audio Ret 0
[ 606.627160] au0828: Disabled Source: Xceive XC5000->au8522 9-0047->USB Audio Ret 0
[ 606.627704] au0828: Enabled Source: Xceive XC5000->au8522 9-0047->USB Audio Ret 0
[ 606.627900] au0828: Disabled Source: Xceive XC5000->au8522 9-0047->USB Audio Ret 0
[ 606.632636] au0828: Enabled Source: Xceive XC5000->au8522 9-0047->USB Audio Ret 0
[ 607.755054] xc5000: Firmware dvb-fe-xc5000-1.6.114.fw loaded and running.
[ 607.756338] usb 2-1.3.1: DVB: adapter 0 frontend 0 frequency 0 out of range (54000000..858000000)
[ 607.757372] usb 2-1.3.1: Tuner is busy. Error -16
[ 669.479407] usb 2-1.3.1: Tuner is busy. Error -16
[ 673.484406] usb 2-1.3.1: Tuner is busy. Error -16

Now if I remove the firmware from the folder and unplugged/replugged the tunner I can still see it in TVHeadend, but it is not usable. When I try to use it more line:

usb 2-1.3.1: Direct firmware load for dvb-fe-xc5000-1.6.114.fw failed with error -2
xc5000: Upload failed. rc -2
appear. Here the Kernel logs:

[ 947.574731] retire_capture_urb: 46 callbacks suppressed

[ 947.730988] usb 2-1.3: USB disconnect, device number 6
[ 947.730995] usb 2-1.3.1: USB disconnect, device number 7
[ 947.731695] usb 2-1.3.1: cannot submit urb (err = -19)
[ 947.733606] au8522 9-0047: destroying instance
[ 947.733657] xc5000 9-0061: destroying instance
[ 950.207160] usb 2-1.3: new high-speed USB device number 8 using ehci-pci
[ 950.287220] usb 2-1.3: New USB device found, idVendor=05e3, idProduct=0608, bcdDevice= 7.02
[ 950.287229] usb 2-1.3: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 950.287232] usb 2-1.3: Product: USB2.0 Hub
[ 950.287969] hub 2-1.3:1.0: USB hub found
[ 950.288433] hub 2-1.3:1.0: 4 ports detected
[ 950.564136] usb 2-1.3.1: new high-speed USB device number 9 using ehci-pci
[ 950.642596] usb 2-1.3.1: config 1 interface 0 altsetting 0 endpoint 0x81 has invalid wMaxPacketSize 0
[ 950.664965] usb 2-1.3.1: New USB device found, idVendor=2040, idProduct=7200, bcdDevice= 0.05
[ 950.664973] usb 2-1.3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=10
[ 950.664976] usb 2-1.3.1: Product: WinTV HVR-950
[ 950.664979] usb 2-1.3.1: Manufacturer: Hauppauge
[ 950.664981] usb 2-1.3.1: SerialNumber: 4034595432
[ 951.026244] au0828: i2c bus registered
[ 951.123545] tveeprom: Hauppauge model 72001, rev B3F0, serial# 4034595432
[ 951.123553] tveeprom: MAC address is 00:0d:fe:7b:0a:68
[ 951.123556] tveeprom: tuner model is Xceive XC5000 (idx 150, type 76)
[ 951.123558] tveeprom: TV standards NTSC(M) ATSC/DVB Digital (eeprom 0x88)
[ 951.123561] tveeprom: audio processor is AU8522 (idx 44)
[ 951.123563] tveeprom: decoder processor is AU8522 (idx 42)
[ 951.123564] tveeprom: has no radio, has IR receiver, has no IR transmitter
[ 951.123566] au0828: hauppauge_eeprom: hauppauge eeprom: model=72001
[ 951.125338] au8522 9-0047: creating new instance
[ 951.125345] au8522_decoder creating new instance...
[ 951.128402] tuner: 9-0061: Tuner -1 found with type(s) Radio TV.
[ 951.128441] xc5000 9-0061: creating new instance
[ 951.133294] xc5000: Successfully identified at address 0x61
[ 951.133299] xc5000: Firmware has not been loaded previously
[ 951.415778] au8522 9-0047: attaching existing instance
[ 951.419547] xc5000 9-0061: attaching existing instance
[ 951.424443] xc5000: Successfully identified at address 0x61
[ 951.424449] xc5000: Firmware has not been loaded previously
[ 951.424451] dvbdev: DVB: registering new adapter (au0828)
[ 951.424455] usb 2-1.3.1: DVB: registering adapter 0 frontend 0 (Auvitek AU8522 QAM/8VSB Frontend)...
[ 951.424464] dvbdev: dvb_create_media_entity: media entity 'Auvitek AU8522 QAM/8VSB Frontend' registered.
[ 951.425493] dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
[ 951.426994] au0828: Registered device AU0828 [Hauppauge HVR950Q]
[ 951.437288] usb 2-1.3.1: Direct firmware load for dvb-fe-xc5000-1.6.114.fw failed with error -2
[ 951.437295] xc5000: Upload failed. rc -2
[ 951.437477] xc5000: Unable to initialise tuner
[ 951.438933] usb 2-1.3.1: DVB: adapter 0 frontend 0 frequency 0 out of range (54000000..858000000)
[ 951.439195] au0828: Enabled Source: Xceive XC5000->Auvitek AU8522 QAM/8VSB Frontend->Auvitek AU8522 QAM/8VSB Frontend Ret 0
[ 951.454317] usb 2-1.3.1: Direct firmware load for dvb-fe-xc5000-1.6.114.fw failed with error -2
[ 951.454323] xc5000: Upload failed. rc -2
[ 951.454518] xc5000: Unable to initialise tuner
[ 953.449495] kauditd_printk_skb: 148 callbacks suppressed
[ 953.449498] audit: type=1334 audit(1707594810.328:605): prog-id=155 op=LOAD
[ 953.449512] audit: type=1334 audit(1707594810.328:606): prog-id=151 op=UNLOAD
[ 953.449942] audit: type=1334 audit(1707594810.328:607): prog-id=156 op=LOAD
[ 953.449965] audit: type=1300 audit(1707594810.328:607): arch=c000003e syscall=321 success=yes exit=12 a0=5 a1=c0001302b8 a2=78 a3=0 items=0 ppid=210 pid=15883 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="runc" exe="/usr/bin/runc" subj=unconfined key=(null)
[ 953.449978] audit: type=1327 audit(1707594810.328:607): proctitle=72756E63002D2D726F6F74002F7661722F72756E2F646F636B65722F72756E74696D652D72756E632F6D6F62792F00757064617465002D2D7265736F7572636573002D00366264333762303732333532623934316263376466306135616362646538646534633338366132666266373536373963363763336666633535333038
[ 953.450054] audit: type=1334 audit(1707594810.328:608): prog-id=157 op=LOAD
[ 953.450079] audit: type=1300 audit(1707594810.328:608): arch=c000003e syscall=321 success=yes exit=14 a0=5 a1=c000130050 a2=78 a3=0 items=0 ppid=210 pid=15883 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="runc" exe="/usr/bin/runc" subj=unconfined key=(null)
[ 953.450088] audit: type=1327 audit(1707594810.328:608): proctitle=72756E63002D2D726F6F74002F7661722F72756E2F646F636B65722F72756E74696D652D72756E632F6D6F62792F00757064617465002D2D7265736F7572636573002D00366264333762303732333532623934316263376466306135616362646538646534633338366132666266373536373963363763336666633535333038
[ 953.450120] audit: type=1334 audit(1707594810.329:609): prog-id=157 op=UNLOAD
[ 953.450154] audit: type=1334 audit(1707594810.329:610): prog-id=156 op=UNLOAD
[ 982.840750] usb 2-1.3.1: Direct firmware load for dvb-fe-xc5000-1.6.114.fw failed with error -2
[ 982.840758] xc5000: Upload failed. rc -2

Finally if put back the firmware in the folder and use TvHeadend I got this line:

[ 1296.524396] xc5000: Firmware dvb-fe-xc5000-1.6.114.fw loaded and running

And now it work in TvHeadend... But on each startup I have to :

  • Removed the firmware
  • Unplugged and Replugged the Tuner
  • Wait few seconds
  • Copy the firmware
  • Than everything work fine

Anyone have a idea of the problem?
Many thanks

@dfigus dfigus self-assigned this Feb 14, 2024
@7wells
Copy link

7wells commented Feb 18, 2024

The problem that sometimes replugging is necessary and its reason was discussed over there, if I remember correctly:

https://community.home-assistant.io/t/allow-loading-firmware-files-on-boot/632031/19

@dfigus
Copy link
Owner

dfigus commented Feb 19, 2024

@7wells thanks, I found this discussion as well. So it's seems an underlying HA OS issue home-assistant/operating-system#1157 which does not provide the firmware files during the early boot stage and hence those can't be loaded. After boot those FW files are available the the replugging triggers the whole device initialization again.

Probably can't solve in the add-on, but let's keep the issue open here and link to the HA OS one.

I'll do some further investigation and testing on my end, but there is probably no workaround available.

@obert0
Copy link
Author

obert0 commented Feb 19, 2024

Thank you @7wells, I will try to create a simlink to the normal firmware folder see if it make it accessible. I think part of the problem is the home assistant files are not accessible at boot too. The firmware is in the share folder of the supervisor.
But this is just part of the problem because even with a replugging it did not work. I should unplug, remove the firmware, replug, and copy back the firmware. Then it work well. I think this problem may be caused by tvheadend.
I have succeed to repeat the problem with all addon I tried where the dvb adapter show up.
I try too automate my workaround to make to start it from HA. I succeed to move the firmware and reset the usb through a named pipe. But I can't make the named pipe listener scipt to start on host boot. If anyone have a idea!

@dfigus
Copy link
Owner

dfigus commented Feb 20, 2024

@obert0 I did some research on the USB adapter reset topic and found https://unix.stackexchange.com/questions/525532/usb-disable-and-reenable-device-on-linux/525533#525533 and netinvent/usb_resetter. Can you try whether this works? You probably can't run this inside the add-on now as it's missing the special privileged authorizations to do this.

@obert0
Copy link
Author

obert0 commented Feb 20, 2024

Actually this is exactly what I did to reset the usb through named pipe. Actually the command I use is echo 1.1—1 >/sys/bus/drivers/usb/unbind or bind to reverse. This work really well, except I should be in shh on port 22222 to make this work as I cannot access the file either way. If in the addon config "usb: true" is activated I can see the path within the addon but without acces to add the command. I eill try the solution to interact with port, but at think I will find the same issue. And I dont think it is possible to start a shell script on host at boot. The haos host is pretty close and I dont think I will be able to Install something.
My last hope is to break a usb extension, cut the power wire and pass it through a relay. I will try to drive the relay with esphome to automate the replugging. I let you know if it works!

@dfigus
Copy link
Owner

dfigus commented Feb 20, 2024

@obert0 the add-on needs elevated permissions to do this, see privileged (or full_access as the last line of defense) here. I guess we would need the SYS_ADMIN privilege here. If you can overwrite the config.yaml locally, you might try this and report back.

I will receive a USB adapter shortly and would try this out as well.

@obert0
Copy link
Author

obert0 commented Feb 20, 2024

@dfigus, I will try with privileges to replug the tuner. If this work I can start the named pipe listener with the init commands.

By the way I update your addon and the server didn't startup. Both release and edge. I did not investigate alot since I wanted to focus on my tuner problem I switch to my local addon.

@dfigus
Copy link
Owner

dfigus commented Feb 20, 2024

@obert0 I updated to the latest release version earlier today and it started as usual. What I experienced is that the config backup before TVH config migration (triggered by a new TVH "release") could easily take 30+ minutes due to wg+ installed in there and in this timeframe TVH is not fully up. In case it's still happening on your end, can you create a new issue with the logs attached?

@obert0
Copy link
Author

obert0 commented Feb 20, 2024

Yes I will try again. The weird thing is I start the addon and then try to enter in the container file system with ssh port 22222, but I got a message saying the container isn't open. I will retry and look at the logs.

EDIT: You were right and it was the first start up that take longer than usual. And I made a mistake on the container name so I coudn't get in.... My bad :)

@obert0
Copy link
Author

obert0 commented Feb 21, 2024

I tried with SYS_ADMIN Privileged and full_acces without succes. I get this message:
root@local-tvheadend-local:/sys/bus/usb/drivers/usb$ echo "1-1.1" > unbind
sh: can't create unbind: Read-only file system
I try the "Advanced SSH & Web Terminal" addon with the same result. The only way to force usb unbind/bind is with ssh on port 22222. The only way I see to succeed without hardware approch is to make a command line switch and push a ssh command on the port 22222. But I think this is security issue. It is not recommanded to let the api key permently in HA.

@dfigus
Copy link
Owner

dfigus commented Feb 21, 2024

You were right and it was the first start up that take longer than usual. And I made a mistake on the container name so I coudn't get in.... My bad :)

You can skip the backup part with command line argument --nobackup, I use it as well. See https://github.com/dfigus/addon-tvheadend/blob/main/tvheadend/DOCS.md#option-args. Furthermore you don't need to ssh to the host (port 22222) but rather can use the advanced ssh addon with disabled protection mode to get into the addon container.

I tried with SYS_ADMIN Privileged and full_acces without succes

Did you disable the protection mode for the addon? With full_access the addon should be able to do nearly anything you can do on the host: https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities

@obert0
Copy link
Author

obert0 commented Feb 21, 2024

Yes I disable the protection mode on both advance ssh addon and my local addon. It don't seam to be the same level of permissiom than with ssh on port 22222.
I can enter in the container which need high permission.

When I first try to make the firmware load I reach the end of permissions allowed by the advanced ssh addon so I needed to use ssh.

@7wells
Copy link

7wells commented Feb 22, 2024

AFAIK, logging in via ssh port 22222 is the only way to get into the "developer" mode (well, they wrote that this is for developers, only, over in the HA forum) with all needed privileges. If there is anything I can help you with (i.e. testing), please let me know. I have a DVB-T2 USB stick here attached to an RPi4 and most of the time, the tvheadend addon both in HA and in Kodi works. Sometimes I have to replug the DVB-T2 USB stick to the RPi4. I am capable of besic Linux stuff but don't know much about programming.

@dfigus
Copy link
Owner

dfigus commented Feb 22, 2024

If you ssh into 22222, you will land in the OS of the host machine (HA OS), otherwise you end up in a docker container with restricted privileges (depending on how the container was started, e.g. can be influenced via the config.yaml). However a privileged container (full_access for the addon) should grant you nearly all permissions of the host. I just received a USB DVB-S2 tuner yesterday and I hope I find some time for testing on the weekend.

@dfigus
Copy link
Owner

dfigus commented Mar 7, 2024

@obert0 There is an alpine package linux-firmware-other that provides the required firmware. I added it via #143 to the addon and released v5.1.2. I don't whether this helps, but let's give it a try. Also as this firmware can be redistributed via linux, there is a buildroot switch to include it into HAOS (refer to #143). So that would be the best solution and I can create a HAOS PR for this. But let's give it in the addon a first try.

@obert0
Copy link
Author

obert0 commented Mar 9, 2024

@dfigus Thank you very much for looking into that.
I update the addon, but the tuner still isn't visible inside tvheadend. I try to reboot the addon and HAOS without success. I will try more test tomorrow.

@dfigus
Copy link
Owner

dfigus commented Mar 10, 2024

Could you also share the kernel messages from dmesg from the addon once you test that?

@obert0
Copy link
Author

obert0 commented Mar 10, 2024

Yes. But since the HAOS (maybe there's something that broke in the update) I have strange behavior with the tuner.

  • I can't unplug / replug it on the same usb it doesn't power on. Like the usb doesn't disabled properly and isn't available.
  • After a certain sequence that I didn't found, the TVHeadend addon doesn't start or isn't accessible on port 9188.
  • I succeed one time to use the tuner, but now I can't find a sequence that work every time like before the update.

I think I will wait for a HAOS update before retry because I have really the impression of turning around. Maybe I should reinstall to get a fresh install... I will try to find the time in the next weeks.

@7wells
Copy link

7wells commented Mar 10, 2024

@obert0
Does your device get enough power via USB?

@obert0
Copy link
Author

obert0 commented Mar 10, 2024

Yes, I have a powered usb hub because I have TVHeadend on a Raspberry Pi already and I face this problem when I setuo this server. Before HAOS 12 I didn't have any issue with usb port.

@dfigus
Copy link
Owner

dfigus commented Mar 11, 2024

@obert0 I created PR home-assistant/operating-system/pull/3236 in HA OS to directly include the FW files.

@dfigus
Copy link
Owner

dfigus commented Mar 13, 2024

@obert0 there is a new HA OS 12.1 released which contains some fixes for USB, however the issues seem to be present already with HA OS 11.2:

Maybe you can give this a try.

If it's not working anymore, maybe you should report it on the HA OS repo as an issue. In the meantime you could downgrade to a working version via

ha os update --version <version that worked>

@7wells
Copy link

7wells commented Mar 15, 2024

@obert0 I created PR home-assistant/operating-system/pull/3236 in HA OS to directly include the FW files.

I had asked in October 2022 already to add firmware files and learnt (later) that it is not so easy. Now they confirmed this:
home-assistant/operating-system#3236 (comment)

To my understanding, this means that there is little we can do from the addon side, and they (at the moment) can do little from the HA OS side.

Placing the correct firmware files seems to remain a manual task for the time being.

@dfigus
Would it be feasible that your addon supports this process? E.g., on initiation check if firmware files are available and if the tuner is recongised - and if not, offer the users a box where they could upload the files for the addon to retry initiation. Since I am no programmer, I have no idea if this is possible at all and if you want to try this. It's just a thought.

@dfigus
Copy link
Owner

dfigus commented Mar 15, 2024

@7wells: The ask from the PR is a little different to what you asked for. Some firmware files are already included in the linux kernel and can be freely distributed. To include it into HA OS you just need to enable the config option for it so it's baked into the image. The HA OS colleagues rejected this inclusions as they are running low on space in the rootfs partition.

However the firmware you requested is not part of the linux kernel and hence to include it into HA OS they would need to create a custom buildroot package for this. That's a very big difference.

What I can do is to symlink /share/firmware so that you can drop in there firmware files. Based on my research the firmware should be loaded on demand (when the tuner is accessed the first time) and hence not directly upon boot. Hence I would have thought including the XCx000 firmware in the addon would have solved the issue for @obert0 already - unless there is something that tries to load the firmware before it's accessed the first time when TVH starts in my addon... But as I don't have such a DVB tuner it's impossible to test it on my end. If including it in the addon does not work, then also symlink'ing /share/firmware would not solve it.

@obert0
Copy link
Author

obert0 commented Mar 15, 2024

Hi @dfigus and @7wells,

I don't think it is possible from a addon perspective. The only way the firmware can be manually proposed to the kernel is by adding a line in the kernel boot (cmdline.txt) to consider a custom firmware file path. I don't think a simlink can work either because we can't add or modify the os filesystem to add the simlink even in ssh port 22222.

I try again without luck with the haos new update. Thank you for the downgrade command. I will try to load the last release before 12.0.

At least before the update a have a systematic way to get the firmware load with manual step. I still need to try a hardware methode to automatically replug the tuner.

Thank you guys for your time! I will keep you in touch.

@dfigus
Copy link
Owner

dfigus commented Mar 15, 2024

Thanks for the feedback. I just ordered a WinTV-HVR-935HD which should also require additional firmware based on linuxtv. Let's see whether I can get this running 😀

@obert0
Copy link
Author

obert0 commented Mar 15, 2024

Oh wow! Thank you very much! I am very excited to see if you will face rhe same struggles. Are running haos on pi?

@dfigus
Copy link
Owner

dfigus commented Mar 18, 2024

@obert0 I'm running on RPI 4 and I got the WinTV-HVR-935HD running with the addon. I had to copy the firmware files to the /mnt/data/supervisor/firmware/ and during the reboot if fails initially, but it retries it until it succeeds:

[    4.738730] cx25840 23-0044: Direct firmware load for v4l-cx231xx-avcore-01.fw failed with error -2
[    4.738751] cx25840 23-0044: unable to open firmware v4l-cx231xx-avcore-01.fw
[    5.129902] si2168 27-0064: firmware version: B 4.0.2
[  142.135407] cx25840 23-0044: loaded v4l-cx231xx-avcore-01.fw firmware (16382 bytes)
[  142.412149] si2168 27-0064: firmware version: B 4.0.2
[  161.263968] si2168 27-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
[  162.008298] si2168 27-0064: firmware version: B 4.0.11
[  162.017205] si2157 27-0060: Using ROM firmware.
[  162.066901] si2157 27-0060: firmware version: 3.0.5

The same retry also works when I plugged it in and had no fw files at this location. It kept retrying and once the files were there I picked them up and the adapter was working. I was downloading the files from https://github.com/OpenELEC/dvb-firmware/

I will investigate whether I can do something from the addon.

@obert0
Copy link
Author

obert0 commented Mar 19, 2024

Hi @dfigus,

It was a easy process. It appears that it wasn't the same driver used for your tuner. Did you add the firmware path to cmdline.txt?

@dfigus
Copy link
Owner

dfigus commented Mar 20, 2024

No changes to cmdline.txt. The path /mnt/data/supervisor/firmware/ is symlimk'ed to /lib/firmware/updates which is a default search location for firmwares in linux.

@obert0
Copy link
Author

obert0 commented Mar 20, 2024

Ok I will try to put it there instead. Did the folder firmware was already there?

Copy link

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Apr 20, 2024
@dfigus
Copy link
Owner

dfigus commented Apr 23, 2024

@7wells & @obert0 someone shared a workaround outside of github with me which seems to be persistent across HA OS upgrades:

  1. Create folder in /mnt/boot/ e.g. /mnt/boot/firmware and store the firmware files there.
  2. Add in /mnt/boot/cmdline.txt the firmware_class.path=/mnt/boot/firmware/ (or whatever you chose as the location).
    You need to do this via ssh into the HA OS directly, port 22222

@dfigus dfigus removed the stale There has not been activity on this issue or PR for quite some time. label Apr 23, 2024
@7wells
Copy link

7wells commented Apr 23, 2024

Yes, that must have been myself. 🤣

https://community.home-assistant.io/t/allow-loading-firmware-files-on-boot/632031/18

It had taken me a long time to understand that I had to ssh to the underlying system, hence port 22222.

See also there:
home-assistant/operating-system#1157 (comment)

PS:
Your updated version 5.1.7 runs very nicely - thank you so much, Daniel! ❤️

@obert0
Copy link
Author

obert0 commented Apr 26, 2024

Hi @dfigus, in my initial post I explain this solution. After adding the firmware with this solution I succeed to use the tuner with tvheadend. But still I had to make some manipulation to make the driver load the firmware.

For the moment I switch to another project, but soon I will try again to make this work.

@dfigus
Copy link
Owner

dfigus commented Apr 26, 2024

@obert0 That is not exactly what you wrote in your first post:

I enter in the HAOS in SSH to the port 22222 and add "firmware_class.path=/mnt/data/supervisor/share/firmware" in "/mnt/boot/cmdline.txt". I download the firmware and put it in "/share/firmware" with the ssh addon. Now on HAOS startup, the firmware is in place and TvHeadend start on boot. After boot I can't see the tuner in TvHeadend. This is the Kernel logs:

The important part here is that /mnt/data/ is not available during the early stage of the boot, however /mnt/boot/ is. Did you try to put the firmware into /mnt/boot/?

@obert0
Copy link
Author

obert0 commented May 1, 2024

Hi @dfigus , I put the firmware into /mnt/boot/firmware and change cmdline.txt. But no success to get the tuner visible in TvHeadend... I use the last version 5.1.9 of your addon. But with this new position I can't move the firmware from HA to use my last fix.

I will get more time to make this work. My next step is to downgrade HAOS to version <12. I keep you inform.
I also consider to just change my tuner. Did you recommend the one that you buy?

Thank you!

@obert0
Copy link
Author

obert0 commented May 2, 2024

I roll back to HAOS 11.5 and I can reproduce the same behaviour from my original post.
I think version 12+ change something in the usb that doesn't match my setup. I will keep try new update if it work, but I will stay on 11.5 until I found a fix. I found today that haos as dual boot for safe update that ease this step!

@dfigus
Copy link
Owner

dfigus commented May 5, 2024

My TV tuner WinTV-HVR-935HD works, but I don't really use it. I still use SATIP with my FritzBox tuners. In generell you need to make your TV tuner work with HA OS, afterwards it will also work with the addon - that's the general rule. In case HA OS 12+ does not work anymore, I would propose to open an issue to HA OS. As I can't really do anything more from the addon, I would close this issue and convert it to a discussion. There you can report your progress for others to read.

Repository owner locked and limited conversation to collaborators May 5, 2024
@dfigus dfigus converted this issue into discussion #180 May 5, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants