SIFT
Serialport Interface For Topfield

Sift program will run topfield 5100c and compatible boxes. With sift it is possible to add, check and remove timers and have information listing remotely trough serial port. Also epg listing is supported. And web interface is also provided.

internet world -> (ssh,telnet,http) -> unix box at home -> (rs232) -> topfield

Example configuration is nslu2 with openslug connected to topfield 5100c. Serial port is FTDI USB Serial Converter and wlan is ZyDAS usb.  Usb line was used with puppy to copy sift binary to the topfield.
Image of the used environment

Topfield is running current latest firmware TF5100PVRc-Topfield-Sys_12406-2006Mar15.

I will bypass nslu2 installation or any other unix and will give only main details to install and use sift.

Installing Sift

Get serial cable between unix box and topfield. Cable need to have minimum 3 wire connected: 2-3, 3-2, 5-5 (d9 to d9).
Start terminal software: speed 115200, 8n1, flow-control none. Check out connection by pressing view times enter. If connection is working, there should be topfield command prompt 'COMMAND>'.  This is buildin remote control user interface. type 'help'+enter to see syntax. eg:'key 3' + enter will change topfield to channel 3.

Copy sift binary to the topfield with puppy or altair. Directory should be 'ProgramFiles/Auto Start' to have auto start feature. Reboot topfield.
In a terminal console the topfield boot procedure goes somehow like this:
LOAD(C) : NEC uPD6113x Embedded Controller...
ToFiÿ
<<< Loader C12406>>>
oFi"0ve0v3Ðÿèè(
[ SIFT (command) V0.20 ]
push '*' to go command mode
COMMAND>
Sift is now ready and waiting characters from serial port.
- send '*' to activate sift command line mode
- send '#' to exit command line mode, but stay resident. '*' will activate new session.
- send '#' and '!' to finish sift

When '*' has been send, there should be 'sift>' prompt. Try 'h' + enter to have sort help listing.
SIFT>h
a:tuner|channel|freq|length|yyyy|mm|dd|hh|mi|name
 tuner: 1 or 2
frequency: 1=OneTime,2=EveryDay,3=EveryWeekEnd
             4=Weekly,5=Weekday,6=NoType
l            List timers
i            Info listing
d<number>    Delete timer
e<channel    Epg data list
SIFT>
Command options are a (add timer), l (list timers), d (delete timer), i (info about topfield) and e (epg data listing). Send command with needed parameters and finally execute with enter. Backspace editing is not supported.

Install WebSift

WebSift is perl program to have http access for the sift.

* example of the epg listing
* example to add timer

Websift have simple authentication mechanism to have only one user per time logged in. Checking is based from client ip address.

Websift will not work if there is open kermit session to the serial port, so kermit should be closed.

sift.pl will use two common perl libraries: CGI and  Device::Serialport. Those can be loaded from cpan.
The Device::Serialport should be edited(fixed), otherwise some perl errors might seen:
diff ./site_perl/5.8.7/armeb-linux/Device/SerialPort.pm /data/original-SerialPort.pm 
2126,2128c2126,2127
<       # $self->{HANDLE}->close if ($self->{HANDLE}->opened);
<       $self->{HANDLE}->close if (defined($self->{HANDLE}) &&
<                              $self->{HANDLE}->opened);
---
>       $self->{HANDLE}->close if ($self->{HANDLE}->opened);
>
Subroutine get_weekday is copy of the Theodor-Wagner-0.81 cpan.

Create data directory for sift.pl, eg. siftdata. Under data directory, create ascii file passwd.dat to have allowed passwords, one per line. Checkout enough read/write permissions for files and directories, depending the used web server.

Give enough read and write permission for serial device, eg. /dev/ttyUSB0
crw-rw-rw-    1 root     dialout  188,   0 Sep  6 17:25 /dev/ttyUSB0
Modify sift.pl for your needs. Most important is to change first chdir command (about line 9) to point your data directory and edit the $SER_PORT variable to point your serial port.

I am using script at cron "22 2 * * * (cd /sifdata; siftepg.pl 1 2 3 4 5 6 7 8 9)" line to get latest epg data at night time.
Epg data for channels can also been loaded by using '[Read Epg]' button in websift.

Files

I will offer the source code for free and binaries without any experiation day like some other ---s_EPG software does.
Please, notify that my code is just peace of sift.
sift.tap     - ver 0.20 binary to install to the topfield
sift.c - ver 0.20 source code
sift.pl - ver 0.40 perl websift program

kermit - binary for C-Kermit 8.0.211, openslug bigendian
kermit.rc - rc file for kermit
siftepg.pl - script to get epg data for channel, eg. cron script
sitfcom.c - if there is problem to install Device::Serialport, here is c source of the alternative method
Finally

If you do a lot new code and fixes or new features, please provide me the source code too. sift(at)netrintala.com

last update: TR  7 Sep 2006