operating-system icon indicating copy to clipboard operation
operating-system copied to clipboard

add fw for dvb tuner

Open luci-11 opened this issue 4 years ago • 40 comments
trafficstars

I'm trying to modify an existing addon for tvheadend in order to make it compatible with an usb tuner I have at home (MyGica T230C v2) . The tuner is recognized from tvheadend cofiguration panel but cannot get any channles. Dmesg confirms USB is recognized properly but I have: Direct firmware load for dvb-demod-si2168-d60-01.fw failed with error -2 Same for dvb-tuner-si2141-a10-01.fw

Tried tvheadend on raspbian adding these two files manually as written here https://www.linuxtv.org/wiki/index.php/Geniatech_T230C and everything works.

Could you please add them to /lib/firmware for hassos build? files are here: t230C.v2-fw Thanks a lot.

luci-11 avatar Jan 05 '21 12:01 luci-11

It seems that this firmware is not available from the linux-firmware git tree. This would mean I need to create a separate buildroot package and all that, which is a bit much. Also, I am not sure about the license. Usually there is a reason if something doesn't find its way into linux-firmware.

agners avatar Jan 11 '21 09:01 agners

Could you add a mount point to /usr/lib/firmware which is writable for the users, instead of creating a seperate buildroot package, to allow adding fw files by the user itself?

admin-lm avatar Jan 11 '21 09:01 admin-lm

@admin-lm the problem is we already ship firmware with the OS today. So we would have to do it in such a way that we can still ship firmware with the OS, e.g. an overlay or something. The question then is how do we make it accessible exactly, e.g. via container from supervisor?

agners avatar Jan 11 '21 10:01 agners

It seems that this firmware is not available from the linux-firmware git tree. This would mean I need to create a separate buildroot package and all that, which is a bit much. Also, I am not sure about the license. Usually there is a reason if something doesn't find its way into linux-firmware.

MMM ..Strange story. For licence, I think they were created using CrazyCat's media_build tool that is mentioned in the Linux page liked above. He is the owner also for the added support in linux kernel Si2168-D60 support . Commits are also there linux-next . In fact adding just the two fw does the job in Raspbian OS.. Strange

But I completely understand your point.

That's why being able to add them by ourselves could be the best way for future (less work for you, If we create mess, it's our problem :) ) But I really don't know how to help tecnically.

luci-11 avatar Jan 11 '21 10:01 luci-11

I think an overlay for /lib/firmware helps, devices could be made accessible via portainer; /dev/dvb:/dev/dvb

admin-lm avatar Jan 11 '21 10:01 admin-lm

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 12 '21 09:05 stale[bot]

hi, how exactly did you solve this problem? how to create an overlay for /lib/firmware? by adding

devices: - /dev/dvb:/dev/dvb

I get the TV tuner in the container but unfortunately I don't understand how to add the firmware 🥲

Billiadis avatar Sep 27 '22 00:09 Billiadis

Hi! I also would like to place 3 necessary files under /lib/firmware (for an AverMedia TD310 DVB-C/T/T2 USB stick). It works like a charm on plain Tvheadend on Raspberry Pi OS, but how on HAOS?

7wells avatar Oct 03 '22 06:10 7wells

Would it help to have CONFIG_DVB_USB=m added to device-support.config ? This has been done but reverted previously #609

weidi avatar Nov 14 '22 20:11 weidi

I just found a viable solution to the custom firmware issue for my USB DVB Tuner I was trying to attach to my HAOS setup.

There are actually multiple firmware search paths the kernel uses to find firmware files to upload to the device.

There is even a option to specify a custom search path, which is what I utilized. The path can be specified using a kernel boot parameter. I my case I placed the firmware files in the /share folder exposed to the supervisor, specifically /share/firmware. Within the underlying operating system the path translates to /mnt/data/supervisor/share/firmware. This path is what is need for the kernel parameter. firmware_class.path=/mnt/data/supervisor/share/firmware/ must be added to cmdline.txt on the PI SD card. On the next boot the HAOS will happily load the firmware from the specified location.

@agners I am not sure if the usecase of user specific device firmware is relevant enough to establish a more streamlined solution. The built-in the firmware search paths could be utilized for this. If I understand correctly e.g ‘/lib/firmware/updates/’ could be symlinked\bind mounted to some writeable location within HAOS. If this location would then be exposed to the supervisor there would be a working solution. This should also not interfere with the firmware currently shipped with HAOS.

