aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/jlime/fnkey-1.0/fnkey.c
diff options
context:
space:
mode:
authorAlex Ferguson <thoughtmonster@gmail.com>2010-10-30 21:42:34 +0300
committerKristoffer Ericson <kristoffer.ericson@gmail.com>2010-11-03 16:51:19 +0100
commit9573c1eecb18fc019017ff69c38d58d5ba12051a (patch)
tree1f925dc2749dd4e4cb4cfde54a47453c0a1e7471 /recipes/jlime/fnkey-1.0/fnkey.c
parentb2e1b766abe2fb512943d77ada4f7f04b748b3f4 (diff)
downloadopenembedded-9573c1eecb18fc019017ff69c38d58d5ba12051a.tar.gz
jlime: Add several small jlime-specific recipes.
* Added fileselector-1.0, a simple file-selector in C and SDL. * Added fnkey-1.0, which is used to emulate a Mode_Shift + Shift keypress using xdotool on pressing the Fn key. This is mainly for the ben-nanonote, and is hackish, but works. * Added gtk-engine-industrial for gtk-1.2, since we still use gtk-1.2 applications in jlime, and gtk-1.2 looks ugly by default. This helps. * Added jlime-extras, a package which adds several files (initscripts, configuration files, other support files), some of which replace files found in other packages. Signed-off-by: Alex Ferguson <thoughtmonster@gmail.com> Signed-off-by: Kristoffer Ericson <kristoffer.ericson@gmail.com>
Diffstat (limited to 'recipes/jlime/fnkey-1.0/fnkey.c')
-rw-r--r--recipes/jlime/fnkey-1.0/fnkey.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/recipes/jlime/fnkey-1.0/fnkey.c b/recipes/jlime/fnkey-1.0/fnkey.c
new file mode 100644
index 0000000000..61635626d1
--- /dev/null
+++ b/recipes/jlime/fnkey-1.0/fnkey.c
@@ -0,0 +1,41 @@
+#include <linux/input.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#define FNKEY 29 /* key code */
+
+int main(int argc, char **argv)
+{
+ int fd;
+ int mode = 0; /* 0 unpressed ; 2 pressed */
+
+ if(argc < 2) {
+ printf("usage: %s <device>\n", argv[0]);
+ return 1;
+ }
+
+ fd = open(argv[1], O_RDONLY);
+ struct input_event ev;
+
+ while (1) {
+ read(fd, &ev, sizeof(struct input_event));
+
+ if ((ev.type == 1) && (ev.code == FNKEY)) {
+ if (((ev.value == 2) || (ev.value == 1)) && (mode == 0)) { /* PRESSED */
+ system("xdotool keydown Mode_switch; xdotool keydown SHIFT");
+ /* printf("system press\n"); */
+ mode = 2;
+ } else if ((ev.value == 0) && (mode == 2)) { /* KEY UP */
+ system("xdotool keyup Mode_switch; xdotool keyup SHIFT");
+ /* printf("system unpress\n"); */
+ mode = 0;
+ }
+ /* printf("key %i state %i\n", ev.code, ev.value); */
+
+ }
+ }
+}
+