========================================================================
                         MOXA Linux Real TTY Driver

                              README file

  Date: 08-26-2005
  Copyright (C) 2004, MOXA Technologies Co., Ltd. All rights reserved.
========================================================================
Content

1. Introduction
2. MOXA Product Supported
3. System Requirement
4. Procedure
5. Hardware Installation
6. Driver Files Installation
7. Mapping TTY Ports
8. Removal Mapped TTY Ports
9. TTY Naming Rule
10. Driver Files Removal
11. Modification of "npreal2d.cf"
12. Modification of Initializing Script
13. Technical support
------------------------------------------------------------------------
1. Introduction

    The purpose of this driver is to map NPort serial port to host tty
    port. Using this driver, you can use NPort serial port as local
    tty port.


2. MOXA Product Supported
    This driver supports following products.
	NPort 5210,5230,5232,5232I,5410,5430,5430I,5610-8,5610-16

    You may always find and download the latest driver at
    http://www.moxa.com and http://www.moxa.com.tw


3.  System Requirement
    To install this driver, you will need NPort Server and one of
    the following system.

     -  UC-7410-LX/UC-7420-LX/UC-7408-LX
     -  gawk-3.1.0 (include in this sofeware package)


4.  Procedure

    To map NPort serial port to host tty port, you need to:
    1. Setup NPort.
      Make sure the IP configuration is ok and you can access
      the NPort (ping, telnet...) seccussfully and then configure 
      the NPort serial port to Real COM Mode.

    2. Install driver files into the host.
      Refer to "6. Installing the Driver File" below for details.

    3. Map NPort serial port to host's tty port.
      Refer to "7. Mapping TTY Ports" below for details.


5.  Hardware Installation

    Before proceeding with the software installation, make sure you 
    have completed the hardware installation, as described in an 
    earlier chapter of this manual. 
    
    The default IP address for NPort Server is 192.168.127.254.

    !!!!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!
    After installing the hardware, you MUST configure the 
    NPort operating mode to Real COM Mode. 
    !!!!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!


6.  Installing the Driver File

    a.  Get the driver file.
    b.  Log in to the console as a super user (root).
    c.  Execute "cd /" to change to the root directory.
    d.  Copy the driver file npreal2xx.tgz to the " / " directory.
    e.  Execute "tar xvfz npreal2xx.tgz" to copy all files into the system.
    f.  Execute "/tmp/npreal2/mxinst".
    g. The shell script will install the driver files automatically.

      After installing the driver, you will be able to see several 
      files in the "/usr/lib/npreal2/driver" folder, including:

      - mxaddsvr (Add Server, map tty port)
      - mxdelsvr (Delete Server, un-map tty port)
      - mxloadsvr (Reload Server)
      - mxmknod (Create device node/tty port)
      - mxrmnod (Remove device node/tty port)
      - mxuninst (Remove tty port and driver files)

    At this point, you will be ready to map the NPort serial port to 
    the system tty port. See "8. Mapping TTY Ports" below for detailed 
    instructions.


7. Mapping TTY Ports

   Before mapping tty ports, you must set the operation mode of your 
   NPort to Real Com Mode. We provide two ways to map tty ports.
   
   a. Mapping tty ports automatically
      After logging in as a super user, enter the directory 
      "/usr/lib/npreal2/driver" and then execute "mxaddsvr" to map the 
      target NPort serial port to the host tty ports. 
      The syntax of "mxaddsvr" is:

         mxaddsvr [NPort IP Address] [Total Ports] ([Data port] [Cmd port])

      Example1:
       # cd /usr/lib/npreal2/driver
       # ./mxaddsvr 192.168.3.4 16

      Example2:
       # cd /usr/lib/npreal2/driver
       # ./mxaddsvr 192.168.3.4 16 4001 966

      In Example 1, 16 tty ports will be added, all with IP 192.168.3.4, 
      but with data ports equal to (950, 951, ..., 965), and command ports 
      equal to (966, 967, 968, ..., 981). 
      
      In Example 2, 16 tty ports will be added, all with IP 192.168.3.4, 
      but with data ports equal to (4001, 4002, ..., 4016), and command 
      ports equal to (966, 967, 968, ..., 981). 
      
    b. Mapping tty ports manually
      After entering the directory "/usr/lib/npreal2/driver", you can modify 
      "npreal2d.cf" to map NPort serial ports to tty ports, and then execute 
      "mxloadsvr" to activate the modifications.
      
      The following tasks will be performed:
      
         - Modify npreal2d.cf
         - Create tty ports in the directory "/dev" with major & minor number 
           configured in "npreal2d.cf"
         - Stop and then restart the driver.

