[pvrusb2] PARTIAL SUCCESS Re: terratec grabster av400.. short report..

Andrea Venturi a.venturi at cineca.it
Fri Mar 16 17:52:31 CDT 2007


Mike Isely wrote:
> [...]
> If you intend to use the standalone driver alongside a current v4l-dvb 
> snapshot, then you have to also make that v4l-dvb snapshot visible to 
> the pvrusb2 driver compilation process.  Please scan through:
> 
> http://www.isely.net/pvrusb2/setup.html
> 
> You have a number of choices here.  You could for example just tweak the 
> pvrusb2 driver version within the v4l-dvb snapshot and use that 
> (currently it is fully up to date).  Note also that if you don't use a 
> v4l-dvb snapshot, then you must ensure you have the correct kernel 
> CONFIG settings enabled.  Just read the page referenced above then go 
> back and look at what you tried.  If you still can't figure it out, drop 
> me a note and I'll try to help some more.
> 

hoo mike..
first of all, i just have to tell that the care you are giving to your
"customers" is SO complete that it is simply overwhelming my expectation.

i'm a long time user of free software and completely sold to this
win-win community attitude (think positive) and i daily struggle to make
my management aware of the big advantages of the free (as freedom)
software strategy and the subtle social implications of this way of
think and act in a truly cooperative mood and i believed to be quite
accustomed to the community standard "SLA" but your words are so clear
and so positive expecially for a simple clueless unknown user like me
that i am without better words to tell you my gratefulness.

now stop the chat and get down to business..

i have read more carefully your web pages and they are indeed packed of
informations to a such level and consistence unbelievable.

expecially when one thinks the really long chain of ever changing
packages involved!!

  kernel - v4l-dvb - ivtv -pvrusb2

when i wrote my first email, i didn't understand completely that i
already had on my disk two complete pvrusb2 stacks:

- the 2.6.18 kernel
- the v4l-dvb 24.2.07 tree

but i have been acting as everyone in the free software frenzyness.. get
the latest. what a newbie error! :-)

now i'm getting back to try to patch and user the pvrusb2 of the v4l-dvb
tree (because i'm already using other linux dvb drivers like cinergy
pinnacle and animation..)

and i have to tell, things are going a lot better..

i had to change just one line to fake a Hauppauge 24xxxx

pvrusb2-hdw.c:  [PVR2_HDW_TYPE_24XXX] = { USB_DEVICE(0x0ccd, 0x0039) },

and put these three files inside the firmware directory:

...$ls -l /usr/lib/hotplug/firmware/v4l*
-rw-r--r-- 1 root root 376836 2007-03-16 12:37
/usr/lib/hotplug/firmware/v4l-cx2341x-enc.fw

-rw-r--r-- 1 root root  16382 2007-03-16 12:37
/usr/lib/hotplug/firmware/v4l-cx25840.fw

-rw-r--r-- 1 root root   8192 2007-03-16 12:37
/usr/lib/hotplug/firmware/v4l-pvrusb2-24xxx-01.fw


bingo. when i connect the terratec grabster av400 i get a warm green
light on the device..

these are the modules involved:

== lsmod =================================
Module                  Size  Used by
wm8775                  5516  0
tuner                  53288  0
cx25840                22416  0
pvrusb2               138068  0
cx2341x                10820  1 pvrusb2
videodev               26624  1 pvrusb2
v4l2_common            15808  5 tuner,cx25840,pvrusb2,cx2341x,videodev
v4l1_compat            11908  2 pvrusb2,videodev
tveeprom               13520  1 pvrusb2
i2c_core               20496  5 wm8775,tuner,cx25840,pvrusb2,tveeprom
michael_mic             2496  2
=========================================

these are the relevant entries in dmesg

== dmesg =================================
usb 5-5: new high speed USB device using ehci_hcd and address 3
usb 5-5: configuration #1 chosen from 1 choice
Linux video capture interface: v2.00
usbcore: registered new driver pvrusb2
/usr/local/src/andrea/v4l/v4l-dvb/v4l/pvrusb2-main.c: Hauppauge
WinTV-PVR-USB2 MPEG2 Encoder/Tuner : V4L in-tree version
/usr/local/src/andrea/v4l/v4l-dvb/v4l/pvrusb2-main.c: Debug mask is 15 (0xf)
usb 5-5: USB disconnect, address 3
pvrusb2: cpureset_assert(1) error=-19
pvrusb2: cpureset_assert(0) error=-19
pvrusb2: Failure uploading firmware1
pvrusb2: ***WARNING*** pvrusb2 device hardware appears to be jammed and
I can't clear it.
pvrusb2: You might need to power cycle the pvrusb2 device in order to
recover.
usb 5-5: new high speed USB device using ehci_hcd and address 4
usb 5-5: configuration #1 chosen from 1 choice
usb 5-5: reset high speed USB device using ehci_hcd and address 4
==========================================

