Tvheadend server

Is there any way to set up a tvheadend server on a box with a dvb-s2 interface? Am I correct in thinking that tvheadend incorporates a web gui for configuration purposes?
Well I finally got somewhere with a FreeBSD tuner and cx88 driver/port on DVICO Fusion HDTV7 dual express
root@TV:~ # w_scan -c US
w_scan -c US
w_scan version 20170107 (compiled for DVB API 5.10)
using settings for UNITED STATES
scan type TERRCABLE_ATSC, channellist 1
output format vdr-2.0
WARNING: could not guess your codepage. Falling back to 'UTF-8'
output charset 'UTF-8', use -C <charset> to override
Info: using DVB adapter auto detection.
   /dev/dvb/adapter0/frontend0 -> TERRCABLE_ATSC "Fusion 7 Dual Express tuner #2": good :-)
   /dev/dvb/adapter1/frontend0 -> TERRCABLE_ATSC "Fusion 7 Dual Express tuner #1": good :-)
Using TERRCABLE_ATSC frontend (adapter /dev/dvb/adapter0/frontend0)
-_-_-_-_ Getting frontend capabilities-_-_-_-_
Using DVB API 5.5
frontend 'Fusion 7 Dual Express tuner #2' supports
FREQ (54.00MHz ... 890.00MHz)
57000: 8VSB(time: 00:00.122)
63000: 8VSB(time: 00:03.167)
69000: 8VSB(time: 00:06.196)
79000: 8VSB(time: 00:09.223)
85000: 8VSB(time: 00:12.231)
tune to: 8VSB     f=575000 kHz (0:0:0) (time: 03:36.806)
service is running. Channel number: 10:1. Name: 'WAVY'
service is running. Channel number: 10:2. Name: 'Bounce'
service is running. Channel number: 10:3. Name: 'GET-TV'
tune to: 8VSB     f=581000 kHz (0:0:0) (time: 03:38.909)
        Info: no data from PAT after 2 seconds
        Info: no data from VCT(terr) after 6 seconds
tune to: 8VSB     f=587000 kHz (0:0:0) (time: 03:45.811)
WARNING: received garbage data: crc = 0xb4bba7a6; expected crc = 0x26c0ecd7
increasing filter timeout to 35 secs (pid:8187 table_id:200 table_id_ext:-1).
WARNING: received garbage data: crc = 0x5bcb7400; expected crc = 0xd11178f7
increasing filter timeout to 31 secs (pid:64 table_id:2 table_id_ext:-1).
service is running. Channel number: 33:1. Name: 'WTVZ-HD'
service is running. Channel number: 33:2. Name: 'ASN'
service is running. Channel number: 33:3. Name: 'Comet'
service is running. Channel number: 33:4. Name: 'TBD-TV'
tune to: 8VSB     f=593000 kHz (0:0:0) (time: 03:48.182)
        Info: no data from PAT after 2 seconds
        Info: no data from VCT(terr) after 6 seconds
(time: 03:54.879) dumping lists (16 services)

Done, scan time: 03:54.879
So now its time for tvheadend to see what works.
Trying to build an APU2 headless tvheadend server.
I had to do some twisted things for tuner firmware.(Which I found nowhere online)
hint=It uses this directory for firmware: /usr/local/share/libtuner/
I will write it up when I redo this setup on APU2
Shoot i spent 2 hours trying to find the tvheadend web frontend username and password.
Turns out you need to start tvheadend with the -C option flag on the first run.
This allows the configure screen to come up and you can make your user then.
It installed fine for me, in fact I have never had an issue getting this to go. Will be nice to see someone getting a tuner card to work. Would be nice to see some tuner card manufactures releasing native FreeBSD code/drivers to get put into the ports tree system.
I did a make config and modify the options (turned on HDHomeRun support), and then used ports-mgmt/synth. I didn't watch the screen but yeah pretty sure Synth compiled it (into its own pkg), since I modified options thus can't use stock pkg from repository.
Did you need to make any changes to multimedia/tvheadend to make it work?
No I installed from packages.

