summaryrefslogtreecommitdiff
path: root/x11-drivers/xf86-input-wacom/files/patch-tools-isdv4-serial-inputattach.c
blob: 4e0deaefe6c368effb16ed809eaab39c70bd6885 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
--- tools/isdv4-serial-inputattach.c~
+++ tools/isdv4-serial-inputattach.c
@@ -23,8 +23,10 @@
 #include "config.h"
 #endif
 
+#ifdef __linux__
 #include <linux/serio.h>
 #include <libudev.h>
+#endif
 
 #include <getopt.h>
 #include <stdio.h>
@@ -49,7 +52,11 @@ static void usage(void)
 		"--verbose             - verbose output\n"
 		"--version             - version info\n"
 		"--baudrate <19200|38400>  - set baudrate\n",
+#ifdef __GLIBC__
 		program_invocation_short_name
+#else
+		getprogname()
+#endif
 	      );
 }
 
@@ -64,6 +71,7 @@ static int set_line_discipline(int fd, i
 	return rc;
 }
 
+#ifdef __linux
 static int bind_kernel_driver(int fd)
 {
 	unsigned long devt;
@@ -77,9 +85,11 @@ static int bind_kernel_driver(int fd)
 
 	return 0;
 }
+#endif
 
 int get_baud_rate(int fd)
 {
+#ifdef __linux__
 	struct stat st;
 	int baudrate = 19200;
 	int id;
@@ -112,6 +122,9 @@ int get_baud_rate(int fd)
 	udev_unref(udev);
 
 	return baudrate;
+#else
+	return 19200;
+#endif
 }
 
 void sighandler(int signum)
@@ -194,6 +207,7 @@ int main(int argc, char **argv)
 		return 1;
 	}
 
+#ifdef __linux__
 	/* some of the 19200 tablets can't set the line discipline */
 	set_line_discipline(fd, N_MOUSE);
 
@@ -201,6 +215,7 @@ int main(int argc, char **argv)
 		fprintf(stderr, "Failed to bind the kernel driver.\n");
 		goto out;
 	}
+#endif
 
 	signal(SIGINT, sighandler);
 	signal(SIGHUP, sighandler);