From 80bdb3696f585bd27168675a2cea0bc13b60b350 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 20 Oct 2004 02:55:12 +0000 Subject: auto-generated event type/code listings as pd files svn path=/trunk/externals/hcs/hid/; revision=2132 --- Makefile | 4 +-- doc/hid-help.pd | 81 ++++++++++++++++++++++++++------------------- make-arrays-from-input.h.pl | 69 +++++++++++++++++++++++++++++++------- 3 files changed, 106 insertions(+), 48 deletions(-) diff --git a/Makefile b/Makefile index a205252..75b23b8 100644 --- a/Makefile +++ b/Makefile @@ -44,8 +44,8 @@ INCLUDE = -I../ -I../../../pd/src -I/usr/local/include -I./HID\ Utilities\ Sour rm $*.o input_arrays: - ./make-arrays-from-input.h.pl > input_arrays.h + ./make-arrays-from-input.h.pl -clean: ; rm -f *.pd_* *.o *~ input_arrays.h +clean: ; rm -f *.pd_* *.o *~ input_arrays.h ev*-list.pd diff --git a/doc/hid-help.pd b/doc/hid-help.pd index b55b949..984036f 100644 --- a/doc/hid-help.pd +++ b/doc/hid-help.pd @@ -1,38 +1,51 @@ -#N canvas 282 80 613 460 10; -#X msg 340 212 ev_rel rel_x 1 1.09824e+09; -#X obj 340 191 prepend set; -#X obj 102 357 route rel_x rel_y; -#X floatatom 102 377 5 0 0 0 - - -; -#X floatatom 159 377 5 0 0 0 - - -; -#X obj 180 226 print; -#X msg 106 48 start; -#X msg 125 67 stop; -#X obj 198 155 hid /dev/input/event0; -#X floatatom 444 331 12 0 0 1 time - -; -#X obj 351 311 unpack s s f f; -#X msg 222 52 open /dev/input/event1; -#X msg 214 29 open /dev/input/event0; -#X msg 238 74 open /dev/input/event2; -#X msg 250 95 open /dev/input/event3; -#X msg 262 115 open /dev/input/event4; -#X obj 43 292 route ev_key ev_rel ev_abs; -#X floatatom 161 338 7 0 0 0 - - -; -#X floatatom 219 338 7 0 0 0 - - -; -#X obj 161 317 route abs_x abs_y; -#X obj 44 52 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 1 1; -#X floatatom 413 348 12 0 0 1 value - -; -#X symbolatom 381 365 10 0 0 1 eventcode - -; -#X symbolatom 351 384 15 0 0 1 eventtype - -; -#X floatatom 43 422 5 0 0 0 - - -; -#X floatatom 118 423 5 0 0 0 - - -; -#X obj 43 400 route key_f key_leftctrl btn_left; -#X floatatom 193 423 5 0 0 0 - - -; -#X obj 11 166 bng 35 250 50 0 empty empty event_received 38 18 1 8 +#N canvas 124 73 911 579 10; +#X msg 382 241 ev_rel rel_x 5 1.09824e+09; +#X obj 382 220 prepend set; +#X obj 144 386 route rel_x rel_y; +#X floatatom 144 406 5 0 0 0 - - -; +#X floatatom 201 406 5 0 0 0 - - -; +#X obj 222 255 print; +#X msg 148 77 start; +#X msg 167 96 stop; +#X obj 240 184 hid /dev/input/event0; +#X floatatom 486 360 12 0 0 1 time - -; +#X obj 393 340 unpack s s f f; +#X msg 264 81 open /dev/input/event1; +#X msg 256 58 open /dev/input/event0; +#X msg 280 103 open /dev/input/event2; +#X msg 292 124 open /dev/input/event3; +#X msg 304 144 open /dev/input/event4; +#X obj 85 321 route ev_key ev_rel ev_abs; +#X floatatom 203 367 7 0 0 0 - - -; +#X floatatom 261 367 7 0 0 0 - - -; +#X obj 203 346 route abs_x abs_y; +#X obj 86 81 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 0 1; +#X floatatom 455 377 12 0 0 1 value - -; +#X symbolatom 423 394 10 0 0 1 eventcode - -; +#X symbolatom 393 413 15 0 0 1 eventtype - -; +#X floatatom 85 451 5 0 0 0 - - -; +#X floatatom 160 452 5 0 0 0 - - -; +#X obj 85 429 route key_f key_leftctrl btn_left; +#X floatatom 235 452 5 0 0 0 - - -; +#X obj 53 195 bng 35 250 50 0 empty empty event_received 38 18 1 8 -225280 -1 -1; -#X obj 2 2 cnv 15 600 20 empty empty "hid" 2 11 1 18 -233017 -66577 -0; -#X text 312 234 outlet message format:; -#X text 336 248 eventtype eventcode value timestamp; +#X obj 2 2 cnv 15 900 20 empty empty hid 2 11 1 18 -233017 -66577 0 +; +#X text 354 263 outlet message format:; +#X text 378 277 eventtype eventcode value timestamp; +#X obj 742 104 ev-list; +#X obj 742 155 ev_syn-list; +#X obj 742 177 ev_key-list; +#X obj 742 199 ev_rel-list; +#X obj 742 221 ev_abs-list; +#X obj 742 243 ev_msc-list; +#X obj 742 265 ev_led-list; +#X obj 742 287 ev_snd-list; +#X obj 742 309 ev_rep-list; +#X obj 742 331 ev_ff-list; +#X obj 742 353 ev_ff_status-list; +#X text 710 85 Event Types:; +#X text 710 136 Event Codes:; #X connect 1 0 0 0; #X connect 2 0 3 0; #X connect 2 1 4 0; diff --git a/make-arrays-from-input.h.pl b/make-arrays-from-input.h.pl index 9f4db42..710d517 100755 --- a/make-arrays-from-input.h.pl +++ b/make-arrays-from-input.h.pl @@ -2,15 +2,6 @@ use Switch; -# BUGS: FF_STATUS, REP, SND, SYN are not building properly. Its still dropping the first element - - -#======================================================================== -# GLOBAL VARS -#======================================================================== - -$FILENAME = "linux/input.h"; - #======================================================================== # FUNCTIONS #======================================================================== @@ -62,13 +53,50 @@ sub printCArray print("\"$arrayToPrint[$#arrayToPrint]\"\n };\n\n\n"); } +#------------------------------------------------------------------------ +# print an array out in a comment table in Pd +# +sub printPdFile +{ + my @arrayToPrint = @_; + my $x; + my $y; + my $lineNum = 1; + + my $PDFILENAME = "$arrayToPrint[0]-list.pd"; + open(PDFILE, ">$PDFILENAME"); + + print(PDFILE "#N canvas 282 80 210 570 10;\n"); + if ($arrayToPrint[0] eq "ev") { print(PDFILE "#X text 5 5 Event Types;\n"); } + else { print(PDFILE "#X text 5 5 Codes for Type: $arrayToPrint[0];\n"); } + print(PDFILE "#X text 5 20 ----------------------------;\n"); + + for($i = 1; $i <= $#arrayToPrint; $i++) + { + # if the array element's data is null, print NULL + if ($arrayToPrint[$i]) + { + $x = 5; + $y = $lineNum * 20 + 20; + print(PDFILE "#X text $x $y $arrayToPrint[$i];\n"); + $lineNum++; + } + } + + close(PDFILE); +} + #======================================================================== # MAIN #======================================================================== -$FILENAME = "linux/input.h"; +# source file +$SOURCEFILENAME = "linux/input.h"; +open(INPUT_H, "<$SOURCEFILENAME"); -open(INPUT_H, "<$FILENAME"); +# output files +$ARRAYSFILENAME = "input_arrays.h"; +open(ARRAYS, ">$ARRAYSFILENAME"); while () { @@ -101,6 +129,23 @@ while () } } +# generate a .pd file for each array +printPdFile("ev",@EV); +printPdFile("ev_syn",@SYN); +printPdFile("ev_key",@KEY); +printPdFile("ev_rel",@REL); +printPdFile("ev_abs",@ABS); +printPdFile("ev_msc",@MSC); +printPdFile("ev_led",@LED); +printPdFile("ev_snd",@SND); +printPdFile("ev_rep",@REP); +printPdFile("ev_ff",@FF); +# there doesn't seem to be any PWR events yet... +#printPdFile("pwr",@PWR); +printPdFile("ev_ff_status",@FF_STATUS); + +# generate a C array for each array and stick them all in the same file +select ARRAYS; printCArray("ev",@EV); printCArray("ev_syn",@SYN); printCArray("ev_key",@KEY); @@ -150,6 +195,6 @@ print("$1\n };\n"); # #print "PWR: $#PWR \n"; # print "FF_STATUS: $#FF_STATUS \n"; - +close(ARRAYS); close(INPUT_H); -- cgit v1.2.1