Skip Headers
Oracle® Java Micro Edition Embedded Client Architecture Guide
Release 1.1.1
E23813-02
  Go To Table Of Contents
Contents

Previous
Previous
 
 

C Serial Port Configuration Notes

This appendix describes how to configure an OS-level serial port on a Linux device so that a Java application can use the javax.microedition.io.CommConnection interface to access the corresponding logical serial port connection.

This appendix includes these topics:


Note:

While this example is based on the RS-232 serial interface implementation of CommConnection in com.sun.cdc.io.j2me.comm.Protocol, an alternate implementation could use the CommConnection interface to support other forms of serial communication such as IrDA.


Table C-1 Serial Communications References

Interface Document

RS-232 serial communications

http://tldp.org/HOWTO/Serial-HOWTO-4.html

minicom serial communications program

minicom

Serial port configuration

setserialport

Serial port driver interface

ttyS


Serial Port Setup

  1. Setup a serial cable connection between two Linux computers.

  2. Become super user, then configure the serial port to use IRQ 4.

    # setserial /dev/ttyS0 irq 4
    
  3. Change the file access permissions for the serial port and the lock file.

    # chmod 777 /dev/ttyS0 /var/lock
    

    This allows other users to access the serial port.

  4. Launch the minicom serial communications program in setup mode.

    # minicom -s
    
    1. Select Serial port setup from the [configuration] menu.

    2. In the setup menu, type A to change the Serial Device setting.

      If the Serial Device setting is /dev/modem, then change it to /dev/ttyS0.

    3. Press <ENTER> to confirm the change.

    4. Press <ENTER> again to exit the setup menu.

    5. Select the Save setup as dfl menu option.

    6. Select the Exit menu option.

      This initializes the serial port.

    7. Type <CONTROL>-a q to finally exit minicom.

  5. Follow a similar configuration procedure with the other computer connected to the serial cable.

OS-Level Testing

The serial connection between the two computers can be tested with the minicom serial communications program.

  1. Remotely login to each computer.

  2. Launch the minicom(1) serial communications program on each computer.

  3. Type some text into a minicom window.

  4. Type <CONTROL>-a q to finally exit minicom.

This should determine that the serial connection is correct.