#include <GL/freeglut.h>\r
#include "freeglut_internal.h"\r
\r
-#if TARGET_HOST_POSIX_X11\r
-#ifdef HAVE_ERRNO_H\r
-#include <errno.h>\r
-#endif\r
-#include <sys/ioctl.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <termios.h>\r
-#include <fcntl.h>\r
-\r
-struct {\r
- int fd;\r
- struct termios termio, termio_save;\r
-} _serialport;\r
-\r
-#endif\r
-\r
typedef struct _serialport SERIALPORT;\r
\r
\r
/*\r
* Try initializing the input device(s)\r
*/\r
-#if TARGET_HOST_POSIX_X11\r
-void fgPlatformRegisterDialDevice ( const char *dial_device )\r
-{\r
-}\r
-#endif\r
-\r
void fgInitialiseInputDevices ( void )\r
{\r
if( !fgState.InputDevsInitialised )\r
glutTimerFunc ( 2, poll_dials, 0 );\r
}\r
\r
-\r
-/******** OS Specific Serial I/O routines *******/\r
-#if TARGET_HOST_POSIX_X11 /* ==> Linux/BSD/UNIX POSIX serial I/O */\r
-static SERIALPORT *serial_open ( const char *device )\r
-{\r
- int fd;\r
- struct termios termio;\r
- SERIALPORT *port;\r
-\r
- fd = open(device, O_RDWR | O_NONBLOCK );\r
- if (fd <0) {\r
- perror(device);\r
- return NULL;\r
- }\r
-\r
- port = malloc(sizeof(SERIALPORT));\r
- memset(port, 0, sizeof(SERIALPORT));\r
- port->fd = fd;\r
-\r
- /* save current port settings */\r
- tcgetattr(fd,&port->termio_save);\r
-\r
- memset(&termio, 0, sizeof(termio));\r
- termio.c_cflag = CS8 | CREAD | HUPCL ;\r
- termio.c_iflag = IGNPAR | IGNBRK ;\r
- termio.c_cc[VTIME] = 0; /* inter-character timer */\r
- termio.c_cc[VMIN] = 1; /* block read until 1 chars received, when blocking I/O */\r
-\r
- cfsetispeed(&termio, B9600);\r
- cfsetospeed(&termio, B9600);\r
- tcsetattr(fd,TCSANOW,&termio);\r
-\r
- serial_flush(port);\r
- return port;\r
-}\r
-\r
-static void serial_close(SERIALPORT *port)\r
-{\r
- if (port)\r
- {\r
- /* restore old port settings */\r
- tcsetattr(port->fd,TCSANOW,&port->termio_save);\r
- close(port->fd);\r
- free(port);\r
- }\r
-}\r
-\r
-static int serial_getchar(SERIALPORT *port)\r
-{\r
- unsigned char ch;\r
- if (!port) return EOF;\r
- if (read(port->fd,&ch,1)) return ch;\r
- return EOF;\r
-}\r
-\r
-static int serial_putchar(SERIALPORT *port, unsigned char ch){\r
- if (!port) return 0;\r
- return write(port->fd,&ch,1);\r
-}\r
-\r
-static void serial_flush ( SERIALPORT *port )\r
-{\r
- tcflush ( port->fd, TCIOFLUSH );\r
-}\r
-\r
-#endif\r