# PCI-E Tuner and MythTV



## danaeckel (Feb 27, 2013)

I was thinking about building a PVR into my FreeBSD server. I was thinking of getting a Hauppauge HVR-2250 PCI-E tuner card. I have found very little documentation on those who use this card on their systems. I am wondering if anybody has tried to use a PCI-E tuner and what their success was.

Thank You!
Dana


----------



## nox@ (Mar 19, 2013)

danaeckel said:
			
		

> I was thinking about building a PVR into my FreeBSD server. I was thinking of getting a Hauppauge HVR-2250 PCI-E tuner card. I have found very little documentation on those who use this card on their systems. I am wondering if anybody has tried to use a PCI-E tuner and what their success was.
> 
> Thank You!
> Dana


Hm, that tuner is not mentioned in multimedia/cx88's list of supported cards (http://corona.homeunix.net/cx88wiki/Overview/SupportedCards), I suppose you're better off using a USB tuner supported by multimedia/webcamd.  See also http://forums.freebsd.org/showthread.php?t=35179 and https://wiki.freebsd.org/WebcamCompat.

HTH, 
Juergen


----------



## danaeckel (Mar 28, 2013)

Ok, well here is the latest on this project.

I traded my 2250 card for a Hauppauge WinTV-HVR-1850 PCI-E. I got the CX88 driver, and now in /dev I have the following drvices added: cx88audio0, cx88mpegaudio1 cx88mpeg0 cx23885b0. So the good news is the kernel is able to see the card I have the TV card installed. However the bad news I am unable to get Myth to probe the card. Is there another software layer I need to install, or something else I need to load?

Thank you!

Dana


----------



## nox@ (Apr 3, 2013)

Yeah I think you need to make sure cuse4bsd.ko is loaded and set 
	
	



```
cx88d_enable="YES"
```
 in /etc/rc.conf and then either reboot or do

`# service cx88d start`

so that cx88d can provide your /dev/dvb nodes...

HTH, 
Juergen


----------



## danaeckel (Apr 9, 2013)

Well, I followed your instructions to the T, but no results. First my loader.conf looks like this:

```
cuse4bsd_load="YES"
cx23885avfw_load="YES" 
cx23885_load="YES"
```
Next I did add cx88d in rc.conf rebooted, and nothing showed in the screen to signal it was loading. I also `service cx88d onestart` with the result of 
	
	



```
Starting cx88d.
```
However just playing around if I enter in [cmd=]cx88 -d /dev/cx88mpeg0 -u dvb://adapter1[/cmd] I do get my /dev nodes, and also greeted with the following:


```
> [libtuner] S5H1411: demodulator not locked
[cx88 2013-04-08 21:31:59] Error starting peripheral device
[cx88 2013-04-08 21:33:02] Nonfatal error: Capture timed out
```

If I launch the Myth backend I can probe and detect the proper card in dvb/adapter/frontend0, however I can't scan channels. I have no clue at this point if I am inching in the right direction or heading down dead ends. I would love to get a TV flicker for a glimmer of hope.

Dana


----------



## nox@ (Apr 10, 2013)

Hmm.  I think you'll have to email the multimedia/cx88 port maintainer, jason.harmening@gmail.com with a link to this thread.

Sorry...
Juergen


----------



## danaeckel (May 4, 2013)

Well I revisited this, and I managed to get the digital stations to scan in. I did some updates, changed some setting issues with Myth and now I have digital cable. However I don't know how to access the analog tuner. I tried pointing the MPEG as well as Video for L setup to /dev/cx88mpeg0 and cx23885b0, no success. Which driver should I be working with for analog tuner?

Also how can I get the following line to run at boot?
`cx88 -d /dev/cx88mpeg0 -u [url=dvb://adapter1]dvb://adapter1[/url]`

It is the only way I can get the dvb node to show up in /dev. I managed to get it to load, but then drops right into the cx88 prompt, and that down't work well when I want to log into my system.

Than you one again. One way or another I am determined to make this work.

Dana


----------



## fonz (May 4, 2013)

danaeckel said:
			
		

> Also how can I get the following line to run at boot?
> `cx88 -d /dev/cx88mpeg0 -u [url=dvb://adapter1]dvb://adapter1[/url]`


