PVR-150 on 6-STABLE: success and mini HOWTO

Danny Pansters danny at ricin.com
Wed Dec 19 08:14:44 PST 2007


I just completed setting up my brand new Hauppauge PVR-150 (MCE I think) on 
6.2-STABLE using the newish port from usleep. All this info can be found, but 
it is scattered, so I thought it might be useful to put together a short step 
by step guide:


PVR-150 (MCE) on FreeBSD-6-STABLE
=================================

desktop# uname -a
FreeBSD desktop.homenet 6.2-STABLE FreeBSD 6.2-STABLE #0: Tue Aug 21 02:19:27 
CEST 2007     root at desktop.homenet:/usr/obj/usr/src/sys/DESKTOP  i386


Step 1
======
Download and extract the newer port:

desktop# cd /usr/ports/multimedia
desktop# wget http://usleepless.110mb.com/pvrxxx_port.tgz
desktop# cp -R pvrxxx pvrxxx.old
desktop# tar xvf pvrxxx_port.tgz && chown -R root:wheel pvrxxx
desktop# cp -R pvrxxx pvrxxx.new
desktop# rm pvrxxx_port.tgz


Step 2
======
Patch iicbus:

desktop# cd pvrxxx
desktop# make patch-iicbb

(on my box one iicbus_if.m patch gets ignored because the change was already 
made)


Step 3
======
Rebuild your kernel, or just the iic modules:

[ desktop# kldunload iicbus (only if loaded, I also had iic loaded for saa) ]
desktop# cd /usr/src/sys/modules/i2c
desktop# make all install clean (you could also build only iicbus and iicbb)
desktop# kldload iicbus
desktop# kldload iicbb


Step 4
======
Build and install the port:

desktop# cd /usr/ports/multimedia/pvrxxx
desktop# make install clean


Step 5
======
Load the cxm modules:

desktop# kldload cxm_iic
desktop# kldload cxm (this takes ~10 seconds, don't panic unless the kernel 
does)
desktop# kldstat
[....]
17    3 0xc754e000 3000     iicbus.ko
18    2 0xc7551000 3000     iicbb.ko
19    2 0xc7554000 3000     cxm_iic.ko
20    1 0xc75d6000 1d000    cxm.ko
21    3 0xc75f3000 3000     firmware.ko
22    1 0xc75ff000 6000     cxm_cx25840fw.ko
23    1 0xc7605000 5e000    cxm_encfw.ko
desktop# dmesg
[....]
cxm0: <Conexant iTVC16 MPEG Coder> mem 0xd8000000-0xdbffffff irq 22 at device 
1.0 on pci6
cxm_iic0: <Conexant iTVC15 / iTVC16 I2C controller> on cxm0
iicbb0: <I2C bit-banging driver> on cxm_iic0
iicbus0: <Philips I2C bus> on iicbb0 master-only
<2>tveeprom: ivtv version
<2>tveeprom: Hauppauge: model = 26559, rev = F189, serial# = 9992652
<2>tveeprom: tuner = TCL MFPE05 2 (idx = 89, type = 38)
<2>tveeprom: tuner fmt = PAL(B/G) PAL(I) SECAM(L/L') PAL(D/K) (eeprom = 0x74, 
v4l2 = 0x00400e17)
<2>tveeprom: audio processor = CX25843 (type = 25)
<2>tveeprom: decoder processor = CX25843 (type = 1e)
tuner type: 38
cxm0: Eeprom PAL
tuner: type set to 38 (Philips PAL/SECAM multi (FM1216ME MK3)) by cxm
tuner: switching to v4l2
before tuner_command!
tuner: tv freq set to 55.25
tuner: tv 0x05 0xe3 0x8e 0x01
<2>cxm 0-0000: Video signal:              not present
<2>cxm 0-0000: Detected format:           NTSC-M
<2>cxm 0-0000: Detected audio mode:       forced mode
<2>cxm 0-0000: Detected audio standard:   forced audio standard
<2>cxm 0-0000: Audio muted:               yes
<2>cxm 0-0000: Audio microcontroller:     running
<2>cxm 0-0000: Configured audio standard: A2-BG
<2>cxm 0-0000: Configured audio mode:     undefined
<2>cxm 0-0000: Specified standard:        PAL-BDGHI
<2>cxm 0-0000: Specified input:           Tuner
<2>cxm 0-0000: Specified audio input:     Tuner
<2>cxm 0-0000: Specified audioclock freq: 48 kHz
<2>cxm 0-0000: Preferred audio mode:      stereo
<2>cxm 0-0000: Selected 65 MHz format:    autodetect
<2>cxm 0-0000: Selected 45 MHz format:    chroma
cxm0: [FAST]
cxm0: encoder firmware version 0x2060039


