aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-04-28 04:29:58 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-04-28 04:29:58 +0000
commitd4e504ebf32d62232b316bb819800ecd513cebb3 (patch)
tree94058163fdcb90e4fd8990e5a45798a0e5d6493d
parent32af9ff6bac9b6991f00726b9d13d4ba0c7b87ed (diff)
switched Linux to use common hid_output_event()
svn path=/trunk/externals/hcs/hid/; revision=2843
-rw-r--r--doc/hid-help.pd136
-rw-r--r--doc/mouse-help.pd106
-rw-r--r--hid.c6
-rw-r--r--hid.h5
-rw-r--r--hid_linux.c26
5 files changed, 137 insertions, 142 deletions
diff --git a/doc/hid-help.pd b/doc/hid-help.pd
index 4a905e9..3eb2e0b 100644
--- a/doc/hid-help.pd
+++ b/doc/hid-help.pd
@@ -1,12 +1,10 @@
#N canvas 71 186 913 626 10;
-#X msg 455 295 key btn_0 0 4.27029e+09;
+#X msg 455 295 rel rel_y 1;
#X obj 455 274 prepend set;
#X floatatom 37 484 5 0 0 0 - - -;
#X floatatom 93 484 5 0 0 0 - - -;
#X msg 158 121 start;
#X msg 158 141 stop;
-#X floatatom 548 354 12 0 0 1 time - -;
-#X obj 455 335 unpack s s f f;
#X msg 261 34 open 0;
#X msg 268 52 open 1;
#X msg 275 70 open 2;
@@ -14,11 +12,11 @@
#X msg 287 106 open 4;
#X floatatom 84 439 7 0 0 0 - - -;
#X floatatom 138 439 7 0 0 0 - - -;
-#X obj 68 122 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 25 25
+#X obj 68 122 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 0 25
;
-#X floatatom 517 370 12 0 0 1 value - -;
-#X symbolatom 486 386 15 0 0 1 event_code - -;
-#X symbolatom 455 402 15 0 0 1 event_type - -;
+#X floatatom 534 356 12 0 0 1 value - -;
+#X symbolatom 494 372 15 0 0 1 event_code - -;
+#X symbolatom 455 388 15 0 0 1 event_type - -;
#X obj 17 271 bng 35 250 50 0 empty empty event_received 38 18 1 9
-262144 -1 -1;
#X obj 2 2 cnv 15 900 20 empty empty [hid] 2 11 1 18 -233017 -66577
@@ -51,7 +49,7 @@
#X text 49 588 (C) Copyright 2004 Hans-Christoph Steiner <hans@at.or.at>
;
#X text 266 602 released under the GNU GPL;
-#X text 472 589 $Revision: 1.15 $$Date: 2005-04-26 03:50:24 $;
+#X text 472 589 $Revision: 1.16 $$Date: 2005-04-28 04:29:58 $;
#X text 473 602 $Author: eighthave $;
#X floatatom 192 439 7 0 0 0 - - -;
#X msg 428 185 poll 20;
@@ -319,68 +317,68 @@ btn_8 btn_9;
#X msg 496 185 poll 2000;
#X obj 37 464 route rel_x rel_y rel_z rel_wheel;
#X floatatom 206 484 5 0 0 0 - - -;
+#X obj 455 335 unpack s s f;
#X connect 1 0 0 0;
-#X connect 4 0 90 0;
-#X connect 5 0 90 0;
-#X connect 7 0 18 0;
-#X connect 7 1 17 0;
-#X connect 7 2 16 0;
-#X connect 7 3 6 0;
-#X connect 8 0 90 0;
-#X connect 9 0 90 0;
-#X connect 10 0 90 0;
-#X connect 11 0 90 0;
-#X connect 12 0 90 0;
-#X connect 15 0 90 0;
-#X connect 36 0 35 0;
-#X connect 36 0 19 0;
-#X connect 37 0 36 1;
-#X connect 38 0 39 1;
-#X connect 39 0 38 0;
-#X connect 40 0 39 0;
-#X connect 41 0 90 0;
-#X connect 42 0 90 0;
-#X connect 50 0 90 0;
-#X connect 51 0 90 0;
-#X connect 55 0 66 0;
-#X connect 55 1 98 0;
-#X connect 55 2 72 0;
-#X connect 55 3 40 0;
-#X connect 65 0 90 0;
-#X connect 66 0 56 0;
-#X connect 66 1 57 0;
-#X connect 66 2 58 0;
-#X connect 66 3 59 0;
-#X connect 66 4 60 0;
-#X connect 66 5 61 0;
-#X connect 66 6 62 0;
-#X connect 66 7 63 0;
-#X connect 66 8 64 0;
-#X connect 66 9 67 0;
-#X connect 72 0 13 0;
-#X connect 72 1 14 0;
-#X connect 72 2 49 0;
-#X connect 72 3 73 0;
-#X connect 72 4 74 0;
-#X connect 72 5 75 0;
-#X connect 72 6 76 0;
-#X connect 76 0 77 0;
-#X connect 76 1 79 0;
-#X connect 76 2 81 0;
-#X connect 76 3 83 0;
+#X connect 4 0 88 0;
+#X connect 5 0 88 0;
+#X connect 6 0 88 0;
+#X connect 7 0 88 0;
+#X connect 8 0 88 0;
+#X connect 9 0 88 0;
+#X connect 10 0 88 0;
+#X connect 13 0 88 0;
+#X connect 34 0 33 0;
+#X connect 34 0 17 0;
+#X connect 35 0 34 1;
+#X connect 36 0 37 1;
+#X connect 37 0 36 0;
+#X connect 38 0 37 0;
+#X connect 39 0 88 0;
+#X connect 40 0 88 0;
+#X connect 48 0 88 0;
+#X connect 49 0 88 0;
+#X connect 53 0 64 0;
+#X connect 53 1 96 0;
+#X connect 53 2 70 0;
+#X connect 53 3 38 0;
+#X connect 63 0 88 0;
+#X connect 64 0 54 0;
+#X connect 64 1 55 0;
+#X connect 64 2 56 0;
+#X connect 64 3 57 0;
+#X connect 64 4 58 0;
+#X connect 64 5 59 0;
+#X connect 64 6 60 0;
+#X connect 64 7 61 0;
+#X connect 64 8 62 0;
+#X connect 64 9 65 0;
+#X connect 70 0 11 0;
+#X connect 70 1 12 0;
+#X connect 70 2 47 0;
+#X connect 70 3 71 0;
+#X connect 70 4 72 0;
+#X connect 70 5 73 0;
+#X connect 70 6 74 0;
+#X connect 74 0 75 0;
+#X connect 74 1 77 0;
+#X connect 74 2 79 0;
+#X connect 74 3 81 0;
+#X connect 75 0 76 0;
#X connect 77 0 78 0;
#X connect 79 0 80 0;
#X connect 81 0 82 0;
-#X connect 83 0 84 0;
-#X connect 85 0 90 0;
-#X connect 86 0 90 0;
-#X connect 89 0 90 0;
-#X connect 90 0 36 0;
-#X connect 90 0 1 0;
-#X connect 90 0 7 0;
-#X connect 90 0 55 0;
-#X connect 97 0 90 0;
-#X connect 98 0 2 0;
-#X connect 98 1 3 0;
-#X connect 98 2 71 0;
-#X connect 98 3 99 0;
+#X connect 83 0 88 0;
+#X connect 84 0 88 0;
+#X connect 87 0 88 0;
+#X connect 88 0 34 0;
+#X connect 88 0 1 0;
+#X connect 88 0 53 0;
+#X connect 88 0 98 0;
+#X connect 95 0 88 0;
+#X connect 96 0 2 0;
+#X connect 96 1 3 0;
+#X connect 96 2 69 0;
+#X connect 96 3 97 0;
+#X connect 98 0 16 0;
+#X connect 98 1 15 0;
+#X connect 98 2 14 0;
diff --git a/doc/mouse-help.pd b/doc/mouse-help.pd
index 38dba07..0ac3cbc 100644
--- a/doc/mouse-help.pd
+++ b/doc/mouse-help.pd
@@ -1,4 +1,4 @@
-#N canvas 338 423 659 461 10;
+#N canvas 349 114 659 461 10;
#X symbolatom 211 268 6 0 0 1 code - -;
#X obj 130 106 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0
1;
@@ -15,27 +15,25 @@
#X msg 175 83 open 0;
#X msg 180 102 open 1;
#X msg 185 121 open 2;
-#N canvas 22 231 672 582 mouse-noise 0;
-#X obj 100 25 inlet;
+#N canvas 22 231 672 582 mouse-noise 1;
+#X obj 112 38 inlet;
#X obj 210 324 noise~;
#X obj 155 346 osc~;
#X obj 113 397 *~;
-#X msg 130 78 \; pd dsp 1;
+#X msg 155 94 \; pd dsp 1;
#X obj 110 510 dac~;
-#X obj 338 61 inlet;
-#X text 400 62 open msgs;
+#X obj 386 33 inlet;
+#X text 448 34 open msgs;
#X obj 138 169 mouse \$1;
-#X obj 100 58 t f b;
#X text 328 192 get button value only;
#X obj 210 350 *~;
#X obj 317 242 / 2;
-#X obj 113 458 pan;
+#X obj 113 458 linearpan~;
#X obj 289 439 line;
#X msg 289 416 \$1 20;
#X obj 313 328 +;
#X obj 359 328 f;
#X msg 343 297 0;
-#X msg 141 131 close;
#X obj 155 252 abs;
#X obj 189 192 unpack symbol float;
#X obj 110 345 line~;
@@ -46,49 +44,57 @@
#X obj 296 301 int;
#X obj 326 389 / 20;
#X obj 155 297 mtof;
-#X floatatom 199 259 5 0 0 0 - - -;
#X obj 155 213 hid_rel2abs 0 1;
#X obj 155 233 - 1;
#X floatatom 217 521 5 0 0 0 - - -;
#X obj 155 277 notescale 30 60;
-#X connect 0 0 9 0;
-#X connect 1 0 11 0;
+#X obj 179 410 loadbang;
+#X msg 177 433 0.5;
+#X obj 26 260 select 0;
+#X msg 26 282 0;
+#X text 11 234 mute on finish;
+#X obj 112 71 t f f b;
+#X connect 0 0 37 0;
+#X connect 1 0 10 0;
#X connect 2 0 3 1;
-#X connect 3 0 13 0;
+#X connect 3 0 12 0;
#X connect 6 0 8 0;
-#X connect 8 0 23 0;
-#X connect 8 1 31 0;
-#X connect 8 2 27 0;
-#X connect 8 3 21 0;
-#X connect 9 0 8 0;
-#X connect 9 1 4 0;
-#X connect 11 0 3 1;
-#X connect 12 0 11 1;
-#X connect 13 0 5 0;
-#X connect 13 1 5 1;
-#X connect 14 0 13 1;
-#X connect 15 0 14 0;
-#X connect 16 0 25 0;
+#X connect 8 0 21 0;
+#X connect 8 1 28 0;
+#X connect 8 2 25 0;
+#X connect 8 3 19 0;
+#X connect 10 0 3 1;
+#X connect 11 0 10 1;
+#X connect 12 0 5 0;
+#X connect 12 1 5 1;
+#X connect 13 0 12 1;
+#X connect 14 0 13 0;
+#X connect 15 0 23 0;
+#X connect 16 0 15 1;
#X connect 17 0 16 1;
-#X connect 18 0 17 1;
-#X connect 18 0 16 1;
-#X connect 19 0 8 0;
-#X connect 20 0 30 0;
-#X connect 20 0 34 0;
-#X connect 21 1 12 0;
-#X connect 22 0 3 0;
-#X connect 23 0 22 0;
-#X connect 24 0 2 0;
-#X connect 25 0 26 0;
-#X connect 26 0 17 0;
-#X connect 26 0 28 0;
-#X connect 27 0 16 0;
-#X connect 28 0 15 0;
-#X connect 29 0 24 0;
-#X connect 31 0 32 0;
-#X connect 32 0 20 0;
-#X connect 34 0 29 0;
-#X connect 34 0 33 0;
+#X connect 17 0 15 1;
+#X connect 18 0 31 0;
+#X connect 19 1 11 0;
+#X connect 20 0 3 0;
+#X connect 21 0 20 0;
+#X connect 22 0 2 0;
+#X connect 23 0 24 0;
+#X connect 24 0 16 0;
+#X connect 24 0 26 0;
+#X connect 25 0 15 0;
+#X connect 26 0 14 0;
+#X connect 27 0 22 0;
+#X connect 28 0 29 0;
+#X connect 29 0 18 0;
+#X connect 31 0 27 0;
+#X connect 31 0 30 0;
+#X connect 32 0 33 0;
+#X connect 33 0 12 1;
+#X connect 34 0 35 0;
+#X connect 35 0 21 0;
+#X connect 37 0 34 0;
+#X connect 37 1 8 0;
+#X connect 37 2 4 0;
#X restore 425 186 pd mouse-noise 1;
#X obj 425 119 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0
1;
@@ -113,9 +119,9 @@
;
#X text 228 436 released under the GNU GPL;
#X text 424 436 $Author: eighthave $;
-#X text 424 423 $Revision: 1.11 $;
-#X obj 526 382 pddp_open all_about_hid;
-#X text 417 383 For more info:;
+#X text 424 423 $Revision: 1.12 $;
+#X obj 466 382 pddp_open all_about_hid;
+#X text 357 383 For more info:;
#X obj 601 334 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
1;
#X obj 193 314 route btn_0 btn_1 btn_2 btn_3 btn_4 btn_5 btn_6 btn_7
@@ -129,9 +135,9 @@ in each axis to calibrate it.;
#X obj 619 3 pddp;
#X msg 500 148 open \$1;
#X obj 500 128 hradio 15 1 1 8 \$0-device-number empty choose_a_device
-0 -6 1 9 -262144 -1 -1 3;
+0 -6 1 9 -262144 -1 -1 4;
#X obj 474 128 nbx 1 14 -1e+37 1e+37 0 0 empty \$0-device-number empty
-0 -6 0 14 -166441 -1 -1 0 256;
+0 -6 0 14 -166441 -1 -1 4 256;
#X connect 1 0 35 0;
#X connect 9 0 35 0;
#X connect 10 0 35 0;
diff --git a/hid.c b/hid.c
index 335f71a..82c1b12 100644
--- a/hid.c
+++ b/hid.c
@@ -48,17 +48,15 @@ static void hid_float(t_hid* x, t_floatarg f);
* SUPPORT FUNCTIONS
*/
-void hid_output_event(t_hid *x,
- char *type, char *code, t_float value, t_float timestamp)
+void hid_output_event(t_hid *x, char *type, char *code, t_float value)
{
t_atom event_data[4];
SETSYMBOL(event_data, gensym(type)); /* type */
SETSYMBOL(event_data + 1, gensym(code)); /* code */
SETFLOAT(event_data + 2, value); /* value */
- SETFLOAT(event_data + 3, timestamp); /* timestamp */
- outlet_anything(x->x_obj.te_outlet,atom_gensym(event_data),3,event_data+1);
+ outlet_anything(x->x_obj.te_outlet,atom_gensym(event_data),2,event_data+1);
}
void hid_set_from_float(t_hid *x, t_floatarg f)
diff --git a/hid.h b/hid.h
index 0ff3b79..80fdced 100644
--- a/hid.h
+++ b/hid.h
@@ -14,7 +14,7 @@
#define HID_MAJOR_VERSION 0
#define HID_MINOR_VERSION 5
-static char *version = "$Revision: 1.13 $";
+static char *version = "$Revision: 1.14 $";
/*------------------------------------------------------------------------------
* CLASS DEF
@@ -56,8 +56,7 @@ t_int hid_instance_count;
*/
/* support functions */
-void hid_output_event(t_hid *x,
- char *type, char *code, t_float value, t_float timestamp);
+void hid_output_event(t_hid *x, char *type, char *code, t_float value);
/* generic, cross-platform functions */
t_int hid_open_device(t_hid *x, t_int device_number);
diff --git a/hid_linux.c b/hid_linux.c
index 04b1c9f..aa22425 100644
--- a/hid_linux.c
+++ b/hid_linux.c
@@ -268,7 +268,9 @@ t_int hid_get_events(t_hid *x)
t_int i;
DEBUG(t_int event_counter = 0;);
t_int read_bytes;
- t_atom event_data[4];
+ t_atom event_data[3];
+
+ char hid_code[7];
/* this will go into the generic read function declared in hid.h and
* implemented in hid_linux.c
@@ -279,26 +281,18 @@ t_int hid_get_events(t_hid *x)
while (read (x->x_fd, &(hid_input_event), sizeof(struct input_event)) > -1)
{
- /* build event_data list from event data */
- /* type */
- SETSYMBOL(event_data, gensym(ev[hid_input_event.type]));
- /* code */
if (hid_input_event.type == EV_KEY)
{
- char hid_code[7];
hid_convert_linux_buttons_to_numbers(hid_input_event.code,hid_code);
- hid_convert_linux_keys(hid_input_event.code,hid_code);
- SETSYMBOL(event_data + 1,
- gensym(hid_code));
+ hid_convert_linux_keys(hid_input_event.code,hid_code);
}
else
- SETSYMBOL(event_data + 1,
- gensym(event_names[hid_input_event.type][hid_input_event.code]));
- /* value */
- SETFLOAT(event_data + 2, (t_float)hid_input_event.value);
- /* time */
- SETFLOAT(event_data + 3, (t_float)(hid_input_event.time).tv_sec);
- outlet_anything(x->x_obj.te_outlet,atom_gensym(event_data),3,event_data+1);
+ {
+ strcpy(hid_code, event_names[hid_input_event.type][hid_input_event.code]);
+ }
+
+ hid_output_event(x, ev[hid_input_event.type], hid_code,
+ (t_float)hid_input_event.value);
DEBUG(++event_counter;);
}
DEBUG(