/* * ffcfstress.c * * Force Feedback: Constant Force Stress Test * * Copyright (C) 2001 Oliver Hamann * * 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 */ #include #include #include #include #include #include #include #include #include /* Helper for testing large bit masks */ #define TEST_BIT(bit,bits) (((bits[bit>>5]>>(bit&0x1f))&1)!=0) /* Default values for the options */ #define DEFAULT_DEVICE_NAME "/dev/input/event0" #define DEFAULT_UPDATE_RATE 25.0 #define DEFAULT_MOTION_FREQUENCY 0.1 #define DEFAULT_MOTION_AMPLITUDE 1.0 #define DEFAULT_SPRING_STRENGTH 1.0 /* Options */ const char * device_name = DEFAULT_DEVICE_NAME; double update_rate = DEFAULT_UPDATE_RATE; double motion_frequency = DEFAULT_MOTION_FREQUENCY; double motion_amplitude = DEFAULT_MOTION_AMPLITUDE; double spring_strength = DEFAULT_SPRING_STRENGTH; int stop_and_play = 0; /* Stop-upload-play effects instead of updating */ /* Global variables about the initialized device */ int device_handle; int axis_code, axis_min, axis_max; struct ff_effect effect; /* Parse command line arguments */ void parse_args(int argc, char * argv[]) { int i; if (argc<2) goto l_help; for (i=1; i [