HahnBenjamin avatar Jan 08 '23 00:01 HahnBenjamin

I just found a viable solution to the custom firmware issue for my USB DVB Tuner I was trying to attach to my HAOS setup.

There are actually multiple firmware search paths the kernel uses to find firmware files to upload to the device.

There is even a option to specify a custom search path, which is what I utilized. The path can be specified using a kernel boot parameter. I my case I placed the firmware files in the /share folder exposed to the supervisor, specifically /share/firmware. Within the underlying operating system the path translates to /mnt/data/supervisor/share/firmware. This path is what is need for the kernel parameter. firmware_class.path=/mnt/data/supervisor/share/firmware/ must be added to cmdline.txt on the PI SD card. On the next boot the HAOS will happily load the firmware from the specified location.

@agners I am not sure if the usecase of user specific device firmware is relevant enough to establish a more streamlined solution. The built-in the firmware search paths could be utilized for this. If I understand correctly e.g ‘/lib/firmware/updates/’ could be symlinked\bind mounted to some writeable location within HAOS. If this location would then be exposed to the supervisor there would be a working solution. This should also not interfere with the firmware currently shipped with HAOS.

Your solution worked, but only after manually reloading the dvb-usb module after each reboot, otherwise the problem persists. Any idea on how to automate this? HAOS doesn't allow automatically running scripts with root permissions AFAIK

thatsthat avatar Mar 16 '23 09:03 thatsthat

Is there any progress about this issue?

I also would like to add some firmware files for TVHeadend on my Home Assistant:

# How to download AverMedia TD310 (DVB-C/T/T2 USB stick) firmware files (used on Raspberry Pi 4 Model B)
#
sudo wget https://github.com/OpenELEC/dvb-firmware/raw/master/firmware/dvb-usb-it9303-01.fw -O /lib/firmware/dvb-usb-it9303-01.fw
sudo wget https://github.com/OpenELEC/dvb-firmware/raw/master/firmware/dvb-demod-si2168-02.fw -O /lib/firmware/dvb-demod-si2168-02.fw
sudo wget https://github.com/OpenELEC/dvb-firmware/raw/master/firmware/dvb-demod-si2168-b40-01.fw -O /lib/firmware/dvb-demod-si2168-b40-01.fw

I saved the files under /lib/firmware/ as indicated above, but after restarting the system, the /lib/firmware/ folder is empty.

It would be great to make this possible. Thank you!

PS1: Rebooting the system seems to delete these files, whereas restarting Home Assistant keeps them.

PS2: Does this help? https://github.com/home-assistant/operating-system/issues/2222#issuecomment-1308959053 A permanent solution to be able to have drivers stored in /lib/firmware would be great.

7wells avatar Mar 26 '23 09:03 7wells

Is there any progress about this issue?

I also would like to add some firmware files for TVHeadend on my Home Assistant:

# How to download AverMedia TD310 (DVB-C/T/T2 USB stick) firmware files (used on Raspberry Pi 4 Model B)
#
sudo wget https://github.com/OpenELEC/dvb-firmware/raw/master/firmware/dvb-usb-it9303-01.fw -O /lib/firmware/dvb-usb-it9303-01.fw
sudo wget https://github.com/OpenELEC/dvb-firmware/raw/master/firmware/dvb-demod-si2168-02.fw -O /lib/firmware/dvb-demod-si2168-02.fw
sudo wget https://github.com/OpenELEC/dvb-firmware/raw/master/firmware/dvb-demod-si2168-b40-01.fw -O /lib/firmware/dvb-demod-si2168-b40-01.fw

I saved the files under /lib/firmware/ as indicated above, but after restarting the system, the /lib/firmware/ folder is empty.

It would be great to make this possible. Thank you!

PS1: Rebooting the system seems to delete these files, whereas restarting Home Assistant keeps them.

PS2: Does this help? #2222 (comment) A permanent solution to be able to have drivers stored in /lib/firmware would be great.

There is already a solution (I can confirm it works):

I just found a viable solution to the custom firmware issue for my USB DVB Tuner I was trying to attach to my HAOS setup.

There are actually multiple firmware search paths the kernel uses to find firmware files to upload to the device.

