[linux-cirrus] ep9312 com2 error
- From: Bakhat Rawan <bakhatrawan@xxxxxxxxx>
- To: linux-cirrus@xxxxxxxxxxxxx
- Date: Wed, 23 Feb 2005 01:58:40 -0800 (PST)
I want to access com2 and wrote the c code as given
bleow. But this code can't access com2.it gives output
from com1. this program uses com1 even if i change the
device file to ttyAM1,ttyAM2..... I also created my
own device files by giving major=204 and minor=17 but
all in vain. i am unable to understand what is the
error.
the souce code is given below
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <termios.h>
int open_port();
int main()
{ struct termios options;
int i;
int n;
int fd;
int open_port(void)
{
fd=open("/dev/ttyAM1", O_RDWR | O_NOCTTY | O_NDELAY);
if (fd==-1)
{
perror("open_port: unable to open /dev/ttyAM1 - ");
}
else
fcntl(fd, F_SETFL, 0);
return (fd);
}
tcgetattr(fd, &options);
cfsetispeed(&options,B19200);
cfsetospeed(&options,B19200);
options.c_cflag |= ( CLOCAL | CREAD);
tcsetattr(fd, TCSANOW, &options);
for (i=0; i<=10; i++)
{
n= write(fd, "jxvf\n", 5);
write(fd, "I AM BAKHAT\n", 12);
if (n<0)
fputs("write() of 4 bytes failed!\n", stderr);
}
return 0;
}
i am stucked here,
can any one tell what is the problem????
Bakhat Rawan
__________________________________
Do you Yahoo!?
Yahoo! Mail - 250MB free storage. Do more. Manage less.
http://info.mail.yahoo.com/mail_250
- Follow-Ups:
- References:
- [linux-cirrus] Touchscreen as evdev device
- From: Jason McMullan
Other related posts:
- » [linux-cirrus] ep9312 com2 error
- [linux-cirrus] Touchscreen as evdev device
- From: Jason McMullan