Yes, tvheadend has a web gui, you also do configuration there.
I am not arguing this point but realistically if it don't work with w_scan it will not work with the GUI.

Figuring out the proper firmware location was the hardest part.
Also the cx88 Wiki is down so I had to use the wayback machine and google cache.

So for ATSC with cx88 driver there are 3 models that work. Hauppauge HVR-1800, HVR-1850 and Fusion HDTV7 Dual Express.
I could only get the latter working as my HVR-1800 was giving me trouble.
I got my Hauppauge HVR-1800 working tonight.
I only have a small telescoping antenna right now. Here is tvheadend on FreeBSD and my Over-the-Air EPG.
I have an HP ExpressCard DVB-T TV Tuner which FreeBSD identifies as <Digital TV Yuan> and usbconfig shows as
ugen1.4 <Digital TV Yuan> at usbus1

Do I need to do anything within FreeBSD to try and make it work with tvheadend or should tvheadend automatically pick it up?
I just ran pkg install tvheadend but got a number of errors trying to install it:-
Creating user 'tvheadend' with uid '984'
pw: user 'tvheadend' disappeared during update
install: unknown user 'tvheadend'
pkg: PRE-INSTALL script failed

# tvheadend
tvheadend: Command not found.

I'm running FreeBSD 11.0-RELEASE-p8 i386

What have I overlooked?
Do I need to do anything within FreeBSD to try and make it work with tvheadend or should tvheadend automatically pick it up?
Yes you need to setup webcamd.
Let me reiterate. tvheadend does nothing to help you. Forget it exists. First you must get the device recognized by FreeBSD.
This includes the /dev/dvb node which is created by the driver subsystem when all is right.
That was why I recommend you get it where w_scan can scan the tuner. It is the best indicator of correct setup including the proper firmware.
Then worry about apps like tvheadend. It is just a fluffy frontend to v4l devices. It will configure nothing.

I suggest you start at Linux since FreeBSD is using the v4l stack. Figure out the deets there and work back.
I say that because all the firmware stuff comes from the LinuxTV project.

Sweet. Did you have to do any secret saucing to get that card to work, or does it work out of the box as is? I wonder how some of their newer cards work with FreeBSD?
I can only speak to cx88 devices. It seems their list is quite accurate and all the listed cards actually work.
The author of cx88 is a nice guy and kicked the wiki to get it back up so there is loads of info there.
This gives a quick summary of what is needed to load. I did not use kldload like that but used loader.conf instead.
My pkg command:
pkg install cx88 w_scan v4l_compat libv4l
I moved over to the APU3 i want to use for this.
root@TV:~ # kldload cuse
root@TV:~ # kldload cx23885
root@TV:~ # kldload cx23885avfw
root@TV:~ # service cx88d start
Starting cx88d.
root@TV:~ # cx88
[cx88 2017-10-31 17:57:45] Error: You must specify a device (-d); Available devices:
Digital video:
   /dev/cx88mpeg0: WinTV HVR-1800
Analog video:
   (No devices found)
Analog audio:
   /dev/cx88audio0: WinTV HVR-1800
   /dev/cx88audio1: WinTV HVR-1800
root@TV:~ # ls /dev/dvb
root@TV:~ # ls /dev/dvb/adapter0
demux0       dvr0       frontend0

Note: There is no firmware needed for cx88. I am still learning.....
The cx88 driver provides its own interface.
root@TV:~ # cx88 -d /dev/cx88mpeg0
Welcome to the cx88 capture app.  Enter '?' for a list of commands.
> i
Driver stopped.
Channel: fox
   No signal
   /dev/cx88mpeg0 (WinTV HVR-1800)
Input source:

