Networking :: Microcom



I'm able to connect to /dev/ttyS0 using microcom; however, at the login prompt I enter the ID and press Enter and I automatically bypass the password prompt and I receive login failed. I hit enter at the next login prompt and it returns two additional login prompts.

it seems as though echo is turned on but I don't know where to look to disable it.

Any thoughts?

From the Microcom Docs:

Code Sample
microcom Serial Terminal Emulator



  1. Description
2. Features
3. Usage
4. Setup and Help
5. Script Language
6. Distribution
7. LRP disk
8. Support
9. Acknowledgment
1. Description

microcom is a minicom-like serial terminal emulator with scripting support. The requirement for this program was to be small enough to fit on a floppy-based Linux distribution - such as the one from Linux Router Project. We managed to bring the executable size down under 17k, no ncurses library support required.
This software is released under GNU General Public License.

Rev. 1.02 - August 2000
- fixed bug: if the script fails because of a syntax error, terminal settings are not restored correctly upon program exit;
- fixed bug: if a script line is longer than 80 characters, the line will not be interpreted correctly
- fixed documentation
- add modem autodetection
- add log facility

Rev. 1.01 - March 2000
- correctly restore terminal settings upon program exit;
- merge fix submitted by Wesley Stupar: "In the case of ~tn or ~th or ~ts, the pts structure was not getting initialized before saving. It made the connection freeze in my case."

Rev. 1.00 - February 2000

2. Features

Add/strip line feeds, local echo control
Hardware/software flow control support
8 bit, one stop, no parity
Support for standard speeds form 1200 to 460800 bps
Default UNIX tty emulation
BASIC like script language support
Distribution: source code, LINUX executable, LRP based floppy
Automatic modem detection

3. Usage

The command to start microcom is:

microcom [options]
[options] include:
   -Ddevfile       use the specified serial port device;
                   if a port is not provided, microcom
                       will try to autodetect a modem
          example: -D/dev/ttyS3
   -S              run script from script.scr (default)
   -Sscrfile       run script from scrfile

microcom provides session logging in microcom.log file

WinDOS to Linux mapping of the serial ports is as follows

WinDOS Linux
-----------------------------------
com1 /dev/ttyS0
com2 /dev/ttyS1
com3 /dev/ttyS2
com4 /dev/ttyS3

Usage examples:
microcom              - microcom will try to autodetect a modem
microcom -D/dev/ttyS3 - run microcom on /dev/ttyS3 (com4 equiv.)
microcom -S           - start the default script.scr script
microcom -Smyscript   - run the script from myscript file


4. Setup and Help

To access the setup and help facilities of microcom press the ~ key. The program will display the main help screen:  

**********Help***********
      x - quit microcom
      b - send break
      l - log on
      s - start script
      t - set terminal
      q - quit help
*************************

- x - exit microcom;
- b - send a break on the comm line;
- l - start/stop logging data coming on the com port into microcom.log file
- s - start the script: script.scr or the one specified on the command line when the program was started; if the script is already running, same key will stop the script;
- t - go to the terminal help screen.
The terminal help screen:  

******Set terminal ******
      p - set speed
      m - no CR/NL mapping
      n - no flow control
      h - hardware flow control
      s - software flow control
      q - quit help
*************************

- m - enable/disable CR/NL mapping for terminal;
- n, h, s - change the flow control for the comm line - no/hardware/software flow control; the preferred setting when connecting through a modem is hardware flow control;
- p - go to the speed help screen;  
The speed help screen

******Set speed *********
      a - 1200
      b - 2400
      c - 4800
      d - 9600
      e - 19200
      f - 38400
      g - 57600
      h - 115200
      i - 230400
      j - 460800
      q - quit help
*************************
Chose the speed of the serial comm port.

5. Script Language


5.1 Variables
The only type of variable supported by microcom is integer.

5.1.1 Definition and initialization
Use set command to define and initialize a variable.
Example:

    set a 7
Initialize a=7  
5.1.2 Increment
Use inc command to increment the value of the variable.
Example:

   inc a
Increment a.
5.1.3 Decrement
Use dec command to decrement the value of the variable.
Example:

   dec a
Decrementing a variable that has the value 0, will have the result -1 - variables are integers.
5.2 Program control

5.2.1 Comment
A comment line always starts with #.
Example:

   #this is a comment
5.2.2 If statement
Use if statement for conditional branching in the program.
Example:
   if a > 0 print message
or
   if b != a goto label
For conditional testing, the supported operators are:
   !=, =,  >, <    
5.2.3 Goto
Use the goto statement to jump to another line of program.
Example:
   if a > 10 goto label1
   #more program lines .......
label1:
   print message
5.2.4 Suspend program
Use suspend to end the script. By default, when the execution of the script reaches the end, the script is restarted automatically.
Example:
   if a < 10 suspend
5.2.5 Unix shell invocation
A command starting with ! is redirected to the current unix shell
Example:
   ! ls -al
Please note the blank space following ! character.  
5.2.6 Timeout
Use timeout to wait for a specified number of seconds:
Example:

   #wait for 7 seconds
   timeout 7
5.3 Display access
The only operation supported in this category is to send a string to the display using print command.
Example:

   print message
This will print "message\n" on the screen. The string will not get sent to the comm port.
5.4 Comm port access

5.4.1 Send
Use send command to send a string to the comm port.
Example:

  send at&f
This will send "at&f\n" to the comm port.
5.4.2 Expect
Use expect command to wait for a specific string to be received from the comm port.
Example:

   expect CONNECT
The program will wait to get "CONNECT" from the modem.
expect command also implements a timeout of 60 seconds. In case the expected string does not arrive form comm port, the command will timeout and it will automatically restart the script from the beginning. This functionality is used in implementing error recovery in the script, as in the next example:

   #the script starts by sending several \n to the modem;
   #this is the error recovery phase,
   #just in case the first time it timeout the expect command;
   send
   send
   #just reset the modem
   send at&f
   #dial phone number
   send attd 2225151
   #wait for the connection - timeout and restart the script if necessary
   expect CONNECT
   print Call connected

6. Distribution
 

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.  
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

m102.tar.gz (xx,xxx bytes) - source code for microcom,  Linux (Mandrake 6.0) executable;  

floppy.tar.gz (1,380,153) - utilities and image to create a LRP disk (no FPU emulation) with microcom installed  
 

7. LRP disk

Linux Router Project (LRP) is a networking-centric micro-distribution of Linux. LRP is small enough to fit on a single 1.44MB floppy disk, and makes building and maintaining routers, access servers, thin servers, thin clients, network appliances, and typically embedded systems next to trivial.
floppy.img is the original LRP disk image, with support for serial port and microcom terminal emulator. This image has to be transferred on a blank DOS formatted floppy disk.
- under DOS: run rawrite2.exe and supply the drive and image file when prompted
- under Linux:
     dd if=floppy.img of=/dev/fd0
rawrite2.exe program is included in the distribution.

8. Support

The development page for microcom is located at sourceforge.net. You can also email us.

9. Acknowledgment

The starting point of microcom Serial Terminal Emulator was robin.c program described in Linux Application Development by Michael K. Johnson and Erik W. Troan.

The backbone of the scripting facilities of microcom is script.c developed by Miquel van Smoorenburg for minicom program.


--------------------------------------------------------------------------------
top / email  



original here.