# em28xx



## balanga (Feb 28, 2018)

According to FreeBSD's Webcam and DVB Compatibility List  I need to use something called em28xx to be able to use my PCTV USB DVB-S2 stick as well as something called tda10071 and firmware dvb-fe-tda10071.fw. 


```
External USB DVB-S/S2 adapter

PCTV Systems

PCTV DVB-S2 Stick 460e (identifies as "PCTV Systems" "PCTV 460e")

0x2013:0x024c

webcamd(8) via em28xx(4)

DVB

FreeBSD 9.0

vlc (currently only DVB-S), w_scan

Requires webcamd >= 3.1.0.4 and tda10071 firmware dvb-fe-tda10071.fw [3]; remote not supported yet
```

Has anyone managed to put all this together?


----------



## balanga (Mar 6, 2018)

Just found this - maybe it can be built on FreeBSD....


----------



## balanga (Mar 9, 2018)

I finally stumbled across em28xx()  which lists the Vid/Pid of supported devices and this includes a number of PCTV devices but not my PCTV DVB-S2 USB stick (2013:0258)  The FreeBSD driver seems to exclude various devices mentioned in the LinuxTV web page.

How is this driver updated, and what would happen if my Vid/Pid was included?

I notice that (2013:0251) is included there which I suspect is just a previous version of my device.

Just out of interest where do I find the source for em28xx and how does this driver relate to multimedia/webcamd?


----------



## Phishfry (Jun 30, 2018)

It is Linux TV Source and HPS ports it to FreeBSD via webcamd.
Look at the authors from the em28xx manpage


----------



## balanga (Jun 30, 2018)

Thanks. I'll contact the porter shortly.

One thing which puzzles me is, what exactly is em28xx? I know it's a driver but do I need to download it? I was unable to `pkg install` it. It may well turn out that it already has the required support, but I don't know where to find it or how to use it.


----------



## Phishfry (Jun 30, 2018)

No need to download it, webcamd includes it. The support for USB devices starts with usbdevs. Is your PID located in usbdevs?


----------



## balanga (Jul 1, 2018)

I don't know what usbdevs is, although I found a reference to it here. I tried running it as a command and then installing it as a pkg, then I found this 

usbconfig() shows 
<PCTV PCTV 461> at usbus1 .....

lsusb() shows
ID 2013:0258 PCTV Systems

... so presumably when em28xx is updated and webcamd rebuilt I will be able to use the my PCTV dongle.

Just wish I knew how to update it myself...


----------



## Phishfry (Jul 1, 2018)

You need to check /usr/src/sys/dev/usb/usbdevs for your PID [idProduct from usbconfig].
You are showing VID[idVendor] of 2013 and PID of 0258.
usbdevs is the file that provides USB device recognition to the kernel.
This does not mean your device will automatically work, but if your device PID is not in usbdevs it will not be recognized.
You can add your device PID and recompile but this does not guarentee it will work.
It is simply the first step of device recognition.


----------



## Phishfry (Jul 1, 2018)

Have you tried looking at webcamd port?
Just run `make` in the webcamd port directory and it will create the files without installing them.
It gives you a good chance to see what it is doing and look at the source.


----------



## balanga (Jul 1, 2018)

Phishfry said:


> You need to check /usr/src/sys/dev/usb/usbdevs for your PID [idProduct from usbconfig].
> You are showing VID[idVendor] of 2013 and PID of 0258.



I'm missing something here....

lsusb() shows the PCTV adapter as having 2013:2058 but https://github.com/freebsd/freebsd/blob/master/sys/dev/usb/usbdevs
does not include a VendorID of 2013 or Vendor name of PCTV Systems, but according to  FreeBSD's Webcam and DVB Compatibility List the older 460e model is supported and that has 0x2013:0x024c...

Confused!


----------



## Phishfry (Jul 1, 2018)

Well perhaps it does not use conventional usb discovery and is compiled directly into webcamd. Did you look at the port?


----------



## balanga (Jul 1, 2018)

Bingo!
/usr/ports/multimedia/webcamd/work/webcamd-4.12.0.1/media_tree/drivers/media/usb/em28xx/em28xx.h contains

```
#define EM28178_BOARD_PCTV_461E                   92
```
so I'll build webcamd and see what happens.

Do I need to run webcamd before I can run multimedia/w_scan ?


----------



## Phishfry (Jul 1, 2018)

balanga said:


> Do I need to run webcamd before I can run multimedia/w_scan ?


Yes. I would get webcamd working with command line first then add settings to /etc/rc.conf on startup.


----------



## Phishfry (Jul 2, 2018)

Well seeing how you got this going why don't you submit a PR and put USB in the report and HPS might pick it up and add your VID. Just add a note saying it works and if you'r capable add a diff patch with the PID.
He might not change it because it is upstream Linux driver, who knows. You can upstream the PID to LinuxTV crew if that is so.
Maybe drop HPS a note first before PR, noting the working device, he can better guide you how to add this for everyone's benefit.


----------



## balanga (Jul 2, 2018)

Phishfry said:


> Yes. I would get webcamd working with command line first then add settings to /etc/rc.conf on startup.




/etc/rc.conf contains


> webcamd_enable="YES"



Does webcamd use any flags or conf files I should be aware of?

Whilst booting I noticed:-



> Attached to ugen0.3[0]
> Webcamd is already running for ugen0.3
> ...
> ...
> ...



and I see I have two instances of webcamd running.  If I comment out that line I get a boot msg that webcamd is not running... which I find strange...


----------



## balanga (Jul 3, 2018)

Phishfry said:


> Well seeing how you got this going why don't you submit a PR and put USB in the report and HPS might pick it up and add your VID. Just add a note saying it works and if you'r capable add a diff patch with the PID.
> He might not change it because it is upstream Linux driver, who knows. You can upstream the PID to LinuxTV crew if that is so.
> Maybe drop HPS a note first before PR, noting the working device, he can better guide you how to add this for everyone's benefit.



Actually I didn't make any changes, I just built webcamd from ports and it worked!


----------



## Phishfry (Jul 3, 2018)

I am trying multimedia/webcamd from ports now too. I have a WinTV HVR-950 that should work. It's on the list.
So in summary, for you the package is broke but build the port with default options and it works?


----------



## balanga (Jul 3, 2018)

Phishfry said:


> I am trying multimedia/webcamd from ports now too. I have a WinTV HVR-950 that should work. It's on the list.
> So in summary, for you the package is broke but build the port with default options and it works?


Actually, I just checked by reinstalling the PKG and that worked too, so, either it has recently been rebuilt or I may not have installed it properly.


----------

