summaryrefslogtreecommitdiff
path: root/x11-drivers/xlibre-xf86-input-wacom/files/patch-tools-tools-shared.c
blob: 0be5b371c9a53bd5f4dbeecb064caa36d45077f9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--- tools/tools-shared.c~
+++ tools/tools-shared.c
@@ -23,7 +23,9 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#ifdef __linux__
 #include <linux/serial.h>
+#endif
 #include <getopt.h>
 #include <poll.h>
 #include <stdio.h>
@@ -51,7 +53,6 @@ void version(void)
 int open_device(const char *path)
 {
 	int fd;
-	struct serial_struct ser;
 
 	TRACE("Opening device '%s'.\n", path);
 	fd = open(path, O_RDWR | O_NOCTTY);
@@ -59,7 +60,13 @@ int open_device(const char *path)
 	if (fd < 1)
 		perror("Failed to open device file");
 
+#ifdef __linux__
+	struct serial_struct ser;
 	if (ioctl(fd, TIOCGSERIAL, &ser) == -1)
+#else
+	struct termios termAttr;
+	if (tcgetattr(fd, &termAttr) == -1)
+#endif
 	{
 		perror("Not a serial device?");
 		close(fd);