Moxa UC-8410A-LX [73/86] Using cell_mgmt

Moxa UC-8410A-LX [73/86] Using cell_mgmt
UC-8410A Series Linux Software Programmer’s Guide
6-11
Example: Setting the baud rate
#include <termio.h>
#include <fcntl.h>
#include <err.h>
#include <linux/serial.h>
struct termios options;
struct serial_struct serinfo;
int fd;
int speed = 0;
static int rate_to_constant(int baudrate) {
#define B(x) case x: return B##x
switch(baudrate) {
B(50); B(75); B(110); B(134); B(150);
B(200); B(300); B(600); B(1200); B(1800);
B(2400); B(4800); B(9600); B(19200); B(38400);
B(57600); B(115200);
default: return 0;
}
#undef B
}
/* Open and configure serial port */
if ((fd = open(device,O_RDWR|O_NOCTTY)) == -1)
return -1;
fcntl(fd, F_SETFL, 0);
tcgetattr(fd, &options);
cfsetispeed(&options, speed ?: B115200);
cfsetospeed(&options, speed ?: B115200);
cfmakeraw(&options);
options.c_cflag |= (CLOCAL | CREAD);
options.c_cflag &= ~CRTSCTS;
if (tcsetattr(fd, TCSANOW, &options) != 0)
return -1;
Using cell_mgmt
The cell_mgmt utility is used to manage the cellular module in the UC-8410A-LX.

Содержание

Скачать