anyway, the device get the same VID/PID on lsusb

== lsusb ===========
Bus 005 Device 004: ID 0ccd:0039 TerraTec Electronic GmbH
====================

i see too these errors WRT:

- cpu assert (!)
- uploading firmware1  (what's this? mpeg encoder or video decoder?)
- jammed device


anyway, i get the /dev/video0 entry in the /dev directory..

nb-venturi:/home/andrea/src/v4l/v4l-dvb# ls -l /dev/video0
crw-rw---- 1 root video 81, 0 2007-03-16 22:27 /dev/video0

as explained in the web pages, i have been able to do:

  cat /dev/video0 > test.mpg

for a few seconds and i get a real mpeg ps file. at least, mplayer tell
me so:

== mplayer log ==========================
....
==> Found video stream: 0
==> Found audio stream: 0
MPEG Stream reached EOF
ds_fill_buffer: EOF reached (stream: video)
MPEG-PS file format detected.
Searching for sequence header... OK!
VIDEO:  MPEG2  720x480  (aspect 2)  25.000 fps  8000.0 kbps (1000.0 kbyte/s)
[V] filefmt:2  fourcc:0x10000002  size:720x480  fps:25.00  ftime:=0.0400
...
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
dec_audio: Allocating 4608 + 65536 = 70144 bytes for output buffer.
mp3lib: made decode tables with MMX optimization
mp3lib: using SSE optimized decore!
MP3lib: init layer2&3 finished, tables done
MPEG 1.0, Layer II, 48000 Hz 224 kbit Stereo, BPF: 672
Channels: 2, copyright: No, original: No, CRC: No, emphasis: 0
AUDIO: 48000 Hz, 2 ch, s16le, 224.0 kbit/14.58% (ratio: 28000->192000)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================


the standard input is television (still related to the hauppauge: in
this device there's no tuner; maybe we'll purge it later..)

andrea at nb-venturi:~$ cat /sys/class/pvrusb2/unit-a/ctl_input/cur_val
television

but if put a source in the composite input, and if i set the ctl_input
to s-video (!) i can get in the mpeg ps file a good black and white
recording.

andrea at nb-venturi:~$ echo s-video >
/sys/class/pvrusb2/unit-a/ctl_input/cur_val
andrea at nb-venturi:~$ cat /sys/class/pvrusb2/unit-a/ctl_input/cur_val
s-video

SO NOW THIS IS A SUCCESS STORY! :-)

now, i can already get a black and white video from the composite input
of the grabster av400! hurrah..


now i get these more info in dmesg:

== dmesg ============================
cx25840 0-0044: cx25837-23 found @ 0x88 (pvrusb2_a)
wm8775 0-001b: chip found @ 0x36 (pvrusb2_a)
wm8775 0-001b: I2C: cannot write 000 to register R23
wm8775 0-001b: I2C: cannot write 000 to register R7
wm8775 0-001b: I2C: cannot write 021 to register R11
wm8775 0-001b: I2C: cannot write 102 to register R12
wm8775 0-001b: I2C: cannot write 000 to register R13
wm8775 0-001b: I2C: cannot write 1d4 to register R14
wm8775 0-001b: I2C: cannot write 1d4 to register R15
wm8775 0-001b: I2C: cannot write 1bf to register R16
wm8775 0-001b: I2C: cannot write 185 to register R17
wm8775 0-001b: I2C: cannot write 0a2 to register R18
wm8775 0-001b: I2C: cannot write 005 to register R19
wm8775 0-001b: I2C: cannot write 07a to register R20
wm8775 0-001b: I2C: cannot write 102 to register R21
tveeprom 0-0051: Encountered bad packet header [00]. Corrupt or not a
Hauppauge eeprom.
pvrusb2: WARNING: Failed to identify any viable standards
pvrusb2: Unable to select a viable initial video standard
wm8775 0-001b: I2C: cannot write 0c0 to register R21
wm8775 0-001b: I2C: cannot write 1d4 to register R14
wm8775 0-001b: I2C: cannot write 1d4 to register R15
wm8775 0-001b: I2C: cannot write 102 to register R21
wm8775 0-001b: I2C: cannot write 0c0 to register R21
wm8775 0-001b: I2C: cannot write 1d4 to register R14
wm8775 0-001b: I2C: cannot write 1d4 to register R15
wm8775 0-001b: I2C: cannot write 102 to register R21
wm8775 0-001b: I2C: cannot write 0c0 to register R21
wm8775 0-001b: I2C: cannot write 1d4 to register R14
wm8775 0-001b: I2C: cannot write 1d4 to register R15
wm8775 0-001b: I2C: cannot write 102 to register R21
cx25840 0-0044: Video signal:              not present
cx25840 0-0044: Detected format:           NTSC-M
cx25840 0-0044: Specified standard:        automatic detection
cx25840 0-0044: Specified video input:     Composite 7
cx25840 0-0044: Specified audioclock freq: 48000 Hz
wm8775 0-001b: Input: 2
pvrusb2: Device initialization completed successfully.
pvrusb2: registered device video0 [mpeg]
pvrusb2: registered device radio0 [mpeg]
wm8775 0-001b: I2C: cannot write 0c0 to register R21
wm8775 0-001b: I2C: cannot write 1d4 to register R14
wm8775 0-001b: I2C: cannot write 1d4 to register R15
	 0-001b: I2C: cannot write 102 to register R21
