Moxa Arm Based Computer Linux User Manual For Debian 9 v4.2
Moxa Arm Based Computer Linux User Manual For Debian 9 v4.2
www.moxa.com/product
The software described in this manual is furnished under a license agreement and may be used only in accordance
with the terms of that agreement.
Copyright Notice
Trademarks
Disclaimer
Information in this document is subject to change without notice and does not represent a commitment on the part of
Moxa.
Moxa provides this document as is, without warranty of any kind, either expressed or implied, including, but not
limited to, its particular purpose. Moxa reserves the right to make improvements and/or changes to this manual, or to
the products and/or the programs described in this manual, at any time.
Information provided in this manual is intended to be accurate and reliable. However, Moxa assumes no responsibility
for its use, or for any infringements on the rights of third parties that may result from its use.
This product might include unintentional technical or typographical errors. Changes are periodically made to the
information herein to correct such errors, and these changes are incorporated into new editions of the publication.
www.moxa.com/support
Moxa Americas Moxa China (Shanghai office)
Toll-free: 1-888-669-2872 Toll-free: 800-820-5036
Tel: +1-714-528-6777 Tel: +86-21-5258-9955
Fax: +1-714-528-6778 Fax: +86-21-5258-5505
Moxa India
Tel: +91-80-4172-9088
Fax: +91-80-4132-1045
Table of Contents
This user manual is applicable to Moxa’s Arm-based computers listed below and covers the complete set of
instructions applicable to all the supported models. Detailed instructions on configuring advanced settings
are covered in Chapter 3 & Chapter 4 of the manual. Before referring to sections in chapters 3 & 4, make
sure that the hardware specification of your computer model supports the functions/settings covered in
these sections.
• UC-2100 Series
• UC-2100-W Series
• UC-3100 Series
• UC-5100 Series
• UC-8100 Series (firmware V3.0.0 and higher)
• UC-8100-ME-T Series (Model with Moxa Industrial Linux preinstalled)
• UC-8100A-ME-T Series
• UC-8200 Series
Moxa Industrial Linux (MIL) is the optimized Linux distribution for Industrial applications and users, which is
released and maintained by Moxa.
The MIL is based on Debian and integrated with several feature sets designed for strengthening and
accelerating user’s application development as well as ensuring the reliability of system deployment.
Furthermore, the major versions of MIL comply with Moxa’s Superior long term support (SLTS) policy. Moxa
will maintain each version of the MIL for 10 years from its launch date. The extended support (ES) may also
be purchased by request for additional maintenance. This makes MIL an optimal choice as a Linux operating
system for industrial applications.
2
2. Getting Started
In this chapter, we describe how to configure the basic settings Moxa’s Arm-based computers.
System Administration
Querying the Firmware Version
74B
Username: moxa
Password: moxa
The username and password are the same for all serial console and SSH remote log in actions. Root account
login is disabled until you manually create a password for the account. The user moxa is in the sudo group
so you can operate system level commands with this user using the sudo command. For additional details,
see the Sudo Mechanism section in chapter 5.
ATTENTION
For security reasons, we recommend that you disable the default user account and create your own user
accounts.
This method is particularly useful when using the computer for the first time. The signal is transmitted over
a direct serial connection so you do not need to know either of its two IP addresses in order to connect to
the Arm-based computer. To connect through the serial console, configure your PC’s terminal software using
the following settings.
Below we show how to use the terminal software to connect to the Arm-based computer in a Linux
environment and in a Windows environment.
Linux Users
152B
NOTE These steps apply to the Linux PC you are using to connect to the Arm-based computer. Do NOT apply these
steps to the Arm-based computer itself.
Take the following steps to connect to the Arm-based computer from your Linux PC.
2-2
Arm-based Computer Linux UM Getting Started
4. Select A to change the serial device. Note that you need to know which device node is connected to the
Arm-based computer.
5. Select E to configure the port settings according to the Serial Console Port Settings table provided.
6. Select Save setup as dfl (from the main configuration menu) to use default values.
7. Select Exit from minicom (from the configuration menu) to leave the configuration menu.
8. Execute minicom after completing the above configurations.
user@PC1:~# minicom
Windows Users
153B
NOTE These steps apply to the Windows PC you are using to connect to the Arm-based computer. Do NOT apply
these steps to the Arm-based computer itself.
Take the following steps to connect to the Arm-based computer from your Windows PC.
2-3
Arm-based Computer Linux UM Getting Started
3. Select the Serial connection type and choose settings that are similar to the Minicom settings.
The Arm-based computer supports SSH connections over an Ethernet network. Use the following default IP
addresses to connect to the Arm-based computer.
Port Default IP
LAN 1 192.168.3.127
LAN 2 192.168.4.127
Linux Users
154B
NOTE These steps apply to the Linux PC you are using to connect to the Arm-based computer. Do NOT apply these
steps to the Arm-based computer itself. Before you run the ssh command, be sure to configure the IP
address of your notebook/PC's Ethernet interface in the range of 192.168.3.0/24 for LAN1 and
192.168.4.0/24 for LAN2.
Use the ssh command from a Linux computer to access the computer’s LAN1 port.
2-4
Arm-based Computer Linux UM Getting Started
ATTENTION
Rekey SSH regularly
In order to secure your system, we suggest doing a regular SSH-rekey, as shown in the following steps:
When prompted for a passphrase, leave the passphrase empty and press enter.
moxa@Moxa:~$ cd /etc/ssh
moxa@Moxa:~$ sudo rm –rf
ssh_host_ed25519_key2 ssh_host_ecdsa_key ssh_host_rsa_key
ssh_host_ed25519_key.pub ssh_host_ecdsa_key.pub ssh_host_rsa_key.pub
https://wiki.debian.org/SSH
Windows Users
15B
NOTE These steps apply to the Windows PC you are using to connect to the Arm-based computer. Do NOT apply
these steps to the Arm-based computer itself.
2-5
Arm-based Computer Linux UM Getting Started
You can switch to root using sudo -i (or sudo su). For security reasons, do not operate the all
commands from the root account.
NOTE Click the following link for more information on the sudo command.
https://wiki.debian.org/sudo
ATTENTION
You might get the permission denied message when using pipe or redirect behavior with a non-root
account.
You must use ‘sudo su –c’ to run the command instead of using >, <, >>, <<, etc.
Note: The single quotes around the full command are required.
ATTENTION
You should first create a user account before you disable the default account.
Use the passwd command to lock the default user account so that the moxa user cannot log in.
2-6
Arm-based Computer Linux UM Getting Started
Network Settings
After the first login, you can configure the Arm-based computer’s network settings to fit your application
better. Note that it is more convenient to manipulate the network interface settings from the serial console
than from an SSH login because an SSH connection can disconnect when there are network issues and the
connection must be reestablished.
In this section, we use the serial console to configure the Arm-based computer’s network settings. Follow
the instructions in the Connecting to the Arm-based Computer section under Getting Started, to access the
Console Utility of the target computer via the serial Console port, and then type cd /etc/network to
change directories.
moxa@Moxa:~$ cd /etc/network/
moxa@Moxa:/etc/network/~$
Type sudo vi interfaces to edit the network configuration file in the vi editor. You can configure the
Arm-based computer’s Ethernet ports to use either static or dynamic (DHCP) IP addresses.
To set a static IP address for the Arm-based computer, use the iface command to modify the default
gateway, address, network, netmask, and broadcast parameters of the Ethernet interface.
2-7
Arm-based Computer Linux UM Getting Started
To configure one or both LAN ports to request an IP address dynamically use the dhcp option in place of the
static in the iface command as follows:
System Administration
The Arm-based computer has two time settings. One is the system time, and the other is the RTC (Real
Time Clock) time kept by the Arm-based computer’s hardware. Use the date command to query the
current system time or set a new system time. Use the hwclock command to query the current RTC time
or set a new RTC time.
MM = Month
DD = Date
hhmm = hour and minute
Use the following command to set the RTC time to system time:
moxa@Moxa:~$ sudo hwclock –w
moxa@Moxa:~$ sudo hwclock
2018-07-31 02:09:00.628145+0000
NOTE Click the following links for more information on date and time:
https://www.debian.org/doc/manuals/system-administrator/ch-sysadmin-time.html
https://wiki.debian.org/DateTime
2-8
Arm-based Computer Linux UM Getting Started
There are two ways to configure the Moxa embedded computer’s time zone. One is using the TZ variable.
The other is using the /etc/localtime file.
Here are some possible settings for the North American Eastern time zone:
1. TZ=EST5EDT
2. TZ=EST0EDT
3. TZ=EST0
In the first case, the reference time is GMT and the stored time values are correct worldwide. A simple
change of the TZ variable can print the local time correctly in any time zone.
In the second case, the reference time is Eastern Standard Time and the only conversion performed is for
Daylight Saving Time. Therefore, there is no need to adjust the hardware clock for Daylight Saving Time
twice per year.
In the third case, the reference time is always the time reported. You can use this option if the hardware
clock on your machine automatically adjusts for Daylight Saving Time or you would like to manually adjust
the hardware time twice a year.
moxa@Moxa:~$ TZ=EST5EDT
moxa@Moxa:~$ export TZ
You must include the TZ setting in the /etc/rc.local file. The time zone setting will be activated when
you restart the computer.
The following table lists other possible values for the TZ environment variable:
2-9
Arm-based Computer Linux UM Getting Started
The local time zone is stored in the /etc/localtime and is used by GNU Library for C (glibc) if no value
has been set for the TZ environment variable. This file is either a copy of the /usr/share/zoneinfo/ file
or a symbolic link to it. The Arm-based computer does not provide /usr/share/zoneinfo/ files. You
should find a suitable time zone information file and write over the original local time file in the Arm-based
computer.
moxa@Moxa:~$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 803M 238M 524M 32% /
/dev/root 803M 238M 524M 32% /
tmpfs 25M 188K 25M 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 10M 0 10M 0% /dev
tmpfs 50M 0 50M 0% /run/shm
You can use the Linux command shutdown to close all software running on the device and halt the system.
However, main components such as the CPU, RAM, and storage devices will continue to be powered after
you run this command.
2-10
3
3. Advanced Configuration of Peripherals
In this chapter, we include more information on the Arm-based computer’s peripherals, such as the serial
interface, storage, diagnostic LEDs, and the cellular module. The instructions in this chapter cover all
functions supported in Moxa’s Arm-based computers. Before referring to the sections in this chapter, make
sure that they are applicable to and are supported by the hardware specification of your Arm-based
computer.
Serial Ports
Changing the Terminal Settings
7BT
USB Port
USB Automount
CAN Bus Interface
Configuring the Socket CAN Interface
CAN Bus Programming Guide
Real COM Mode Configuration
Mapping TTY Ports
Mapping tty Ports (automatic)
Mapping tty Ports Manually
Removing Mapped TTY Ports
Arm-based Computer Linux UM Advanced Configuration of Peripherals
Serial Ports
The serial ports support RS-232, RS-422, and RS-485 2-wire operation modes with flexible baudrate
settings. The default operation mode is RS-232; use the mx-uart-ctl command to change the operation
mode.
For example, to set Port 0 to the RS-485 4-wire mode, use the following command:
root@Moxa:/home/moxa# mx-uart-ctl -p 0
Current uart mode is RS232 interface.
root@Moxa:/home/moxa# mx-uart-ctl -p 0 -m 2
Set OK.
Current uart mode is RS422/RS485-4W interface.
The stty command is used to manipulate the terminal settings. You can view and modify the serial
terminal settings with this command. Details are given below.
3-2
Arm-based Computer Linux UM Advanced Configuration of Peripherals
NOTE Detailed information on the stty utility is available at the following link:
http://www.gnu.org/software/coreutils/manual/coreutils.html
USB Port
The Arm-based computers are provided with a USB port for storage expansion.
USB Automount
The Arm-based computers support hot plug function for connecting USB mass storage devices. However, by
default, the automount utility (udev) only supports auto-mounting of one partition. Use the mount
command to view details about all partitions.
ATTENTION
Remember to type the sync command before you disconnect the USB mass storage device to prevent loss
of data.
Exit from the /media/* directory when you disconnect the storage device. If you stay in /media/usb*, the
auto unmount process will fail. If that happens, type #umount /media/usb* to unmount the device
manually.
3-3
Arm-based Computer Linux UM Advanced Configuration of Peripherals
# ip link
can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT
group default qlen 10 link/can
To configure the CAN device, use # ip link set can0 down to turn off the device first
CAN Write
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <net/if.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/can.h>
#include <linux/can/raw.h>
int main(void)
{
int s;
int nbytes;
struct sockaddr_can addr;
struct can_frame frame;
struct ifreq ifr;
char *ifname = "can1";
if((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
perror("Error while opening socket");
return -1;
}
strcpy(ifr.ifr_name, ifname);
ioctl(s, SIOCGIFINDEX, &ifr);
addr.can_family = AF_CAN;
addr.can_ifindex = ifr.ifr_ifindex;
printf("%s at index %d\n", ifname, ifr.ifr_ifindex);
if(bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
3-4
Arm-based Computer Linux UM Advanced Configuration of Peripherals
CAN Read
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <net/if.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/can.h>
#include <linux/can/raw.h>
Int main(void)
{
int i;
int s;
int nbytes;
struct sockaddr_can addr;
struct can_frame frame;
struct ifreq ifr;
char *ifname = "can0";
if((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
perror("Error while opening socket");
return -1;
}
strcpy(ifr.ifr_name, ifname);
ioctl(s, SIOCGIFINDEX, &ifr);
addr.can_family = AF_CAN;
addr.can_ifindex = ifr.ifr_ifindex;
printf("%s at index %d\n", ifname, ifr.ifr_ifindex);
if(bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
perror("Error in socket bind");
return -2;
}
nbytes = read(s, &frame, sizeof(struct can_frame));
if (nbytes < 0) {
perror("Error in can raw socket read");
return 1;
}
if (nbytes < sizeof(struct can_frame)) {
fprintf(stderr, "read: incomplete CAN frame\n");
3-5
Arm-based Computer Linux UM Advanced Configuration of Peripherals
return 1;
}
printf(" %5s %03x [%d] ", ifname, frame.can_id, frame.can_dlc);
for (i = 0; i < frame.can_dlc; i++)
printf(" %02x", frame.data[i]);
printf("\n");
return 0;
}
After you use the SocketCAN API, the SocketCAN information is written to the paths:
/proc/sys/net/ipv4/conf/can* and /proc/sys/net/ipv4/neigh/can*
You can use Moxa’s NPort series serial device drivers to extend the number of serial interfaces (ports) on
your Arm-based Moxa computer. The NPort comes equipped with COM drivers that work with Windows
systems and TTY drivers for Linux systems. The driver establishes a transparent connection between the
host and serial device by mapping the IP Port of the NPort’s serial port to a local COM/TTY port on the host
computer.
Real COM Mode also supports up to 4 simultaneous connections, so that multiple hosts can collect data from
the same serial device at the same time.
One of the major conveniences of using Real COM Mode is that Real COM Mode allows users to continue
using RS-232/422/485 serial communications software that was written for pure serial communications
applications. The driver intercepts data sent to the host’s COM port, packs it into a TCP/IP packet, and then
redirects it through the host’s Ethernet card. At the other end of the connection, the NPort accepts the
Ethernet frame, unpacks the TCP/IP packet, and then sends it transparently to the appropriate serial device
attached to one of the NPort’s serial ports.
The Real COM driver is installed on the Arm-based computer by default. You will be able to view the driver
related files in the /usr/lib/npreal2/driver folder.
> mxaddsvr (Add Server, mapping tty port) > mxdelsvr (Delete Server,
unmapping 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. For a list of supported
NPort devices and their revision history, click https://www.moxa.com/en/support/search?psid=50278.
3-6
Arm-based Computer Linux UM Advanced Configuration of Peripherals
# cd /usr/lib/npreal2/driver
# ./mxaddsvr 192.168.3.4 16
In this example, 16 tty ports will be added, all with IP 192.168.3.4 consisting of data ports from 950 to 965
and command ports from 966 to 981.
# cd /usr/lib/npreal2/driver
# ./mxaddsvr 192.168.3.4 16 4001 966
In this example, 16 tty ports will be added, all with IP 192.168.3.4, with data ports from 4001 to 4016 and
command ports from 966 to 981.
Example:
# cd /usr/lib/npreal2/driver
# ./mxdelsvr 192.168.3.4
The following actions are performed when the mxdelsvr command is executed:
1. Modify npreal2d.cf.
2. Remove the relevant tty ports from the /dev directory.
3. Restart the driver.
If the IP address is not provided in the command line, the program will list the installed servers and total
ports on the screen. You will need to choose a server from the list for deletion.
3-7
4
4. Configuring of Wireless Connectivity
The instructions in this chapter cover all wireless functions supported in Moxa’s Arm-based computers.
Before referring to the sections in this chapter, make sure that they are applicable to and are supported by
the hardware specification of your Arm-based computer platform.
Using Cell_mgmt
The cell_mgmt utility is used to manage the cellular module in the computer. To run the cell_mgmt
command, you must use sudo or run the command with root permission. The utility does not support SMS
and MMS communication.
Manual Page
NAME
cell_mgmt
USAGE
cell_mgmt [-i <module id>] [options]
OPTIONS
-i <module id>
Module identifier, start from 0 and default to 0.
-s <slot id>
Slot identifier, start from 1 and default value depends
on module interface.
example: module 0 may in slot 2
modules
Shows module numbers supported.
slot
Shows module slot id
interface [interface id]
Switching and checking module interface(s)
start [OPTIONS]
Start network.
OPTIONS:
PIN - PIN code
Phone - Phone number (especially for AT based modules)
Auth - Authentication type(CHAP|PAP|BOTH), default=NONE.
Username
Password
example:
cell_mgmt start
cell_mgmt start PIN=0000
cell_mgmt start PIN=0000 Phone=*99#
cell_mgmt start PIN=0000 Phone=*99# \
Auth=BOTH Username=moxa Password=moxamoxa
stop
network.
power_on
Power ON.
power_off
Power OFF.
power_cycle
Power cycle the module slot.
4-2
Arm-based Computer Linux UM Configuring of Wireless Connectivity
switch_sim <1|2>
Switch SIM slot.
gps_on
GPS ON.
gps_off
GPS OFF.
attach_status
Query network registration status.
status
Query network connection status.
signal
Get signal strength.
at <'AT_COMMAND'>
Input AT Command.
Must use SINGLE QUOTATION to enclose AT Command.
sim_status
Query sim card status.
unlock_pin <PIN>
Unlock PIN code and save to configuration file.
pin_retries
Get PIN code retry remain times.
pin_protection <enable|disable> <current PIN>
Set PIN protection in the UIM.
set_flight_mode <0|1>
Set module into flight mode (1) or online mode (0).
set_apn <APN>
Set APN to configuration file.
check_carrier
Check current carrier.
switch_carrier <Verizon|ATT|Sprint|Generic>
Switching between US carrier frequency bands.
m_info
Module/SIM information.
module_info
Module information.
module_ids
Get device IDs (ex: IMEI and/or ESN).
iccid
Get SIM card ID
imsi
Get IMSI (International Mobile Subscriber Identity).
location_info
Get cell location information.
operator
Telecommunication operator.
vzwauto
Verizon Private Network auto dialup.
version
Cellular management version.
4-3
Arm-based Computer Linux UM Configuring of Wireless Connectivity
Dial-up Process
Before dialing, ensure that the APN (Access Point Name) is set correctly and the cellular module has attach
with the base station.
1. Unlock the PIN code if the SIM is locked using a PIN code.
Use the cell_mgmt sim_status command to check the SIM card status and the cell_mgmt
unlock_pin <PIN> command to unlock the SIM card if a SIM PIN is set.
moxa@Moxa:/home/moxa$ sudo cell_mgmt sim_status
+CPIN: READY
2. Use the cell_mgmt set_apn <APN> command to set the name of the access point that will be used
to connect to the carrier.
moxa@Moxa:/home/moxa$ sudo cell_mgmt set_apn internet
old APN=test, new APN=internet
3. Check if the service attaches with the correct APN.
moxa@Moxa:/home/moxa$ sudo cell_mgmt attach_status
CS: attached
PS: attached
PS (packet-switched) should be attached for network connection
Dial-up Commands
cell_mgmt start
To start a network connection, use the default cellular module of the computer (If the computer supports
multiple modules, use the cell_mgmt interface command to verify the default module that is selected).
If you run the cell_mgmt start command with the Username, Password, and PIN, all the configurations will
be written into the configuration file /etc/moxa-cellular-utils/moxa-cellular-utils.conf.
This information is then used when you run the command without specifying the options.
cell_mgmt stop
4-4
Arm-based Computer Linux UM Configuring of Wireless Connectivity
cell_mgmt status
cell_mgmt signal
For moxa-cellular-utils version 2.0.0 and later, cellular signal strength is indicated using levels.
Level Description
5 Excellent
4 Good
3 Fair
2 Poor
1 Very Poor
0 No Signal
For moxa-cellular-utils versions prior to version 2.0.0, the cellular signal strength is measured using
Reference Signal Received Power (RSRP). The following table lists the signal strength for RSRP ranges.
cell_mgmt operator
4-5
Arm-based Computer Linux UM Configuring of Wireless Connectivity
Cellular Module
cell_mgmt module_info
Provides information of the cellular module (AT port, GPS port, QMI port, and module name, etc.).
Used to view the supported modules and default module on the computer with their IDs. Change the default
module by specifying the ID.
cell_mgmt power_cycle
Use the cell_mgmt power_cycle command to power cycle the cellular module in the computer. You may
see a kernel message that the module has been reloaded.
4-6
Arm-based Computer Linux UM Configuring of Wireless Connectivity
cell_mgmt check_carrier
The cell_mgmt check_carrier command helps to check if the current carrier matches with the service
(SIM card) provider.
cell_mgmt switch_carrier
Some modules provide multiple carrier support. Use the cell_mgmt switch_carrier command to
switch between carriers. It may take some time (depending on the module's mechanism) to switch between
carriers.
For the UC-2114 and UC-2116 computers, refer to the following table for a list of the cellular carriers
supported.
4-7
Arm-based Computer Linux UM Configuring of Wireless Connectivity
OK
OK
4-8
Arm-based Computer Linux UM Configuring of Wireless Connectivity
cell_mgmt at AT_COMMAND
Used to input an AT command. For example, use the AT command, AT+CSQ as follows:
+CSQ: 18,99
OK
4-9
Arm-based Computer Linux UM Configuring of Wireless Connectivity
NOTE • The APN name 'internet.iot' is set by the user. For information on the APN settings, contact your mobile
network operator.
• A PPP dial-up connection that uses Cat. M1 and CAT. NB1 may sometimes take a couple of minutes to
establish a connection if the signal is weak.
• Power saving mode (PSM) is not supported in the UC-2114 and UC-2116 computers.
cell_mgmt at AT+URAT?
+URAT: 7,8
OK
7: CAT-M1
8: NB-IOT
GPS
UC-8112-ME-T-US-LTE Model
To view the GPS information for the UC-8112-ME-T-US-LTE model, do the following:
4-10
Arm-based Computer Linux UM Configuring of Wireless Connectivity
Type the following command to get the GPS location information from the GPS port.
Configuring WPA2
Moxa’s Arm-based computers support WPA2 security using the /sbin/wpa_supplicant program. Refer to
the following table for the configuration options. The Key required before joining network? column
specifies whether an encryption and/or authentication key must be configured before associating with a
network.
Using wifi_mgmt
Manual Page
4-11
Arm-based Computer Linux UM Configuring of Wireless Connectivity
start
Connect to the last time AP that was used.
scan -d
Scan all the access points information and show the detail message.
scan
Scan all the access points information.
signal
Show the AP's signal.
list
Show the managed AP list.
insert Type=[type] SSID=[ssid] Password=[password]
Insert a new AP information to the managed AP list.
[type] open/wep/wpa/wpa2
[ssid] access point's SSID
[password] access point's password
example:
wifi_mgmt insert Type=wpa SSID=moxa_ap Password=moxa
select [num]
Select an AP num to connect which is in the managed AP list.
stop
Stop network.
status
Query network connection status.
interface [num]
Switch to another wlan[num] interface.
[num] interface number
example:
wifi_mgmt interface 0
interface
Get the current setting interface.
reconnect
Reconnect to the access point.
restart
Stop wpa_supplicant then start it again.
version
Wifi management version.
Connecting to an AP
You can connect your computer to an AP using the following three commands. The DNS and default gateway
will be configured automatically. If you want to use the wireless interface’s gateway, you must clean up
your computer’s default gateway configuration.
4-12
Arm-based Computer Linux UM Configuring of Wireless Connectivity
wifi_mgmt start
Connect to the previous AP that was used.
Use the wifi_mgmt command to connect to the AP “MOXA_AP1” that was used the previous time as
follows:
wifi_mgmt stop
root@Moxa:~# wifi_mgmt stop
Stopped.
wifi_mgmt restart
root@Moxa:~# wifi_mgmt restart
wpa_supplicant is closed!!
wpa_state=COMPLETED
*** Get DHCP IP address from AP ***
*** Get DHCP IP from AP! ***
4-13
Arm-based Computer Linux UM Configuring of Wireless Connectivity
If you want to use another AP to connect, use the wifi_mgmt select command to switch to the AP.
Other Functions
wifi_mgmt scan
Scan all of the access point information.
wifi_mgmt scan -d
Scan all of the access point information and show a detailed message.
4-14
Arm-based Computer Linux UM Configuring of Wireless Connectivity
Channel:11
Frequency:2.462 GHz (Channel 11)
Quality=25/70 Signal level=-85 dBm
Encryption key:on
ESSID:"MHQ-Mobile"
9 Mb/s; 12 Mb/s; 18 Mb/s
Mode:Master
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : 802.1x
Preauthentication Supported
More.. .. ..
wifi_mgmt signal
Show the AP’s signal.
wifi_mgmt delete
root@Moxa:~# wifi_mgmt list
network id / ssid / bssid / flags
0 MOXA_AP1 any [CURRENT]
1 MOXA_AP1 any [DISABLED]
2 MOXA_AP3 any [DISABLED]
root@Moxa:~# wifi_mgmt delete 2
***** WARNING *****
Are you sure that you want to delete network id 2 (y/n)y
network id / ssid / bssid / flags
0 MOXA_AP1 any
1 MOXA_AP2 any [DISABLED]
wifi_mgmt status
root@Moxa:~# wifi_mgmt status
bssid=b0:b2:dc:dd:c9:e4
ssid=MOXA_AP1
id=0
mode=station
pairwise_cipher=TKIP
group_cipher=TKIP
key_mgmt=WPA-PSK
wpa_state=COMPLETED
ip_address=192.168.1.36
address=00:0e:8e:4c:13:5e
4-15
Arm-based Computer Linux UM Configuring of Wireless Connectivity
wifi_mgmt reconnect
root@Moxa:~# wifi_mgmt reconnect
wpa_state=SCANNING
wpa_state=SCANNING
wpa_state=COMPLETED
*** Get DHCP IP address from AP ***
*** Get DHCP IP from AP! ***
wifi_mgmt version
root@Moxa:~# wifi_mgmt version
wifi_mgmt version 1.0 Build 15050223
You can edit the /etc/wpa_supplicant/wpa_supplicant.conf file to configure a Wi-Fi connection. The
following is an example of the configuration file for an OPEN/WEP/WPA/WPA2 access point.
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
update_config=1
### Open system ###
#network={
# ssid="Open"
# key_mgmt=NONE
#}
###################
##### WEP #####
#network={
# ssid="WEP-ssid"
# bssid=XX:XX:XX:XX:XX:XX
# key_mgmt=NONE
# wep_key0=KEY
#}
###############
##### WPA/WPA2 PSK #####
#network={
# ssid="WPA-ssid"
# proto=WPA WPA2 RSN
# key_mgmt=WPA-PSK
# pairwise=TKIP CCMP
# group=TKIP CCMP
# psk="KEY"
#}
#######################
4-16
Arm-based Computer Linux UM Configuring of Wireless Connectivity
The -B option should be included because it forces the supplicant to run in the background.
1. Connect with the following command after editing the wpa_supplicant.conf file:
root@Moxa:~# wpa_supplicant -i wlan0 -c
/etc/wpa_supplicant/wpa_supplicant.conf –B
2. Use the #sudo apt-get install wireless-tools command to install the Wi-Fi utility.
You can use the iwconfig command to check the connection status. The response you receive should
be similar to the following:
wlan0 IEEE 802.11abgn ESSID:"MOXA_AP"
Mode:Managed Frequency:2.462 GHz Access Point: 00:1F:1F:8C:0F:64
Bit Rate=36 Mb/s Tx-Power=27 dBm
Retry min limit:7 RTS thr:off Fragment thr:off
Encryption key:1234-5678-90 Security mode:open
Power Management:off
Link Quality=37/70 Signal level=-73 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
WARNING
Moxa strongly advises against using the WEP and WPA encryption standards. Both are now
officially deprecated by the Wi-Fi Alliance, and are considered insecure. To guarantee good Wi-Fi encryption
and security, use WPA2 with the AES encryption algorithm.
4-17
5
5. Security
Moxa’s Arm-based computers offer better security by introducing Moxa’s innovative secure boot feature,
and the integration of a Trusted Platform Module gives the user more solid protection for the platform.
Sudo Mechanism
Cybersecurity—Moxa Security Utility
Installing the Moxa Security Utility
Uninstalling the Moxa Security Utility
Utilizing the Moxa Security Utility
Arm-based Computer Linux UM Security
Sudo Mechanism
In an Arm-based computer, the root account is disabled in favor of better security. Sudo is a program
designed to let system administrators allow permitted users to execute some commands as the root user or
another user. The basic philosophy is to give as few privileges as possible but still allow people to get their
work done. Using sudo is better (safer) than opening a session as root for a number of reasons, including:
• Nobody needs to know the root password (sudo prompts for the current user's password). Extra
privileges can be granted to individual users temporarily, and then taken away without the need for a
password change.
• It is easy to run only the commands that require special privileges via sudo; the rest of the time, you
work as an unprivileged user, which reduces the damage caused by mistakes.
• Some system-level commands are not available to the user moxa directly, as shown in the sample
output below:
moxa@Moxa:~$ ifconfig
-bash: ifconfig: command not found
5-2
Arm-based Computer Linux UM Security
This section explains the procedure to set up the Moxa Security Utility on Moxa’s platform and build up the
security protection level. The utilization of the Moxa Security utility is discussed in detail in this user’s guide,
which is divided into the following sections:
Important: You should have root (user) privileges to be able to install the Moxa Security Utility.
Use the apt-get command to install the utility on your Armv7 platform as follows:
Important: You should have root (user) privileges to be able to install the Moxa Security Utility.
Parameters
The Moxa Security Utility provides the following parameters. The options available in the set and get
commands vary based on the different security levels.
Options Description
-s, --switch [STAGE] Setup the platform environment by security level. [STAGE]:
• level0—Default security settings.
• level1—IEC-62443 security level1 settings
• level2—IEC-62443 security level2 settings.
• level2_plus—IEC-62443 security level2 and some enhanced security
settings.
-c, --check Check all of the security related status.
-v, --version Show the Moxa Security Utility version.
-h, --help Show the Moxa Security Utility usage.
-l, --level Show the current security level.
5-3
Arm-based Computer Linux UM Security
Commands Description
set-guard-intv [TIME] Set checking interval time.
The Moxa Security Utility daemon will scan the system at the time interval
specified.
[TIME] - (10 to 99999) minutes.
set-wl-restrict Set wireless access restriction policies.
[OPTION] [OPTION]:
0—Does not allow user control the device via wireless interface
1—Only allow the specified user to control the device via wireless interface
2—Allow all users to control the device via wireless interface.
set-isolated-run Run a program in isolated environment.
[COMMAND] [COMMAND]: A command that you want to execute in isolated environment.
If [COMMAND] is empty, it will enter into an isolated bash environment.
set-integrity-db Setup the integrity database by using the integrity tool.
You can use the command options 0, 1, 2 to 2 plus to check the current security level.
# mx-security –l
# mx-security -c
You can use the -h command option to view the command parameters.
# mx-security -h
NOTE The command will display different sets of options depends on current system’s security level.
5-4
Arm-based Computer Linux UM Security
# mx-security –v
# mx-security --version
# mx-security -s [stage]
# mx-security -switch [stage]
[stage]
level0 - Default security settings.
level1 - IEC-62443 security level1 settings.
level2 - IEC-62443 security level2 settings.
level2_plus - IEC-62443 security level2 and some enhanced security settings.
5-5
Arm-based Computer Linux UM Security
You can set the checking interval for the guard daemon from 10 to 99999 minutes. The default setting is
1440 min.
You can view the checking interval of the guard daemon as follows:
You can choose the wireless interface restriction rule from three different policies as follows:
[Option]:
0 - Does not allow user control the device via wireless interface (Default).
1 - Only allow the specified user to control the device via wireless interface.
2 - Allow all users to control the device via wireless interface.
For instance, you could set to option 0 if you like to block all users to control the device via the wireless
interface.
NOTE If you would like to configure user lists for wireless access, edit the configuration file, and specify the users
based on IP addresses, edit the wireless_allow.conf file.
# vim /etc/mx-security/mx-security.conf.d/wireless_allow.conf.
5-6
Arm-based Computer Linux UM Security
You can check the current wireless interface restriction policy as follows:
# mx-security get-wl-restrict
For instance, if we like to execute the “ls -l” command in the isolated environment, the utility will create a
new pid to perform the task and shut it down after it is done.
You can switch to an isolated bash environment using the following command.
# mx-security set-isolated-run
5-7
Arm-based Computer Linux UM Security
You can enable the integrity checking mechanism in the Moxa Security utility to monitor the data integrity of
selected databases.
You will first need to use the set-integrity-database command option to create a new database that
reflects the current state of the system.
# mx-security set-integrity-db
After creating an integrity database, you can use the get-integrity-info command option to compare
the current state of the system to a database containing a snapshot of the system, when it was in a known
state.
# mx-security get-integrity-info
NOTE If you like to configure the target directory of the integrity database, use the following command to edit the
configuration file:
# vim /etc/integrit/integrit.conf
5-8
Arm-based Computer Linux UM Security
You can set the auto-logout time of SSH session connection through the utility. Default is 600 seconds
[FILTER] is the keyword that you want to search for in the log message.
For instance, you can search the log message for the “sudo” command as follows:
5-9
Arm-based Computer Linux UM Security
You can also get Debian package related messages, such as install and remove packages using the get-
package-log command.
[FILTER] is the keyword that you want to search in the log message.
For instance, if you like to search the log of “systemd” related package
You can get network interface related message, such as link up, link down using the get-network-log
command option.
mx-security get-network-log
5-10
6
6. Firmware Update and System Recovery
Set-to-default
Press and hold the reset button between 7 to 9 seconds to reset the computer to the factory default
settings. When the reset button is held down, the LED will blink once every second. The LED will become
steady when you hold the button continuously for 7 to 9 seconds. Release the button within this period to
load the factory default settings. For additional details on the LEDs, refer to the quick installation guide or
the user’s manual for your Arm-based computer.
ATTENTION
Reset-to-default will erase all the data stored on the boot storage
Please back up your files before resetting the system to factory defaults. All the data stored in the Arm-
based computer’s boot storage will be destroyed after resetting to factory defaults.
You can also use the mx-set-def command to restore the computer to factory default:
IMPORTANT!
The UC-8100 Series does not support Moxa’s Firmware Update and Set-to-default functions. Use the following
command to reset the system to the default settings.
IMPORTANT!
Use this method to upgrade the firmware on your computer if the size of the firmware file is less than 2 GB.
If the file size is more than 2 GB, use the SD card to upgrade the firmware.
6-2
Arm-based Computer Linux UM Firmware Update and System Recovery
1. To update the firmware, log in to the product through the serial console. Instructions on how to connect
to the serial console can be found in the Hardware user’s manual for your Arm-based computer.
2. After powering on the computer, press <DEL> or <Backspace>to enter the bootloader configuration
settings.
If you cannot enter the bootloader menu by pressing <DEL>, replace the PuTTy tool by the
Tera Term terminal console tool. (Detailed information is available at:
https://ttssh2.osdn.jp/index.html.en)
----------------------------------------------------------------------------
Model: UC-2112-LX
Boot Loader Version 1.0.0S09 CPU TYPE: 1GHz
Build date: Apr 9 2018 - 12:21:58 - 14:44:07 Serial Number: TAFBB1064329
LAN1 MAC: 00:90:E8:55:46:33 LAN2 MAC: 00:90:E8:55:46:34
----------------------------------------------------------------------------
(0) TPM2 Setting
(1) Update Firmware from TFTP
(2) Go To OS --------------------------------------------------------------------
-------
Command>>
3. Enter 1 to update the firmware by TFTP server. If you want to set up the TFTP IP address, enter 1 to set
up the target machine’s IP address and the TFTP server IP address and then choose an img file.
Command>> 1
Current IP Address
Local IP Address : ipaddr=192.168.31.134
Server IP Address : serverip=192.168.31.132
Do you set your ip address?
0 - No, 1 - Yes (0-1,enter for abort): 1
Local IP Address : 192.168.31.134
Server IP Address : 192.168.31.132
Saving Environment to SPI Flash...
SF: Detected MX25L6405D with page size 64 KiB, total 8 MiB
Erasing SPI flash...Writing to SPI flash...done
Firmware File Name (firmware.img): FWR_UC-2112-LX_V1.1_Build_18031118.img
6-3
Arm-based Computer Linux UM Firmware Update and System Recovery
6-4
7
7. Programmer’s Guide
Linux Toolchain
Introduction
Native Compilation
Cross Compilation
Example Program—hello
Example Makefile
Standard APIs
Cryptodev
WDT (Watchdog Timer)
RTC (Real-time Clock)
Modbus
Moxa Platform Libraries
Error Numbers
Platform Information
Buzzer
Digital I/O
UART
LED
Push Button
Arm-based Computer Linux UM Programmer’s Guide
Linux Toolchain
Introduction
Linux Tool-Chain contains the necessary libraries and compilers for developing your programs. Moxa’s Arm-
based computers support both native and cross-compiling of code. Native compiling is more straightforward
since all the coding and compiling can be done directly on the device, but Arm architecture is less powerful,
the compiling speed is slower. On the other hand, cross compiling can be done on any Linux machine using
a toolchain, and the compiling speed is much faster.
Native Compilation
NOTE The command line prompt moxa@Moxa:~$ indicates that you are using a Moxa computer.
7-2
Arm-based Computer Linux UM Programmer’s Guide
Cross Compilation
To ensure that an application will be able to run correctly when installed on Moxa computers, you must
compile the application and link it to the same libraries that will be present on Moxa computers. This is
particularly true when the Arm-based Cortex processor architecture differs from the CISC x86 processor
architecture of the host system, but it is also true if the processor architecture is the same.
The host toolchain that comes with the Moxa computers contains a suite of cross compilers and other tools,
as well as the libraries and headers that are necessary to compile applications for the Moxa computers. The
host environment must be running Linux to install the Moxa GNU Tool Chain. We have confirmed that the
following Linux distributions can be used to install the tool chain:
The Tool Chain will need about 300 MB of hard disk space on your PC. To install the toolchain, download the
toolchain file from Moxa’s website. After you untar the package, run the following script to install the
toolchain.
Once the host environment has been installed, add the directories:
"/usr/local/arm-linux-gnueabihf-4.7-20130415/bin" to your path and the directory "/usr/local/arm-linux-
gnueabihf-4.7-20130415/man" to your manual path.
You can do this temporarily for the current login session by issuing the following commands:
user@Linux:~$ export \
PATH="/usr/local/arm-linux-gnueabihf-6.3/usr/bin/:$PATH"
user@Linux:~$ export \
MANPATH=" /usr/local/arm-linux-gnueabihf-6.3/usr/share/man:$MANPATH"
Alternatively, you can add these commands to the "$HOME/.bash_profile" to cause it to take effect for all
login sessions initiated by this user.
You can check the toolchain version using the following command:
user@Linux:~$ arm-linux-gnueabihf-gcc -v
You can now start compiling programs using this tool chain.
NOTE The command line prompt user@Linux:~$ indicates that you are using a computer that has the arm-
linux-gnueabihf toolchain installed.
7-3
Arm-based Computer Linux UM Programmer’s Guide
Example Program—hello
In this section, we use the standard "hello" example program to illustrate how to develop a program for
Moxa computers. All example codes can be downloaded from Moxa’s website. The "hello" example code is
available in the hello folder; hello/hello.c:
#include <stdio.h>
Native Compilation
Cross Compiling
7-4
Arm-based Computer Linux UM Programmer’s Guide
For example, if the IP address of your device used for cross compiling the code is "192.168.3.100" and
the IP address of the Moxa computer is "192.168.3.127", use the following command:
Example Makefile
You can create a Makefile for the “hello" example program using the following code. By default, the Makefile
is set for native compiling.
"hello/Makefile":
CC:=gcc
STRIP:=strip
all:
$(CC) -o hello hello.c
$(STRIP) -s hello
.PHONY: clean
clean:
rm -f hello
To set the hello.c program for cross compilation, modify the toolchain settings as follows:
CC:=arm-linux-gnueabihf-gcc
STRIP:=arm-linux-gnueabihf-strip
7-5
Arm-based Computer Linux UM Programmer’s Guide
Standard APIs
This section shows how to use some standard APIs on Moxa computers.
Cryptodev
The purpose of cryptographic hardware accelerator is to load off the intensive encryption/decryption and
compression/decompression tasks from CPU.
Cryptodev-linux is a device that allows access to Linux kernel cryptographic drivers; thus allowing the
userspace applications to take advantage of hardware accelerators. Cryptodev-linux uses "/dev/crypto"
interface to let kernel space hardware accelerator drivers become accessible from typical userspace
programs and libraries.
Example code
7-6
Arm-based Computer Linux UM Programmer’s Guide
Config
You need to know which driver you’re using first. Assume that the watchdog driver’s name is "ds1374_wdt",
then you can use the modinfo command to check the information as follows:
The parameter’s name is "nowayout" for NO WAY OUT and "timer_margin" for timeout setting. To change
the setting, you can add a conf file under the directory "/etc/modprobe.d/". For example, add a file
"/etc/modprobe.d/watchdog.conf" with the following content:
This changes the setting for "ds1374_wdt" driver with nowayout=1 and timeout=60 seconds.
Example code
WDT driver APIs are used via "ioctl" through a file descriptor. The methods are defined in
<linux/watchdog.h>.
API List
7-7
Arm-based Computer Linux UM Programmer’s Guide
Example code
RTC APIs are used via "ioctl" through a file descriptor. The methods are defined in <linux/rtc.h>.
The APIs that read time from RTC and set RTC time are using a structure "struct rtc_time". It is defined in
<linux/rtc.h>:
struct rtc_time {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};
Note that variable "tm_mon" starts with 0 and variable "tm_year" represents the number of years since
1900.
7-8
Arm-based Computer Linux UM Programmer’s Guide
API List
Modbus
The Modbus protocol is a messaging structure used to establish master-slave/client-server communication
between intelligent devices. It is a de facto standard, truly open, and the most widely used network protocol
in industrial manufacturing environments. It has been implemented by hundreds of vendors on thousands of
different devices to transfer discrete/analog I/O and register data between control devices.
Example code
We use "libmodbus" with current stable version v3.0.6 as our modbus package. The package is also
available from the following link: http://libmodbus.org/releases/libmodbus-3.0.6.tar.gz
To run the test program, we first need to build the "libmodbus" library. We can build it simply by running
the following commands:
$ cd modbus/libmodbus-3.0.6/
$ ./configure && make install
After build completes, the test program can be found at "tests" directory. The test program provides 3
types of protocols (tcp/ tcppi/ rtu) which can be set by passing command line argument.
The test program is client-server modeled. We should run the server program first, and then run the client
program from another terminal.
$ cd modbus/libmodbus-3.0.6/tests/
$ ./unit-test-server tcp
$ cd modbus/libmodbus-3.0.6/tests/
$ ./unit-test-client tcp
7-9
Arm-based Computer Linux UM Programmer’s Guide
Error Numbers
Moxa defines exclusive error numbers for Moxa libraries. It works with other Moxa library codes, and is
useful for checking the result of executing an API.
If you call an API, you can check the return value to take particular action in response.
int num_of_interfaces;
ret = mx_get_number_of_interfaces(&num_of_interfaces);
if (ret == E_SYSFUNCERR){
// do something...
}
Usage
7-10
Arm-based Computer Linux UM Programmer’s Guide
Platform Information
Moxa platform info library is used to get information of interfaces on the device, which is useful to know the
device’s capability before developing applications.
Usage
API List
7-11
Arm-based Computer Linux UM Programmer’s Guide
Buzzer
Moxa buzzer control library can be used to control the buzzer on the device. We provide interfaces for
controlling the buzzer to beep for a certain period or keep beeping till it is switched off.
NOTE Moxa buzzer control library should be used carefully, the buzzer must be stopped before the process
ends. Or the buzzer may beep without control.
The Moxa buzzer control library is supported only in the UC-8100A-ME-T Series.
Usage
API List
7-12
Arm-based Computer Linux UM Programmer’s Guide
Digital I/O
Moxa DIO control library can be used to control digital I/O interface. Including getting states from Direct
Input and Output ports, setting state of Direct Output ports.
Usage
API List
7-13
Arm-based Computer Linux UM Programmer’s Guide
Function Prototype int mx_din_set_event(int diport, void (*func)(int diport), int mode,
unsigned long duration);
Description Set an action for an event occurred of target Direct Input port
Parameters • diport: target DIN port number
• func: a function pointer which will be invoked on DIN event detected
• mode: DIN event mode
DIN_EVENT_CLEAR
DIN_EVENT_LOW_TO_HIGH
DIN_EVENT_HIGH_TO_LOW
DIN_EVENT_STATE_CHANGE
• duration: The during time that the event occurred to trigger action
range: 40 - 3600000 (ms)
0 means no duration
Return Value • 0 on success
• negative integers as error number
Example void (*fp)(int );
mx_din_set_event(0, fp, DIN_EVENT_STATE_CHANGE, 100);
Function Prototype int mx_din_get_event(int diport, int *mode, unsigned long *duration);
Description Get event setting of target Direct Input port
Parameters • diport: target DIN port number
• mode: a pointer which points to a place for storing output value
• duration: a pointer which points to a place for storing output value
Return Value • 0 on success
• negative integers as error number
Example int mode;
unsigned long duration;
mx_din_get_event(0, &mode, &duration);
7-14
Arm-based Computer Linux UM Programmer’s Guide
UART
Moxa UART can be used to set the mode of UART ports and transmit data via UART ports.
Usage
API List
7-15
Arm-based Computer Linux UM Programmer’s Guide
7-16
Arm-based Computer Linux UM Programmer’s Guide
7-17
Arm-based Computer Linux UM Programmer’s Guide
LED
LED APIs can control the LEDs on the device, which can be ON, OFF, or BLINK. LEDs on a device are
separated to types and groups. There are 2 types of LED: Signal LED and Programmable LED. Each type
may contain several groups, and each group may contain several LEDs.
Usage
API List
7-18
Arm-based Computer Linux UM Programmer’s Guide
Function Prototype int mx_led_set_brightness(int led_type, int group, int index, int state);
Description Set LED state on, off, blink
Parameters • led_type:
LED_TYPE_SIGNAL or LED_TYPE_PROGRAMMABLE
• group: group number
• index: LED index
• state:
LED_STATE_OFF or LED_STATE_ON or LED_STATE_BLINK
Return Value • 0 on success
• negative integers as error number
Example mx_led_set_brightness(LED_TYPE_PROGRAMMABLE, 1, 1, LED_STATE_ON);
Push Button
Push button APIs.
Usage
NOTE Remember to terminate the push button daemon that run by the system. Or you might accidentally trigger
some system functions which defined in the daemon when testing the button.
The push button daemon here is called moxa-pbtn. You can terminate the process by using the
systemctl stop moxa-pbtn command.
7-19
Arm-based Computer Linux UM Programmer’s Guide
API List
7-20
Arm-based Computer Linux UM Programmer’s Guide
7-21