Use Python to access serial ports

You can use the Python serial module to access serial ports on your EX12-PR device that are configured to be in Application mode. See Configure Application mode for information about configuring a serial port in Application mode.

To use Python to access serial ports:

#!/usr/bin/python

import serial
s = serial.Serial("/dev/serial/port1", 115200)
s.write(b"Hello from serial port")

To determine available serial ports:

  1. Select the device in Remote Manager and click Actions > Open Console, or log into the EX12-PR local command line as a user with full Admin access rights.

    Depending on your device configuration, you may be presented with an Access selection menu. Type admin to access the Admin CLI.

  2. Determine available serial ports:
    > ls /dev/serial/
    drwxr-xr-x    2 root     root           240 Nov 12 15:01 by-id
    drwxr-xr-x    2 root     root           240 Nov 12 15:01 by-path
    drwxr-xr-x    2 root     root           240 Nov 12 15:01 by-usb
    crw-rw-rw-    1 root     root        4,  64 Nov 12 15:05 port1
    >
  3. Type exit to exit the Admin CLI.

    Depending on your device configuration, you may be presented with an Access selection menu. Type quit to disconnect from the device.