wm8775 0-001b: I2C: cannot write 0c0 to register R21
wm8775 0-001b: I2C: cannot write 1d4 to register R14
wm8775 0-001b: I2C: cannot write 1d4 to register R15
wm8775 0-001b: I2C: cannot write 102 to register R21
=============================

it's such an easy task to program this device thru the /sys/ fs and with
such rewarding, that i'd like to test the PAL setting

and i'm wrong again..  :-)

i tried some of these settings..

echo "PAL-B/G" > ctl_video_standard_mask_available/cur_val
echo "PAL-B/G"> ctl_video_standard/cur_val

but with always a black and white image..

anyway, it's enough for today (23.44 local time..)

i just can see these more info on dmesg

== dmesg ======================
pvrusb2: =================  START STATUS CARD #0  =================
cx25840 0-0044: Video signal:              present
cx25840 0-0044: Detected format:           PAL-BDGHI
cx25840 0-0044: Specified standard:        automatic detection
cx25840 0-0044: Specified video input:     S-Video (Luma In1, Chroma In5)
cx25840 0-0044: Specified audioclock freq: 48000 Hz
wm8775 0-001b: Input: 2
pvrusb2: cx2341x config:
pvrusb2: Stream: MPEG-2 Program Stream
pvrusb2: VBI Format: No VBI
pvrusb2: Video:  720x480, 25 fps
pvrusb2: Video:  MPEG-2, 4x3, Variable Bitrate, 6000000, Peak 8000000
pvrusb2: Video:  GOP Size 12, 2 B-Frames, GOP Closure
pvrusb2: Audio:  48 kHz, Layer II, 224 kbps, Stereo, No Emphasis, No CRC
pvrusb2: Spatial Filter:  Manual, Luma 1D Horizontal, Chroma 1D
Horizontal, 0
pvrusb2: Temporal Filter: Manual, 0
pvrusb2: Median Filter:   Off, Luma [0, 255], Chroma [0, 255]
pvrusb2: ==================  END STATUS CARD #0  ==================
pvrusb2: ***WARNING*** device's encoder appears to be stuck
(status=0x00000003)
pvrusb2: Encoder command: 0x81
pvrusb2: Giving up on command.  It is likely that this is a bad idea...
pvrusb2: Error recovery initiated
pvrusb2: Retrying device reconfiguration
=================================

BTW, i don't see "transport stream" in the pack of streaming type.. so
it's missing on purpose because it's not a hardware thing but just a
software made container, or there's something more to do to get it?

andrea at nb-venturi:/sys/class/pvrusb2/unit-a$ cat ctl_stream_type/enum_val
MPEG-2 Program Stream
MPEG-1 System Stream
MPEG-2 DVD-compatible Stream
MPEG-1 VCD-compatible Stream
MPEG-2 SVCD-compatible Stream


now what to do?

i have a bunch of questions, maybe i could just wade in the code
tomorrow, or i can do some educated question today.

- in the beginning, wrong firmware ? which one mpeg encoder or video
decoder?

- i should raise the level of the debug to get a better idea of stuff going?

- i should begin to "make up" a clean entry for this terratec?

all in all, it seems it's just a matter of tweaking the right bits
(GPIO?) in the right registers.. but i'll need to proceed with trial and
error or there a cleaner path?

anyway,  thank you again for this driver. it's really a wonderful
project, and not only for the quality of the source code, but it's
really all about the carefulness of the maintainer

bye

andrea venturi




More information about the pvrusb2 mailing list