~ubuntu-branches/ubuntu/quantal/joystick/quantal

« back to all changes in this revision

Viewing changes to debian/patches/jskeepalive.patch

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Kitt
  • Date: 2010-05-16 16:11:59 UTC
  • mfrom: (3.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100516161159-tf754mo83ojh1yqj
Tags: 20051019-11
evtest: flush standard output, thanks Florian Fainelli! Closes:
#581740.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Provide a jskeepalive program to prevent Acrux gamepads from
 
2
disappearing. See
 
3
https://bugs.launchpad.net/ubuntu/+source/joystick/+bug/448446 for
 
4
more information.
 
5
 
 
6
--- joystick-20051019.orig/utils/Makefile
 
7
+++ joystick-20051019/utils/Makefile
 
8
@@ -33,7 +33,7 @@
 
9
 CFLAGS         = -g -O2 -Wall -I../linux/include
 
10
 
 
11
 PROGRAMS       = evtest inputattach jstest jscal fftest ffmvforce ffset \
 
12
-                 ffcfstress # acceltest
 
13
+                 ffcfstress jskeepalive # acceltest
 
14
 
 
15
 compile: $(PROGRAMS)
 
16
 
 
17
@@ -65,3 +65,6 @@
 
18
 
 
19
 acceltest: acceltest.c
 
20
        $(CC) $(CFLAGS) $(CPPFLAGS) -lm $^ -o $@
 
21
+
 
22
+jskeepalive: jskeepalive.c
 
23
+       $(CC) $(CFLAGS) $(CPPFLAGS) $^ -o $@
 
24
--- /dev/null
 
25
+++ joystick-20051019/utils/jskeepalive.c
 
26
@@ -0,0 +1,61 @@
 
27
+/*
 
28
+ * jskeepalive.c  Version 1.0
 
29
+ *
 
30
+ * Copyright © 2010 Stephen Kitt
 
31
+ *
 
32
+ * Based on jstest.c
 
33
+ */
 
34
+
 
35
+/*
 
36
+ * This program is free software; you can redistribute it and/or
 
37
+ * modify it under the terms of the GNU General Public License as
 
38
+ * published by the Free Software Foundation; either version 2 of the
 
39
+ * License, or (at your option) any later version.
 
40
+ *
 
41
+ * This program is distributed in the hope that it will be useful, but
 
42
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
 
43
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
44
+ * General Public License for more details.
 
45
+ *
 
46
+ * You should have received a copy of the GNU General Public License
 
47
+ * along with this program; if not, write to the Free Software
 
48
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 
49
+ * 02110-1301, USA.
 
50
+ *
 
51
+ * Should you need to contact me, the author, you can do so by email
 
52
+ * at <steve@sk2.org>.
 
53
+ */
 
54
+
 
55
+#include <fcntl.h>
 
56
+#include <unistd.h>
 
57
+#include <stdio.h>
 
58
+#include <string.h>
 
59
+
 
60
+#include <linux/joystick.h>
 
61
+
 
62
+int main (int argc, char **argv)
 
63
+{
 
64
+  int fd;
 
65
+  struct js_event js;
 
66
+  
 
67
+  if (argc != 2 || !strcmp("--help", argv[1])) {
 
68
+    puts("");
 
69
+    puts("Usage: jskeepalive <device>");
 
70
+    puts("");
 
71
+    return 1;
 
72
+  }
 
73
+  
 
74
+  if ((fd = open(argv[argc - 1], O_RDONLY)) < 0) {
 
75
+    perror("jskeepalive");
 
76
+    return 1;
 
77
+  }
 
78
+  
 
79
+  while (1) {
 
80
+    if (read(fd, &js, sizeof(struct js_event)) != sizeof(struct js_event)) {
 
81
+      perror("\njskeepalive: error reading");
 
82
+      return 1;
 
83
+    }
 
84
+  }
 
85
+  
 
86
+  return -1;
 
87
+}