> h
[cx88 2017-10-31 18:03:39] Driver started.
> [libtuner 2017-10-31 18:03:40] CX24227: demodulator not locked
[cx88 2017-10-31 18:03:40] Error starting frontend device

> s
Scanning profile USA . . . . . . . . . . . . . . 16 (87.013%) . . . . . . . . . . . . . . 31 (79.7619%) . 33 (84.9567%) . . . . . . 40 (86.9048%) . . . . . 46 (75.6494%) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Finished scan.
> [libtuner 2017-10-31 18:06:46] CX24227: demodulator not locked
[cx88 2017-10-31 18:06:46] Error starting frontend device
[cx88 2017-10-31 18:06:53] Driver stopped.
> h
[cx88 2017-10-31 18:06:56] Driver started.
> [libtuner 2017-10-31 18:06:57] CX24227: demodulator not locked
[cx88 2017-10-31 18:06:57] Error starting frontend device
Interactive commands:
c <channel> [<timeout>]       Change channel, optionally specifying lock timeout in ms
s [<strength%> [<timeout>]]   Scan for channels with at least the specified signal strength (0-100)
i                             Get current tuning information
h                             Toggle start/stop of all captures
+ <URL> [<minutes>]           Add a capture using the specified URL, with an optional time limit
- <number>                    Remove capture by index (use 'i' to get indexed capture list)
r [<minutes>]                 Toggle start/stop of recording to default recording file
n [<source>]                  Change the active input source, or list available sources
p [<port>]                    Set remote control port (0 => auto), or display list of remote connections
p-                            Disable remote control
t [<minutes>]                 Set program timer (0 => disable), or display remaining time
t <minutes> <capture #>       Set the timer for the given capture number (0 => disable)
ver                           Display version
q                             Quit app(interactive), or close session(remote)
q!                            Quit app(both interactive and remote)
b                             Toggle between backend and normal capture modes
psi                           Enable/disable MPEG stream parsing
cx88_mpeg_capture <json>      Display/modify the capture ioctl params sent to the driver (use with caution!)
cx88_mpeg_config <json>       Display/modify the buffer configuration params sent to the driver (use with caution!)

Capture URLs:
file://                       Append to file (e.g. file:///home/user/capture.m2t)
oss://                        Output to OSS audio device (e.g. oss:///dev/dsp0)
tcp://                        Output to TCP client socket (e.g. tcp://localhost:8802)
udp://                        Output to UDP port (e.g. udp://localhost:8802)
dvb://                        Create Linux DVB device nodes (e.g. dvb://adapter0)
radio://                      Create Linux V4L2 radio device nodes (e.g. radio://radio0)
rec://                        Overwrite file (e.g. rec:///home/user/capture.m2t)

tvheadend setup on the APU3. Glad to see it is working well. Still need to try recording video and scheduling. Also LiveTV does not work right.
Seems that my HP ExpressCard DVB-T TV Tuner aka Yuan Digital TV doesn't show up in any lists... although I also have an ITE Technologies USB device which is mentioned here:- which
Requires firmware dvb-usb-it9135-01.fw; dual tuner, second tuner now tested and seems to be working, remote not working...

Not sure how to proceed.... I ran pkg install w_scan

w_scan -c GB:-
Please check wether dvb driver is loaded and
verify that no dvb application (i.e. vdr) is running.

Do I need anything in loader.conf or rc.conf

So what this means is you must get your device loaded correctly with webcamd before w_scan.
If you device is not listed on LinuxTV then I doubt it will work.

After much experimenting I have found a webcamd which works with my card....

It wouldn't work with the PKG but building from ports created something which recognised my device. The ports version built whereas the PKG version is I'm not sure how this happened... maybe I had an out of date ports tree....
/etc/rc.conf contains:

tvheadend_flags="--noacl -l"

When booting, the system starts up tvheadend during the boot process with tvheadend in foreground and stays there not allowing other processes such as sshd or login to start.

What to do?