diff -Naur linuxconsoletools-1.4.4.orig/utils/bitmaskros.h linuxconsoletools-1.4.4/utils/bitmaskros.h --- linuxconsoletools-1.4.4.orig/utils/bitmaskros.h 1970-01-01 01:00:00.000000000 +0100 +++ linuxconsoletools-1.4.4/utils/bitmaskros.h 2013-02-06 16:37:24.609765086 +0100 @@ -0,0 +1,40 @@ +/* + * bitmaskros.h + * + * Helper macros for large bit masks management + * + * Copyright (C) 2008 Jean-Philippe Meuret + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* Number of bits for 1 unsigned char */ +#define nBitsPerUchar (sizeof(unsigned char) * 8) + +/* Number of unsigned chars to contain a given number of bits */ +#define nUcharsForNBits(nBits) ((((nBits)-1)/nBitsPerUchar)+1) + +/* Index=Offset of given bit in 1 unsigned char */ +#define bitOffsetInUchar(bit) ((bit)%nBitsPerUchar) + +/* Index=Offset of the unsigned char associated to the bit + at the given index=offset */ +#define ucharIndexForBit(bit) ((bit)/nBitsPerUchar) + +/* Value of an unsigned char with bit set at given index=offset */ +#define ucharValueForBit(bit) (((unsigned char)(1))<> bitOffsetInUchar(bit)) & 1) diff -Naur linuxconsoletools-1.4.4.orig/utils/ffcfstress.c linuxconsoletools-1.4.4/utils/ffcfstress.c --- linuxconsoletools-1.4.4.orig/utils/ffcfstress.c 2011-12-15 16:49:01.000000000 +0100 +++ linuxconsoletools-1.4.4/utils/ffcfstress.c 2013-02-06 17:38:47.661870645 +0100 @@ -31,9 +31,7 @@ #include #include - -/* Helper for testing large bit masks */ -#define TEST_BIT(bit,bits) (((bits[bit>>5]>>(bit&0x1f))&1)!=0) +#include "bitmaskros.h" /* Default values for the options */ @@ -42,7 +40,11 @@ #define DEFAULT_MOTION_FREQUENCY 0.1 #define DEFAULT_MOTION_AMPLITUDE 1.0 #define DEFAULT_SPRING_STRENGTH 1.0 +#define DEFAULT_AXIS_INDEX 0 +#define DEFAULT_AXIS_CODE ABS_X +static const char* axis_names[] = { "X", "Y", "Z", "RX", "RY", "RZ", "WHEEL" }; +static const int axis_codes[] = { ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ, ABS_WHEEL }; /* Options */ const char * device_name = DEFAULT_DEVICE_NAME; @@ -50,12 +52,15 @@ double motion_frequency = DEFAULT_MOTION_FREQUENCY; double motion_amplitude = DEFAULT_MOTION_AMPLITUDE; double spring_strength = DEFAULT_SPRING_STRENGTH; +int axis_index = DEFAULT_AXIS_INDEX; +int axis_code = DEFAULT_AXIS_CODE; int stop_and_play = 0; /* Stop-upload-play effects instead of updating */ +int autocenter_off = 0; /* switch the autocentering off */ /* Global variables about the initialized device */ int device_handle; -int axis_code, axis_min, axis_max; +int axis_min, axis_max; struct ff_effect effect; @@ -64,45 +69,69 @@ { int i; - if (argc<2) goto l_help; + int help = (argc < 2); - for (i=1; i [