8. Remove Mapped TTY ports
   As with the "8. Mapping TTY Ports" task, we provide two ways to remove
   mapped tty ports:
   
   a. Remove the mapped tty ports automatically
      After logging in as root, enter the directory "/usr/lib/npreal2/driver" 
      and then execute "mxdelsvr" to delete a server. 
      The syntax of "mxdelsvr" is:

      mxdelsvr [IP]
      
      Example:
      
           # cd /usr/lib/npreal2/driver
           # ./mxdelsvr 192.168.3.4
           
      If you don't include the IP address in the command line, a numbered 
      list of IP addresses for servers currently installed, along with the 
      total number of ports for each server, will be listed on the screen.
      To remove the tty ports for a particular server, type the number next 
      to the server's IP address and then hit Enter. The following tasks 
      will be performed:
    
         - Modify the npreal2d.cf 
         - Remove the relevant tty ports in directory "/dev"
         - Stop and then restart the driver.  
      
   b. Remove the mapped tty ports manually
      After entering the directory "/usr/lib/npreal2/driver", you can 
      modify "npreal2d.cf" to delete servers and ports manually, and then 
      execute "mxloadsvr" to activate the modifications.


9. TTY Naming Rule

    The tty name of the real tty driver is configured in npreal2d.cf. 
    The pre-defined tty name is ttyrXX, and the callout name is curXX. 
    The naming convention is illustrated as follows:

   Nport Server     TTY Name                Callout Name
   1st(4port)       ttyr00 - ttyr03         cur00 - cur03
   2nd(8port)       ttyr04 - ttyr0b         cur04 - cur0b
   3rd(16port)      ttyr0c - ttyr1b         cur0c - cur1b
   4th(8port)       ttyr1c - ttyr23         cur1c - cur23
   ...(etc.)

 
10. Removing the Driver

    Removing the driver will remove all driver files, mapped tty ports, 
    and unload the driver. To do this, enter the directory 
    "/usr/lib/npreal2/driver", and then execute "mxuninst" to uninstall 
    the driver. This program will perform the following tasks:
    
         - Unload the driver.
         - Delete all files and directories in "/usr/lib/npreal2"
         - Delete directory "/usr/lib/npreal2"
         - Modify the system initialization script file.


11. Modification of "npreal2d.cf"

   !!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!
   "npreal2d.cf" is the driver configuration file. Please backup
   this file before making any modification.
   !!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!

   The configuration file is named "npreal2d.cf" in directory
   "/usr/lib/npreal2/driver", all relevant information about
   mapped tty ports will be appended in this file. you are
   allowed to modify this file if you want to modify the setting
   manually.

   We illustrate some circumstances that you may encounter in the
   following section. Please read the CAUTION section before
   reading the section a and section b.

   [CAUTION]:
       In modifying "npreal2d.cf",
       1. Please don't type any space or [TAB] character between
          ttymajor and '=' and the number.
       2. Please don't type any space or [TAB] character between
          calloutmajor and '=' and the number.
       3. Please type only one [TAB] character to seperate the 
          columns of the settings.

   a. Major Number
       The real tty driver allows you to change the major number
       manually. So you can modify the major number in "npreal2d.cf".
       And then execute the program "mxloadsvr" with an
       argument "module". For example:

        # cd /usr/lib/npreal2/driver
        # ./mxloadsvr module

       The driver will remove the module and reload the drvier with
       new major number configured in "npreal2d.cf". The connections
       will be closed after the new driver is loaded.
       The following actions will be performed.

        - Unload driver.
        - Re-create all device files configured in "npreal2d.cf"
          with new major number.
        - Load driver.

    b. TTY Name & Callout Name
       Similar to the previous section, modification of tty name and
       callout name will be activated after executing "mxloadsvr".
       Since we do not modify the major number, so the driver will not
       be reloaded. We merely need to execute "mxloadsvr" to reload
       the settings without any argument.
       The following actions will be performed.

        - close connections.
        - Re-create all device files configured in "nperal2d.cf".
        - open the connections.


12. Modification of Initializing Script
      The script file "/etc/rc.d/rc.local" will be executed when linux
      boots up. Therefore the driver will append the instructions which
      is used to load real tty driver in the script file.

13. Technical support
    If you have any technical questions, please send your question by
    the following ways with detail description of the symptom.

    Email: support@moxa.com.tw
    Tel  : +886 2 89191230 ext.300


-End-