Either put it in /etc/rc.local or write an rc(8)-script and put it in /usr/local/etc/rc.d. The latter is the recommended way, but the former is still supported and probably easier.


----------



## danaeckel (May 5, 2013)

Ok, I was playing around with it some more, and now I believe the problem is with the cx88d script located in /usr/local/etc/rc.d. In a previous post I posted during boot I have cx88d_enable located in rc.conf, and acted like nothing existed. If I enter `cx88d` I get a "Command not found." error. However if I enter in `./cx88d onestart` everything mounts, loads as it should. I can't locate why it doesn't load during boot as it should, and this is what the code for the script looks like.

```
#!/bin/sh

. /etc/rc.subr

name="cx88d"
rcvar=cx88d_enable
pidfile="/var/run/cx88d.pid"
procname="cx88"
command="/usr/sbin/daemon"
_cx88_command="cx88 ${cx88d_flags} -p 0 -q -h"
cx88d_flags="-fp ${pidfile} ${_cx88_command}"

[ -z "$cx88d_enable" ] && cx88d_enable="NO"

case $1 in
   *showports)
      ;;
   *)
      if [ -n "$2" ]; then
         devnode="$2"
         pidfile="/var/run/cx88d.${devnode}.pid"
         cx88d_flags="-fp ${pidfile} ${_cx88_command} -d /dev/${devnode}"
         if [ `echo ${devnode} | cut -c -8` = "cx88mpeg" ]; then
            cx88d_flags="${cx88d_flags} -u dvb://"
         fi
      else
         if [ -z "${cx88d_devs}" ]; then
            cx88d_devs=`ls /dev/cx88mpeg* | cut -c 6-`
         fi
         for devnode in ${cx88d_devs}; do
            /usr/local/etc/rc.d/cx88d $1 ${devnode}
         done
         exit 0
      fi
      ;;
esac

cx88d_showports() {
   printf "PORT\tCMMMAND\n"
   sockstat -l -P tcp | grep cx88 | while read line; do
      command=""
      port=""
      for field in $line; do
         if [ `expr "$field" : "[0-9]*"` -gt 0 -a "$command" = "" ]; then
            command=`ps -o command= -p $field`
         elif [ `expr "$field" : "\*:[0-9]*"` -gt 2 -a "$port" = "" ]; then
            port=`echo $field | cut -c 3-`
         fi
      done
      printf "$port\t$command\n"
   done
}

extra_commands="showports"
showports_cmd="cx88d_showports"
run_rc_command "$1"
```
Could somebody help me with why this script is the cause of my problems?

Dana


----------



## fonz (May 5, 2013)

For starters, can you verify whether the script is actually called during boot? For example, put an echo command somewhere near the beginning and observe whether it shows up during boot. If it does, we know it's a problem with the script itself. It it doesn't, we know the script isn't even run at boot in the first place.


----------



## danaeckel (May 6, 2013)

Yes, I inserted 
	
	



```
echo hello
```
 and it displayed. Which tells me it is about permissions. Any thoughts about which file/folder needs to be relaxed a bit?

Dana


----------



## fonz (May 6, 2013)

Are you getting any error messages? Moreover, does using full paths help?


----------



## danaeckel (May 6, 2013)

Since I inserted the `echo hello` command, it will display starting cx88, which it didn't do before, no error messages, and no created nodes. If I am logged in and do `./cx88 onestart` my nodes are created.

I'm not sure what you mean by "full paths".


----------



## fonz (May 6, 2013)

danaeckel said:
			
		

> I'm not sure what you mean by "full paths".


Instead of using "just" the command `cx88`, use `/usr/local/bin/cx88` (or wherever the cx88 command is located).


----------



## danaeckel (May 7, 2013)

*O*k, the following will work*:* `/usr/local/etc/rc.d/cx88d onestart`.

If I take onestart off, then it will fail.

Dana


----------



## tingo (May 9, 2013)

What does the cx88d_enable line look like in your /etc/rc.conf? It should look like this: 
	
	



```
cx88d_enable="YES"
```


----------



## danaeckel (May 10, 2013)

Yes, that is exactly what it looks like.

Dana


----------



## tingo (May 12, 2013)

Then please check it again, and then one more time. If onestart works, but not start it is a sure sign that something is wrong in your /etc/rc.conf file.


----------

