From 90dd1056e4dec75159f45596165d495cd6ccb299 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 24 Jan 2006 17:44:40 +0000 Subject: SYN_MAX is not set in linux/input.h and there are only two event codes listed. But the kernel actually puts out a lot of different SYN events. So this script now generates a ev_syn array with 512 init'ed items in the array. That should stop the sigfaults, but it might be a hack svn path=/trunk/externals/hcs/hid/; revision=4479 --- make-arrays-from-input.h.pl | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/make-arrays-from-input.h.pl b/make-arrays-from-input.h.pl index a54ffaa..91d1c2d 100755 --- a/make-arrays-from-input.h.pl +++ b/make-arrays-from-input.h.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w use Switch; @@ -37,7 +37,7 @@ sub getDataFromHeaderLine if ( m/#define ([A-Z0-9_]*)\s+(0x)?([0-9a-f]+)/) { if ($2) { $index = hex($3); } else { $index = $3; } - if ($index >=0) + if ($index >= 0) { $returnArray[0] = $index; $returnArray[1] = lc("$1"); @@ -48,6 +48,26 @@ sub getDataFromHeaderLine } } +#------------------------------------------------------------------------ +# +# this is under construction to make the MAX switch structure cleaner +# donno if it works yet. +sub createNewArray +{ + my $myTypeName = shift; + my $myTypeMaxName = shift; + + my $myIndex; + my $myValue; + my @myNewArray; + + ($myIndex, $myValue) = getDataFromHeaderLine($myTypeMaxName); + @myNewArray = initArrayWithGenericNames( $myTypeName, $myIndex + 1 ); + + return @myNewArray; +} + + #------------------------------------------------------------------------ # declare each array in the header # @@ -156,9 +176,9 @@ while () @SYN = initArrayWithGenericNames( "SYN", $index + 1 ); } case "KEY" { ($index, $value) = getDataFromHeaderLine($_); @KEY = initArrayWithGenericNames( "KEY", $index + 1 ); } - # BTN codes are actually part of the KEY type - case "BTN" { ($index, $value) = getDataFromHeaderLine($_); - @BTN = initArrayWithGenericNames( "KEY", $index + 1 ); } +# BTN codes are actually part of the KEY type, so this array is unused +# case "BTN" { ($index, $value) = getDataFromHeaderLine($_); +# @BTN = initArrayWithGenericNames( "KEY", $index + 1 ); } case "REL" { ($index, $value) = getDataFromHeaderLine($_); @REL = initArrayWithGenericNames( "REL", $index + 1 ); } case "ABS" { ($index, $value) = getDataFromHeaderLine($_); @@ -182,6 +202,10 @@ while () } } +# there is no SYN_MAX defined in input.h, so we set it here: +@SYN = initArrayWithGenericNames( "SYN", 512 ); + + seek( INPUT_H, 0, 0 ); while () { -- cgit v1.2.1