PsiFtp: Psion to OS/2 communication utilities.

Introduction. Psion utilities for OS/2 is a set of utilities to organize communication between your Psion Personal Digital Assistant (PDA) and your Personal Computer (PC) under OS/2. All programs are text-window OS/2 applications with a wide set of commands. Psion utilities for OS/2 don't require to install any additional software on your Psion. As I've been reported, they work with the whole range of Psion devices. If you need access to your Psion from OS/2 and if you aren't afraid of printing commands on a keyboard - these are your utilities.

Features:

- Support whole family of Psion PDAs -
  - Series 3, 3a, 3c;
  - Sienna;
  - Workabout;
  - Series 5, 5Mx;
  - Revo, Revo Plus;
  - Netbook;
  - Series 7.
- Support all communication baud rates from 300 bps to 115200 bps;
- Allow you to copy a single file from/to your Psion as well as multiply files at once using wildcards;
- Support full and partial backup and restore from all data on your Psion;
- Allow to automate routine tasks through command files;
- Support serial port printing through a PC;
- Convert Psion "Word" and "Sketch" files to HTML and different graphics formats.

  Installation and quick start. Psion to OS/2 communication utilities are supplied on a single zip-archive - psiftp.zip. To install you should create a free directory, copy and unzip the archive. Note. After unzipping you can either remove source archive or put it somewhere for backup purposes. The PsiFtp utilities consist of the following programs :

