pvrusb2 driver utilities
$Id: utils.html 1274 2006-07-03 05:07:20Z isely $
Mike Isely <isely at pobox dot com>
This page briefly describes the usage of the utilities included
with the pvrusb2 driver distribution.
You can find the main driver page on the web at http://www.isely.net/pvrusb2/pvrusb2.html.
Overview
The utilities can be found in the utils subdirectory. They
include the following:
- change-channel.sh - This is a bash program which
provides an interface for managing channel IDs and changing channels
through the driver's sysfs interface. This script works with a
configuration file that associates channel IDs with frequencies; it
does not need or use the sysfs frequency table logic in the driver.
This was created and contributed by Per Christian Henden; for his
e-mail address and a description on how to use the script along with a
brief method to generate the frequency data from xawtv, please see the
comments at the top of the script.
- decode_log.cpp - This is a decompiler, which is
used to interpret the USB traffic flowing between the pvrusb2 device
and the driver.
- fwextract.pl - This is a Perl program which
handles extraction of firmware data out of Hauppauge's Windows driver
files. See setup.html and firmware.html for more information about this
program.
- fwfind.sh - This is a contributed bash program
which further automates firmware extraction. This is discussed
briefly on the setup.html page.
- old-extract-firmware.pl - This is the old
firmware extractor created by Björn Danielsson. Use the newer
fwextract.pl program instead; this is included here for
historical reasons and also as a last resort fallback in case problems
are encountered with the new extractor (but please contact me if you
find yourself having to use it).
- pvrui.sh - This is a contributed shell script that
uses the dialog utility to implement a nice interactive front end to
the driver's sysfs interface. This script was written by Phil
Endecott; see the comments at the top of the script for his contact
information. Note: This script is somewhat broken right now; it needs
to be updated to account for new types possible in sysfs and the fact
that enumeration values can have embedded spaces.
- usbreplayprep.pl - This is a Perl script which
can postprocess USB sniffer output into a compact form that the
decompiler can parse. This also originally came from Björn
however it has been modified to also preserve data coming from the
device (older version only preserved data going *to* the device).
There is a free USB sniffer that can be run under Windows for
capturing all traffic between a USB device and its driver. The home
page for it is here. Using
this tool we can learn about how the Windows driver operates the
device. If you want to explore, download that tool and follow the
related instructions.
To help with understanding the log data from the sniffer, there are
two tools provided with this driver:
The first tool is usbreplayprep.pl, which will
preprocess the USB sniffer data into a more compact form. This tool
was originally written by Björn but I have since modified it to
provide more data. The version provided here saves both directions of
traffic; the previous one only saved data going in the
driver-to-device direction.
The second tool is decode_log, which is compiled
from the similarly named C++ source file. This program interprets the
output from usbreplayprep.pl and produces a concise listing of all the
commands and data moving to / from the device and the driver. (This
tool can also capture and save the encoder firmware if seen as part of
the log.)
The decompiler is a 2-weekend hack that I wrote in C++ and must be
built first. Run make in the utils directory to build this tool.
Note that this program has no other dependencies beyond needing C++ so
it should be a straight-forward build.
To capture and decompile a session with the device when run with
the Windows driver, do the following:
- Boot windows, start the sniffer and enable it, and plug in the
device.
- Run your TV app for a little while. NOTE: The sniffer log data
can get ENORMOUS so you may not want to run it for long. Also the
capture process does slow things down so the video playback in the TV
app might get choppy, but that's OK.
- Copy the log data to your Linux system or reboot to Linux
- Run usbreplayprep.pl < data.log >data.txt where
data.log is the name of the log output from the sniffer.
- Run decode_log < data.txt > data.src and the decompiled
output will be in data.src.
The decompiler also has an option for saving off the encoder
firmware captured, which is useful when one has to figure out the
firmware extraction details for a newer Hauppauge driver snapshot.
There's lots more about that feature described in firmware.html.