Trying to connect to a POS printer on COM1
Posts: 1
Hello everyone,
I have a strange problem. I am trying to connect to a POS printer (POS being Point Of Sale, not the other POS
that is connected to /dev/ttyS0 (COM1). All the communication with this device is done through a homemade "driver" that used to work on this computer under Xandros 2.0, but since I installed the new Mepis, I am getting no response from the printer. I suspect that somehow the parameters are not being set right, but, again, this worked under Xandros. This is the part of code used to set the parameters of the port:
<br />
#include <fcntl.h><br />
#include <termios.h><br />
#include <stdlib.h><br />
#include <stdio.h><br />
#include <unistd.h><br />
#include <ctype.h><br />
#include <strings.h><br />
#include <errno.h></p>
<p>int OpenSerial(char *port)<br />
{<br />
int fd;<br />
struct termios options;<br />
fd = open(port, O_RDWR | O_NOCTTY | O_NONBLOCK );<br />
tcgetattr(fd, &options);<br />
options.c_iflag = 5;<br />
options.c_cflag = 2238;<br />
options.c_oflag = 0;<br />
options.c_lflag = 128;<br />
tcflush(fd, TCIFLUSH);<br />
tcsetattr(fd, TCSANOW, &options);<br />
if (fd<0) puts("Error in accessing serial device");<br />
return fd;<br />
}Does anyone have any ideas why this is not working now? Are there any new developments in MEPIS that would make this unusable as is?
Thanks,
Milos