//gcc -o querySerial querySerial.c
#include <stdio.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <termios.h>
#include <stdlib.h>
/* These are the hash definitions */
#define USERBAUD1200 '1'+'2'
#define USERBAUD2400 '2'+'4'
#define USERBAUD9600 '9'+'6'
#define USERBAUD1920 '1'+'9'
#define USERBAUD3840 '3'+'8'
#define DEV "/dev/ttyS0"
struct termios tio;
/* write the users command out the serial port */
int send_cmd(int ftty,char * str)
{
int result;
result = write(ftty,str,strlen(str));/*argv[4], strlen(argv[4]));*/
if (result < 0)
{
printf("Write command:%s to VC312 failed/n",str);
close(ftty);
exit(1);
}
}
int init_