Step 6
======
Test it:

%pvr250-setchannel -t -g 720x576 184.0
%cat /dev/cxm0 > test.mpg
^C
%mplayer test.mpg
MPlayer 1.0rc1-3.4.6 (C) 2000-2006 MPlayer Team
CPU: Intel(R) Pentium(R) 4 CPU 3.40GHz (Family: 15, Model: 3, Stepping: 4)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.

Playing test.mpg.
MPEG-PS file format detected.
VIDEO:  MPEG2  720x576  (aspect 2)  25.000 fps  9520.0 kbps (1190.0 kbyte/s)
SUB: Could not determine file format
Cannot load subtitles: ./test.js
==========================================================================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 720 x 576 (preferred colorspace: Mpeg PES)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Try adding the scale filter, e.g. -vf spp,scale instead of -vf spp.
VDecoder init failed :(
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
Selected video codec: [mpeg12] vfm: libmpeg2 (MPEG-1 or 2 (libmpeg2))
==========================================================================
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 48000 Hz, 2 ch, s16le, 384.0 kbit/25.00% (ratio: 48000->192000)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
AO: [oss] 48000Hz 2ch s16le (2 bytes per sample)
Starting playback...
VDec: vo config request - 720 x 576 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO: [xv] 720x576 => 768x576 Planar YV12
New_Face failed. Maybe the font path is wrong. 2 ??% ??% ??,?% 0 0
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
A:   9.4 V:   9.4 A-V: -0.002 ct: -0.046 230/230 11%  1%  0.6% 0 0
Broken frame at 0x73980
A:  10.0 V:  10.0 A-V:  0.011 ct: -0.036 243/243 11%  1%  0.6% 0 0

Exiting... (End of file)

Woohoo!

To play from mplayer directly:

%mplayer -cache 4096 /dev/cxm0

Cache is needed to avoid buffer underruns which would make the video slow.

Consecutive tuning:

Won't work if mplayer keeps playing (BT848_SCAPAREA can't be set), but it does 
work if you *pause* mplayer and after tuning resume playing. This can be 
scripted.


Step 7
======
Make changes (module loading) permanent in /boot/loader.conf:

# PVR-150
iicbus_load="YES"
iicbb_load="YES"
cxm_iic_load="YES"

The cxm module MUST be loaded AFTER cxm_iic. Our loader seems to IGNORE the 
order, and because of this your kernel will panic because it gets the cxm 
before cxm_iic which makes the firmware upload fail! Alternatively, or 
concurrently, it may be so that there's no way to read the firmware in this 
stage.

If this happens to you (you have put cxm in loader.conf), enter the loader 
prompt, unload all modules, and disable the loading of cxm, then 'boot'.

To have the cxm module be auto-loaded post-boot you can for example put this 
in /usr/local/etc/rc.d/cxm (and cxm_enable="YES" in /etc/rc.conf):

#!/bin/sh
#
# $NetBSD:  $
# $FreeBSD: $
#

# PROVIDE: cxm

. /etc/rc.subr

name="cxm"
kldload_cmd="/sbin/kldload"
kldunload_cmd="/sbin/kldunload"
start_cmd="cxm_start"
stop_cmd="cxm_stop"

cxm_start()
{
	if [ -x "${kldload_cmd}" ]; then
		${kldload_cmd} ${name}
	fi
}

cxm_stop()
{
	if [ -x "${kldunload_cmd}" ]; then
		${kldunload_cmd} ${name}
	fi
}

load_rc_config $name
run_rc_command "$1"


This keeps the firmware klds loaded, but who cares, it works :)

That's all folks.

Dan


More information about the freebsd-multimedia mailing list