- PsiFtp - file transfer program,
- PsiPrn - serial link print support program,
- PsiConv - port of a Linux Psion data file format conversion utility made by Frodo Looijaard <frodol@dds.nl>.

  PsiFtp. File transfer program. The easiest way to start PsiFtp is to run the command file pftp.cmd. It might be necessary to change this command-file if you use different communication settings. Here is a sample for pftp.cmd :

  @echo off

  SET PSICOM=com1

  SET PSIBAUD=115200

  SET LOCPATH=.\LOCALE;

  psiftp.exe %1 %2 %3

  PSICOM - set the name of communication port. You should enter the name of your serial port to communicate to your Psion device; i.e. com1, com2 ...

  PSIBAUD - set the communication speed. Change speed to desired in this line. Note. It's not necessary to change next line. We'll discuss all commands and their arguments later.

  PsiFtp is ready to work now. Because PsiFtp uses the standard Psion's communication protocol you should also switch on Remote link on your Psion. Go to the System->Tools->Remote link->Link - Cable, than choose the baud rate. Note. You have to choose the same baud rate as in pftp.cmd. Now you actually can start pftp.cmd. After you run it you would see the next screen :

  Program is ready to accept your commands.

  How to work with PsiFtp. Work with PsiFtp almost looks like a work with usual "old fashioned" ftp-client. With PsiFtp running you have two sides, PC's side (local) and Psion's side (remote). Using different commands you can look through a list of files on Psion and on local PC, transfer files between local and remote sides, and perform other useful actions.

  Prompt. For your convenience, when program is ready to accept your command it "prompts" you with a text consists of the name of current remote drive and the name of current remote directory. Thus, you always know where you are on Psion.

  Commands. Most of commands are English abbreviations or reduced English words. And most of them are very similar to DOS or OS/2 command line sessions. It's possible to print commands and their arguments either on the low register or with the capital letters. PsiFtp (as OS/2 is) isn't case-sensitive. When we talk about the names of files or directories we should take in consideration that they could be either relative or absolute. MyFileName - is the sample of the relative name (file places on the current drive, in the current directory). D:\Documents\MyFileName - is the sample of the absolute name (in the file name is provided the drive name and the directory name where the file resides). For Psion Series 5 you can use long names. You have to print them in the quotation marks : "D:\This is long name".

  dir or ls - "directory" or "list", show the list of files for the current directory on Psion. Example: C:\System>dir

  This commands might have an argument - the name of the directory to show to.

  Example: C:\System>dir D:\Documents\*.txt

  dircnt - "directory count", count and show number of items in the current directory.

  Example: C:\System>dircnt

  devs - show the list of drives on Psion and their characteristics. For example Psion Series 3 has two drives named "M:" and "N:".

  Example: C:\System>devs

  pwd - "print working directory", show the current directory for local and remote sides.

  Example: C:\System>pwd

  cd - "change directory", change current (working) directory on Psion. Command has an argument - the name of the directory to change to.

  Example : C:\System>cd \Documents.

  There is no any particular command to change current drive on Psion. You can just print the name of the desirable drive - i.e. "a:", "b:", "c:", or what else.

  Example : C:\System>D:

  lcd - "local change directory", change current (working) directory on your PC. Command has an argument - the name of the directory to change to.

  Example : C:\System>lcd D:\Psion\AgendaToSync.

  ren - "rename", rename file or directory. Command has two arguments. First, the name of file to rename to. Second, the destination name of file.

  Example : C:\System>ren MyOldDocument MyNewDocument

  del or rm - "delete" or "remove", delete file or group of files by a mask. Command has only one argument - the name of file to delete. Instead of the name of file here can be the file mask.

  Example : C:\System>del Old*

  mkdir - "make directory", create new directory on Psion. Command has an argument - the name of directory to create.

  Example : C:\System>mkdir D:\ Old*

  rmdir - "remove directory", remove directory. Command has an argument - the name of directory to remove. Note. You can delete directory only if there isn't any file in this directory.

  Example : C:\System>mkdir D:\ Old*

  touch - touch file. Command has one argument - the name of file to touch. This touch changes the date and the time of file creation to the current time.

  Example : C:\System>touch MyOldFIle

  gtime - "get time", show the time of file creation.

  Example : C:\System>gtime MyFile

  test - test the file. If there is such file, command prints "OK". If there isn't - error message. Command allows to check up the file presence. The only argument is the name of that file.

  Example : C:\System>test MyFile

  gattr - "get attributes", each file has attributes, so you can see them with this command. Argument is the name of file to get attributes.

  Example : C:\System>gattr MyFile

  sattr - "set attributes", this command allows you to change file attributes mentioned above. It's possible to change next attributes : R - ready only, H - hidden, S - system, A - archived.

  Example 1, this command sets up attributes "read-only" and "hidden":

  C:\System>sattr MyFile +RH

  Example 2, this command removes attributes "system" and "archived":

  C:\System>sattr MyFile -SA

  get - "get" the file from the Psion. In other words command allows you to copy a single file from Psion to PC. Commands has two arguments, but the second arguments is optional. First argument is the name of file to copy from Psion, the second is the name of file to copy to your PC. If you don't enter the second argument, the file will be copied into the current directory on your PC.

  Example : C:\System>get C:\Documents\MyFile D:\Psion\MyPsionDocuments\MyFile

  put - "put" the file to Psion. In other words command allows you to copy a single file from PC to Psion. Commands has two arguments, but the second arguments is optional. First argument is the name of file to copy from PC, the second is the name of file to copy to your Psion. If you don't enter the second argument, file will be copied into the current directory on your Psion.

  Example : C:\System>put D:\Psion\MyPsionDocuments\MyFile C:\Documents\MyFile

  mget - "multiply get" , copy the group of files from Psion. This command has the same arguments as the "get", but as the file name you can use a file mask. This command interacts with other command called "prompt". If the "prompt" is "off", "mget" just copy all files. If the "prompt" is "on", "mget" will ask a confirmation for each file to copy to. This mechanism allows to control copying within the selected group of files.

  Example : C:\System>mget C:\Documents\* D:\Psion\MyPsionDocuments\*

  Get "data.txt" (y/n/q) ? <Enter>

  You have three alternatives to answer - press 'y' and file will be copied, press 'n' and file won't be copied, press 'q' - to cancel operation.

  mput - "multiply put" , copy the group of files to Psion. This command is same as previous one, except the fact that the copying is made to the Psion (in the back direction).

  Example : C:\System>mput D:\Psion\MyPsionDocuments\* C:\Documents\*

  prompt - as we told above, this command controls the confirmations. Commands has one optional argument. If you call this command without any arguments, it switches over the prompt state and shows it for you. If you call it with an argument, this argument can be "on" - to turn on the confirmations, or "off" - vise versa.

  Example : C:\System>prompt off

  C:\System>mget *.txt

  C:\System>prompt on

  resp - "response" sets a default response for the "prompt". Default response can be "y" (yes), "n" (no). For example, set the response "y" allows you just press Enter to the prompt on copying file.

  Example : C:\System>resp y

  C:\System>mget *.txt

  Get "data.txt" (y/n/q) ? <Enter>

  bye or quit or exit - any of their commands finishes PsiFtp. Frankly speaking it's enough to press "Esc" on your keyboard to finish PsiFtp. But this commands could be useful in the automated command files.

  Example : C:\System>bye

  cls - "clear screen", just clear screen and nothing else.

  Example : C:\System>cls

  ? or help - show a list of available commands (which we are discussing now

  Example : C:\System>help

  rem or ; - "remark", PsiFtp doesn't recognize any text after this command. Useful for creation comments in the automated command files.

  Example : C:\System>rem This is my comment

  echo - this command was entered for automated command files. This command prints its argument on the screen.

  Example : C:\System>echo Show me something

  Show me something

  backup - this command performs reserve backup for the Psion's data. Data stores on your PC in the any wished place. Command has two mandatory arguments - the name of Psion's directory to backup from and the name of PC's directory to backup to. This command saves all attributes of Psion's files (as well as "restore" command - restores them later). Note1. It's possible that some files on your Psion are locked (due running Psion applications), backup will stop if it finds locked file. So, it'll be better if you turn "prompt off". In this case backup just reports and skips locked files. Note2. Backup is Psion serial number sensitive, this means it can make separated backups for each Psion specimen. I.e. backup command automaticaly adds additional folder name into the backup's destination path (the restore commad makes the same). This is the default behavior. You can change it by a "snumb off" command.

  Example : C:\System>prompt off

  C:\System>backup C:\ D:\PsionBackup\DriveC

  C:\System>prompt on

  restore - this command restores all data on your Psion previously saved by "backup" command. This command has two mandatory arguments too. First of them - the name of directory where backup resides. Second - the name of Psion's directory to restore files.

  Example : C:\System>prompt off

  C:\System>restore D:\PsionBackup\DriveC C:\

  C:\System>prompt on

  snumb - as well as backup and restore commands support serial number sensitive backup/restore (for separated backup for each specimen of Psion) you may want to make backups on the old way without taking in consideration Psion's serial numbers. So you can turn off this sensitive backup and perform it as you have done before. If you call this command without any arguments, it switches over the snumb state and shows it for you. If you call it with an argument, this argument can be either "off" - to turn off the sensitive backup, or "on" - to return to the default state.

  Example : C:\System>snumb off

  C:\System>backup c: mybackup\c

  @filename - this command treats filename as the automated command file. It reads lines from the given file and tries to interpret them as PsiFtp commands. For example your can create next file named mybackup.pcf for full backing up your Psion:

  echo "********************************************************"

  echo "* *"

  echo "* My Psion Backup *"

  echo "* *"

  echo "********************************************************"

  prompt off

  backup c: andy\c

  backup d: andy\d

  prompt on

  And than you can use this sequence of commands whenever you want :

  Example : C:\System>@mybackup.pcf

  !command - execute "external" OS/2 command (program).

  Example : C:\System>!dir *.txt

  install - install a Psion application via .ctl-file.

  Example : C:\System>install D:\PsionProgs\newprog.ctl

  PsiFtp's command line arguments. In the simple situations it's enough for you to start the command file pftp.cmd. If you are going to extend using of PsiFtp you need to know how to start it with a command line arguments and which codes it returns.

  PsiFtp [psiftp_command parameters] [-a] [-h] [-c:N] [-b:N] [@file]

  Thus command line arguments are not necessary, they are "bracket" with "[...]" brackets.

  [psiftp_command parameters] - you can use here any of described above commands. PsiFtp will start, perform this command and than exit. Of course, it's possible to use here the name of automated command file.

  Example : C:\Psion>PsiFtp.exe devs

  C:\Psion>PsiFtp.exe @mybackup.pcf

  Next parameters allow to arrange with communication environment :

  -a - auto baud detection, PsiFtp will try to find and adjust needed serial port speed;

  -c:N - serial port number, where N - 1,2...;

  -b:S - serial port speed, where S can be chosen from one of these values - 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200;

  -s:N - the synonym for previous argument.

  To show filenames content characters different from the standard English it's necessary to indicate the correct code page for your Psion. The next parameters can be used for the following purposes:

  -l:nnn - code page for Psion, where nnn is valid code page name (i.e. IBM-850, IBM-866 etc.);

  -p - switch off print-server support (for old Psions);

  -r - switch off RPC support (old Psions)."

  You also can redirect error messages into the file this way : psiftp.exe 2>logfilename

  PsiFtp environment variables. PsiFtp recognizes three special environment variables. If you set them, for example, in your config.sys, you shouldn't indicate the speed, the port name and the code page neither in the PsiFtp's command line nor in the pftp.cmd. This variables are : PSICOM=COMx - serial port name; PSIBAUD=xxx - serial port speed, PSICP=IBM-xxx - Psion's code page name. Default serial port name is "com2". Default serial port speed is 115200 bps. And default code page for Psion is "IBM-1251" (Russian code page for Psions devices).

  Example : SET PSICOM=COM1

  SET PSIBAUD=115200

  SET PSICP=IBM-850

  PsiFtp's return codes. When PsiFtp exits, it returns next codes:

  0 "OK"

  1 "Bad CRC"

  2 "Async read error"

  3 "No enough memory"

  4 "I/O time-out. Check, is Psion on ?"

  5 "Too big packet"

  6 "Break connection"

  7 "Bad PLP packet"

  8 "Queue overflow"

  9 "No empty channel"

  10 "Message on unknown channel"

  11 "Unknown status"

  12 "Unknown NCP packet"

  13 "Bad NCP packet"

  14 "Empty NCP packet"

  15 "Can not start PLP link thread"

  16 "Can not create semaphore"

  17 "Bad queue"

  18 "Unexpected end of buffer"

  19 "Bad RFSV response"

  20 "Psion returns error"

  21 "Retry operation. Psion is reconnected"

  22 "Can not auto-detect serial port baudrate"

  23 "File not found"

  24 "Async write error"

  25 "Async error, many resends"

  26 "Unable to find locale tables"

  101 "Error on EA write"

  102 "Error on EA restore"

  PsiPrn. Serial link print support program. Starting PsiPrn on your PC is almost similar to starting PsiFtp. There is a command file pprn.cmd for your quick start. You should be convinced of the right parameters in this file:

  @echo off

  SET PSICOM=com1

  SET PSIBAUD=115200

  SET LOCPATH=.\LOCALE;

  psiprn.exe %1 %2 %3

  But there is a difference for the Psion side. To utilize PsiPrn you have to : first - switch off the remote link on your Psion, because Psion can't use serial printing and remote link simultaneously; second - switch on serial port printing. To do the last task you should perform next actions - go to the Control panel on your Psion, select Printer and set Print via->Serial. Than adjust serial port settings : Serial port baud rate - 115200 (or any other desirable, but it must be equal with installed for PsiPrn), Data bits - 8, Stop bits - 1, Parity - none; serial port handshake - XON/XOFF - off, RTS-CTS - on, DSR-DTR - on, DCD - off. Note. You can't use PsiFtp and PsiPrn at the same time. To stop PsiPrn, it's enough to press Esc on your keyboard.

  PsiPrn environment variables. PsiPrn accepts the same environment variables as PsiFtp does, but one extra variable - PSIJOBTIMEOUT=xxx - job time-out in seconds. It's necessary to separate one print job from another. Psion doesn't send any special command to perform this task, so it's only one way to resolve this issue - time-out. PsiPrn waits data from a Psion PSIJOBTIMEOUT seconds (and prints them on your printer if there are some), if no data arrived - job will be finished (not the PsiPrn). Default print job time-out is 15 seconds.

  PsiPrn's command line arguments. In the simple situations it's enough for you to start the command file pprn.cmd. If you are going to extend your using of PsiPrn you need to know how to start it with a command line arguments.

  PsiPrn [-h] [-c:N] [-b:N] [-p:N] [j:N] [-l:nnn]

  Next parameters allow to arrange with communication environment :

  -c:N - serial port number, where N - 1,2...;

  -b:S - serial port speed, where S one these values - 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200;

  -p:N - printer port number, where N - 1,2.. (what means LPT1,LPT2...);

  -j:N - print job time-out (sec);

  -s:N - the synonym for previous argument.

  To show filenames content characters different from the standard English it's necessary to indicate the correct code page for Psion. Next parameter designed for this :

  -l:nnn - code page for Psion, where nnn is valid code page name (i.e. IBM-850, IBM-866 etc.).

  PsiConv. Psion data conversion program. This program is just a port from Linux. Original program is developing by Frodo Looijaard. The home page for this program is http://huizen.dds.nl/~frodol/psiconv/index.html. Current ported version is 0.8.1. There is the extraction from this page : "The current release of psiconv is psiconv-0.8.1. This is an early release, mostly tested on Linux/i386 (though it should now run on any Unix platform). It can translate Psion Word and TextEd files to HTML (either 3.2 or 4.0) or plain text, and it can translate Psion Sketch, MBM and ClipArt files to almost any graphic format. It is not yet perfect, but it can easily be extended. Psiconv-0.8.1 includes the description of the Psion file formats, version 2.6."

  Here is a short description for the command line.

  PsiConv [Options] [File]

  If [File] is not specified, stdin is used. Options are :

  -d, --debug - show debug information on stderr;

  -h, --help - display this help and exit;

  -o, --output file - output to file instead of stdout;

  -s, --silent - do not even show warnings on stderr;

  -V, --version - display the program version and exit;

  -v, --verbose - show progress indicators on stderr;

  -T, --type=FileType - output file type;

  I suggest you to use next output types:

  ASCII plain text without much layout

  HTML3 HTML 3.2, not verified so probably not completely compliant

  HTML4 HTML 4.0 with cascading style sheets

  BMP Microsoft Windows bitmap image

  BMP24 Microsoft Windows 24-bit bitmap image

  GIF CompuServe graphics interchange format

  GIF87 CompuServe graphics interchange format (version 87a)

  JPEG or JPG Joint Photographic Experts Group JFIF format

  PCX ZSoft IBM PC Paintbrush

  PNG Portable Network Graphics

  TIFF or TIF Tagged Image File Format

  TEXT or TXT Raw text

  Example : D:\Psion>psiconv.exe MyPsionWordFile -o MyOS2file.html -T HTML4

  Development history.

  v1.5 Print-server support was added. Now it is possible to use Psion's "Print via PC" feature.

  v1.4 Partial reconnection feature was added. New version of PsiConv (see PsiConv doc for improvements). Backup can now keep separated backups for devices with different serial-numbers. Backup adds serial number into the destination path (restore makes the same). Note. This feature doesn't work with Series 3 and similar (Sibo16), because they haven't ability to send their serial numbers. This feature can be turned off/on with a new command "snumb off/on". Install feature was added. Now it's possible to install application remotely using .ctl files.

  v1.3 Improved performance (about 10-15%). Fixed some little bugs in RPC. RPC with my Sibo emulator is still unstable. If you are interested in RPC support for Sibo machines drop me a e-mail. Fixed error in the Rexx example for RPC.

  v1.2 Command line switch '-r' is added. For switching off RPC support for old Sibo machines (which haven't got SYS$RPCS.IMG properly installed. Consult your Psion User's manual for details). Rexx interface is released. Port of PsiConv wasn't changed, I'm waiting for RTF suppord released.

  v1.1 The project has a new additional author: Mike A. Potapoff. He's writing Rexx interface. Documetation for PsiFtp is now included into that package. Rexx interface is only preface version and is temporary removed for fixing bugs ...;-)

  v1.1b Some new commands added :

  "ps <psidrive>" - get list of the running processes on Psion. For Psion older than Series 5 you should indicate a drive name from where programms were started.

  "kill <psdrive> <pid>" - kill selected process on Psion.

  "run <prog> <arg>" - run specified program on Psion with an argument.

  "owner" - show Psion owner information.

  "psion" - show Psion's information.

  "synct" - synchronize Psion and your PC clocks.

  v1.0 Some little changes. And one important thing - I've made psiftp engine compatible with Psion-plugin for NetDrive. Replaced psiconv with new one.

  v0.97 Some new commands were added. PsiPrn wasn't changed at all (yet). Directory "Lib" contains a library, some headers and an example for a Psion link.

  v0.96 Fix some little bugs. PsiConv wasn't updated.

  v0.95 Add system's events handler for a cleaner program exit. For the first time, I'm including the port of PsiConv utility by Frodo Looijaard <frodol@dds.nl>. For a while, this utility can convert Psion's Word files to ASCII, HTML and HTML v4.

  v0.94 Fix some little bugs and one great bug. But they weren't my.

  v0.93 Fix some little bugs. New commands were added.

  v0.92 Backup/restore was added. Note : I have got a problem with "set file date" function on Psion Series 3 emulator (Y2K ?). I made workaround, but if you have got it too, let me know, please. Made a little modification in error response code (improved error detection).

  v0.91 First public release.

  Credits:

  Olaf Flebbe <o.flebbe@science-computing.de>

  Philip Proudman <philip.proudman@btinternet.com>

  Alexander Thoukydides <alex@thouky.co.uk>

  Erik Huelsmann <f.w.h.hulsmann@rcondw.rug.nl>

  Hans Hockx <jcm.hockx@hccnet.nl>

  Frodo Looijaard <frodol@dds.nl>

  Peter Wansch <p.wansch@ieee.org> for a PrintQ library.