There is even a option to specify a custom search path, which is what I utilized. The path can be specified using a kernel boot parameter. I my case I placed the firmware files in the /share folder exposed to the supervisor, specifically /share/firmware. Within the underlying operating system the path translates to /mnt/data/supervisor/share/firmware. This path is what is need for the kernel parameter. firmware_class.path=/mnt/data/supervisor/share/firmware/ must be added to cmdline.txt on the PI SD card. On the next boot the HAOS will happily load the firmware from the specified location.

@agners I am not sure if the usecase of user specific device firmware is relevant enough to establish a more streamlined solution. The built-in the firmware search paths could be utilized for this. If I understand correctly e.g ‘/lib/firmware/updates/’ could be symlinked\bind mounted to some writeable location within HAOS. If this location would then be exposed to the supervisor there would be a working solution. This should also not interfere with the firmware currently shipped with HAOS.

thatsthat avatar Mar 27 '23 10:03 thatsthat

@agners I am not sure if the usecase of user specific device firmware is relevant enough to establish a more streamlined solution. The built-in the firmware search paths could be utilized for this. If I understand correctly e.g ‘/lib/firmware/updates/’ could be symlinked\bind mounted to some writeable location within HAOS. If this location would then be exposed to the supervisor there would be a working solution. This should also not interfere with the firmware currently shipped with HAOS.

Yes, that is what https://github.com/home-assistant/operating-system/pull/2225 proposes, and it got merged now for OS 10. The directory /mnt/data/supervisor/firmware is not accessible by default from within Home Assistant Core/Add-ons. The plan is to have APIs in Supervisor which allows to manage firmwares.

agners avatar Mar 27 '23 14:03 agners

But the kernel can be instructed to get the firmware from any folder accessible to addons (e.g. under /mnt/data/supervisor/share)

On Mon, Mar 27, 2023, 16:33 Stefan Agner @.***> wrote:

@agners https://github.com/agners I am not sure if the usecase of user specific device firmware is relevant enough to establish a more streamlined solution. The built-in the firmware search paths could be utilized for this. If I understand correctly e.g ‘/lib/firmware/updates/’ could be symlinked\bind mounted to some writeable location within HAOS. If this location would then be exposed to the supervisor there would be a working solution. This should also not interfere with the firmware currently shipped with HAOS.

Yes, that is what #2225 https://github.com/home-assistant/operating-system/pull/2225 proposes, and it got merged now for OS 10. The directory /mnt/data/supervisor/firmware is not accessible by default from within Home Assistant Core/Add-ons. The plan is to have APIs in Supervisor which allows to manage firmwares.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/operating-system/issues/1157#issuecomment-1485226513, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECUL5GTHONYXTBMA3YJCU3W6GQMPANCNFSM4VU7W7IQ . You are receiving this because you commented.Message ID: @.***>

thatsthat avatar Mar 27 '23 14:03 thatsthat

But the kernel can be instructed to get the firmware from any folder accessible to addons (e.g. under /mnt/data/supervisor/share)

Yes. With the chosen solution this option is still available to you. :man_shrugging:

agners avatar Mar 27 '23 14:03 agners

Please forgive me, guys, but I am not such an expert and still unsure what this now means for me. After I updated to the latest HA version, what do I have to do to permanently store drivers/firmware files, i.e. where should I store them? Thanks for your patience and advice! :)

7wells avatar Mar 30 '23 15:03 7wells

You need to follow the instructions given by HahnBenjamin (posted January 8th)

On Thu, Mar 30, 2023, 17:10 7wells @.***> wrote:

Please forgive me, guys, but I am not such an expert and still unsure what this now means for me. After I updated to the latest HA version, what do I have to do to permanently store drivers/firmware files, i.e. where should I store them? Thanks for your patience and advice! :)

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/operating-system/issues/1157#issuecomment-1490478309, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECUL5CZDSFC23VAYFHGMHLW6WO73ANCNFSM4VU7W7IQ . You are receiving this because you commented.Message ID: @.***>

thatsthat avatar Mar 31 '23 06:03 thatsthat

I.e., this is all that's needed?

firmware_class.path=/mnt/data/supervisor/share/firmware/ must be added to cmdline.txt on the PI SD card. On the next boot the HAOS will happily load the firmware from the specified location.

😎

