This site will look much better in a browser that supports web standards, but it is accessible to any browser or Internet device.

Setting up pppd on a TiVo running 1.3 or 2.X

I assume you've read the TiVo Hack FAQ and you have either shell access to your TiVo or you have its disk connected to a PC booted with one the boot disks for TiVo hackery. Much of this info was gleaned from other people's posts on the AVS TiVo Underground Forum without which this wouldn't be possible. Thanks!

I did things a little bit differently than the other methods I've seen on this subject so I thought I'd share my experiences. I had the following goals:

configurability
It should be simple to turn the PPP mode on and off, just like the shondss option
robust connection
If either end goes away for one reason or another (reboots for instance) the other should notice and things should reconnect without manual intervention
remove phone line dependency
I may get rid of my land line soon and simply use my cell phone but I still want my TiVo to work! :-)
I run OpenBSD at home (not Linux or Windows) so some of this will be OpenBSD-specific (although I'd expect it to pertain to the other BSDs as well). The bulk of the info is of general value though.

STEP ONE: a new boot parameter

First, I added a new boot parameter pppondss.
If you are running 2.X you'll need to add the shondss bits right after the if block that launches MyWorld via momstart if you haven't already (1.3 already has this).

You want things to look like this:

if [ "$shondss" = "true" ]; then
  echo "Starting bash on /dev/ttyS3"
  bash -login </dev/ttyS3 >& /dev/ttyS3 &
fi

if [ "$pppondss" = true ]; then
  echo "Starting pppd on /dev/ttyS3"
  /var/hack/ppp/startppp &
  tnlited 23 /bin/bash -login &
fi 
This will start our PPP script and a telnet daemon whenever pppondss=true is defined in the boot flags.

If you don't have the ROM password (and thus are unable to set the shondss or pppondss variable), are setting this up from a boot floppy, or if you just want to run a shell on the dss port whenever pppondss is not set you may wish to use the following instead:

if [ "$pppondss" = true ]; then
  echo "Starting pppd on /dev/ttyS3"
  /var/hack/ppp/startppp &
  tnlited 23 /bin/bash -login &
else
  echo "Starting bash on /dev/ttyS3"
  bash -login </dev/ttyS3 >& /dev/ttyS3 &
fi 
If you don't have the ROM password, you can set it from the bash prompt when you boot the TiVo by running:
crypto -u -srp "password" 
where "password" is the password you wish to use.

Note that you will probably need to run:

stty sane
From the bash prompt to turn on echo and normal tty processing. This is not a problem if you start bash from a tnlited connection.

STEP TWO: setting up PPP on the TiVo end

First though, we need to setup PPP proper. I put all the pppd config stuff in /var/hack/ppp to keep it together and separate from the system config. Because TClient-lib.itcl kills the process named "pppd" I added an alternate name for pppd via a symbolic link.
ln -s /sbin/pppd /var/hack/mypppd
I put the actual PPP options in /var/hack/ppp/options.ttyS3 as follows:
/dev/ttyS3
57600
nocrtscts
noauth
local
xonxoff
asyncmap 0
netmask 255.255.255.0
defaultroute
lcp-echo-failure 2
lcp-echo-interval 60
connect "/var/hack/ppp/chat.ttyS3"
I also edited /etc/ppp-options and commented out the debug and kdebug paramters. These are not needed and in fact, because syslog.conf isn't setup to record the information they are logging all these do is chew up CPU unnecessarily. Why bother? Because /etc/ppp-options will be read before /var/hack/ppp/options.ttyS3. That means if there is anything in it we don't like we must either disable it in our own config or comment it out of /etc/ppp-options directly.

Because there are no modem control lines we specify the local option (this is also why we do not need to use the cua version of the device). Due to the lack of hardware flow control on the DSS port we have to turn off rts/cts flow control (since it was specified in /etc/ppp-options) and turn on software flow control (xon/xoff).

The lcp-echo-failure and lcp-echo-interval options allow pppd to detect when the connection is no longer working (usually because either machine has rebooted) and to tear down the connection. We send a packet every 60 seconds to verify that the link is still up. If, after 3 minutes, there has been no reply the link will drop and automatically restart (more on that later).

You'll notice there is a chat script specified. With a normal pppd, the argument to the connect option is a program or line to run through the shell. The TiVo version has been hacked to pass the argument to the chat program directly. For connecting to an OpenBSD machine that starts pppd from getty(8), a simple chat script is all that is needed. I use the following for my /var/hack/ppp/chat.ttyS3 file. All it does is send a return and wait for the login prompt.

TIMEOUT 10 '' '' ogin:--ogin: ''
We can't use the passive option in this setup because it would lead to deadlock with both sides of the connection waiting for the other to start up. Because a chat script is used, there's no real need for passive anyway. I don't specify the persist or holdoff options because they did not function as expected. Specifically, holdoff seems to have been ignored and while the connection did retry with persist enabled, pppd would never get a good connection (probably because the other end was not ready) and did not re-run the chat script! Therefore, I use the following script, /var/hack/ppp/startppp to continuously start pppd after waiting a bit between connections:
while : ; do
    /var/hack/mypppd nodetach file /var/hack/ppp/options.ttyS3
    sleep 30
done

STEP THREE: setting up PPP on the OpenBSD end

The other end of my PPP connection is an OpenBSD machine with pppd started via getty(8) on /dev/tty00 (the first serial port on a PC). The relevant line in /etc/ttys looks like this:
tty00   "/usr/libexec/getty PPP.57600"  unknown on local
And PPP.57600 is defined in /etc/gettytab thusly:
PPP.57600:\
        :sp#57600:np:pp=/etc/ppp/ppplogin:
In other words, it is a 57600 bps connection with no parity using /etc/ppp/ppplogin as the script to run when it detects a PPP connection. Here's what I used for /etc/ppp/ppplogin:
ifconfig ppp0 down >/dev/null 2>&1
ifconfig ppp0 delete >/dev/null 2>&1
route -n delete 192.168.2.4 >/dev/null 2>&1
route -n delete 192.168.2.5 >/dev/null 2>&1

exec /usr/sbin/pppd $TTY $SPEED proxyarp nocrtscts local \
     noauth xonxoff lcp-echo-failure 2 lcp-echo-interval 60 \
     192.168.2.4:192.168.2.5
This script sets the local (server) IP address of the connection to 192.168.2.4 and the remote end to 192.168.2.5. It uses proxy arp to make the TiVo visible to the local network.

STEP FOUR: using the local network for the daily call

Ok, we now that we have PPP setup, let's look at how to make the TiVo use the local network instead of the phone line for the daily call. To make the TiVo actually use our PPP connection instead of starting its own via the modem we need to edit /tvlib/tcl/tv/TClient-lib.itcl. Right before the line:
    if [file exists /var/tmp/pppaddr] {
We add:
    if [info exists env(pppondss)] {
        if {$env(pppondss) == "true" || $env(pppondss) == "TRUE"} {
            putlog "pppondss set in prom, using existing connection"
            catch {file delete /var/tmp/pppaddr}
        }
    }    
Note that this will only have an effect if pppondss=true is set in the boot flags (or in the rc files).

If your TiVo is behind a firewall that only allows passive ftp out you will need to make the TiVo use passive ftp for its log uploads. Unfortunately, the version of ftp_lib.tcl TiVo ships has broken passive ftp support. You can replace /tvlib/tcl/ftp_lib.tcl with version 1.2 from the author's web site. TiVo has made some changes to ftp_lib.tcl (grep for 'DNS' in the TiVo ftp_lib.tcl) but I was able to use the stock 1.2 ftp_lib.tcl without problems. You may want to edit it and unset the VERBOSE and DEBUG variables to reduce the verbosity to the level of the TiVo-shipped version. Now that ftp_lib.tcl supports passive ftp we need to make the TiVo use it. This is fairly simple as it just requires us to add the -mode passive argument after the password in the FTP::Open line. In version 2.X of the TiVo software this is located in /tvbin/upload.tcl. In version 1.3 you should edit /tvlib/tcl/tv/CmdStr.itcl instead. Most people won't have to bother with passive ftp.

Notes on the 2.5.X pppd:

The pppd that comes with version 2.5 and 2.5.1 of the TiVo software has problems when used with the serial port that cause a large percentage of packets to become corrupted. If you use the pppd from 1.X or 2.0.X it will work just fine. Just copy the older pppd to /var/hack/mypppd instead of using a symbolic link. You should still have the pppd from the previous TiVo release. There are two root partitions (/dev/hda4 and /dev/hda7) so the old pppd should be on the one not currently being used. Simply type
    df /
on the TiVo to see which root partition is active and mount the other one.

In the following example, the current root partition is /dev/hda4 so the old pppd will live on /dev/hda7.

TiVo [~] # df /
Filesystem         1024-blocks  Used Available Capacity Mounted on
/dev/hda4             126911   30233    90125     25%   /

TiVo [~] # mount /dev/hda7 /mnt

TiVo [~] # ls -l /mnt/sbin/pppd
-rwxr-xr-x   1 0        0          154472 Oct  5 11:30 /mnt/sbin/pppd

TiVo [~] # rm -f /var/hack/mypppd

TiVo [~] # cp /mnt/sbin/pppd /var/hack/mypppd

DEBUGGING: how to debug PPP on the TiVo side

When debugging the PPP connection it is invaluable to be able to see the logs on the TiVo side of the connection (you should be able to easily see the logs on the other end ;-). To do this you just need to have backdoors enabled. In the 1.x TiVo software you can do this by going to the Browse By Name menu and entering "0v1t" (TiVo spelled backwards with zero and one instead of "O" and "I") and press the "Thumbs-Up" key. You should see a message stating "Backdoors enabled!". In 2.0 the magic string is "2 0 TCD" (note the space after the two and zero) and the menu has been renamed Search By Title. In 2.5 the backdoor code is "B D 2 5" (there is a space between each character).

Once you have backdoors enabled you can see the log files by entering "Clear Enter Clear Thumbs-Up" on the remote. The right arrow will cycle through the available log files and the channel up/down key will page up/down. You are probably only interested in the /var/log/messages file for debugging the PPP connection itself. If you are having a problem when the TiVo does its "daily call" you should look at /var/log/tvlog, /var/log/tclient, and /var/log/tverr.

That should do it!


Another good source of info on setting up PPP on your TiVo is the TiVo Updating Over Dedicated Internet HOWTO