7wells avatar Apr 01 '23 10:04 7wells

Yes, assuming you copied your firmware files into that folder

On Sat, Apr 1, 2023, 12:15 7wells @.***> wrote:

I.e., this is all that's needed?

firmware_class.path=/mnt/data/supervisor/share/firmware/ must be added to cmdline.txt on the PI SD card. On the next boot the HAOS will happily load the firmware from the specified location.

😎

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/operating-system/issues/1157#issuecomment-1492914896, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECUL5HJD5BUDFZRGGI4K33W67533ANCNFSM4VU7W7IQ . You are receiving this because you commented.Message ID: @.***>

thatsthat avatar Apr 01 '23 15:04 thatsthat

I just flashed the HAOS image for the RPi 4 fresh to a nano SD card and opened cmdline.txt in an editor that shows just this one line: dwc_otg.lpm_enable=0 console=tty1 usb-storage.quirks=174c:55aa:u,2109:0715:u,152d:0578:u,152d:0579:u,152d:1561:u,174c:0829:u,14b0:0206:u

Can I simply append the path, so the cmdline.txt afterwards looks as follows, i.e. just a blank between "u" and "firmware_class.path" etc.? (still one line) dwc_otg.lpm_enable=0 console=tty1 usb-storage.quirks=174c:55aa:u,2109:0715:u,152d:0578:u,152d:0579:u,152d:1561:u,174c:0829:u,14b0:0206:u firmware_class.path=/mnt/data/supervisor/share/firmware/

Thank you! 😃

7wells avatar Apr 01 '23 16:04 7wells

Yes, it must remain one line, with spaces between different commands, it's also important that you use a pure text editor (like notepad++ on windows)

On Sat, Apr 1, 2023, 18:25 7wells @.***> wrote:

I just flashed the HAOS image for the RPi 4 https://github.com/home-assistant/operating-system/releases/download/9.5/haos_rpi4-64-9.5.img.xz fresh to a nano SD card and opened cmdline.txt in an editor that shows just this one line: dwc_otg.lpm_enable=0 console=tty1 usb-storage.quirks=174c:55aa:u,2109:0715:u,152d:0578:u,152d:0579:u,152d:1561:u,174c:0829:u,14b0:0206:u

Can I simply append the path, so the cmdline.txt afterwards looks as follows, i.e. just a blank between "u" and "firmware_class.path" etc.? (still one line) dwc_otg.lpm_enable=0 console=tty1 usb-storage.quirks=174c:55aa:u,2109:0715:u,152d:0578:u,152d:0579:u,152d:1561:u,174c:0829:u,14b0:0206:u firmware_class.path=/mnt/data/supervisor/share/firmware/

Thank you! 😃

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/operating-system/issues/1157#issuecomment-1493038061, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECUL5GELSFRNK2PMZDZPR3W7BJJHANCNFSM4VU7W7IQ . You are receiving this because you commented.Message ID: @.***>

thatsthat avatar Apr 01 '23 19:04 thatsthat

@thatsthat Sorry for my very late reply (I was distracted by other stuff 😊)! I don't have this path: /mnt/data/supervisor/share/firmware/

There's /mnt but it's empty. What have I missed?

7wells avatar May 18 '23 06:05 7wells

@agners @HahnBenjamin I don't have this path: /mnt/data/supervisor/share/firmware/

There's /mnt but it's empty. What have I missed?

PS: I have asked also in the HA community: https://community.home-assistant.io/t/how-to-use-firmware-search-path-e-g-mnt-data-supervisor-share-firmware/573387

7wells avatar May 19 '23 15:05 7wells

Hello! Is there really nobody with a hint for me?

7wells avatar May 26 '23 13:05 7wells

I switched to Home Assistant Supervised

admin-lm avatar May 26 '23 20:05 admin-lm

Sorry, I don't understand. what you mean.

I use this:

Home Assistant 2023.5.4 Supervisor 2023.04.1 Operating System 10.1 Frontend 20230503.3 - latest

7wells avatar May 27 '23 20:05 7wells

Has really nobody a hint for my question?

7wells avatar Jun 02 '23 11:06 7wells

Really sad :(

7wells avatar Jul 16 '23 19:07 7wells

This is an issue tracker and not a support forum. I've responded to your community post.

agners avatar Jul 17 '23 09:07 agners