/* * Tests the force feedback driver * Copyright 2001 Johann Deneux */ /* * 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 * * You can contact the author by email at this address: * Johann Deneux */ #include #include #include #include #include #include #include #include #define BITS_PER_LONG (sizeof(long) * 8) #define OFF(x) ((x)%BITS_PER_LONG) #define BIT(x) (1UL<> OFF(bit)) & 1) #define N_EFFECTS 4 int main(int argc, char** argv) { struct ff_effect effects[N_EFFECTS]; struct input_event play, stop; int fd; char device_file_name[64]; unsigned long features[4]; int n_effects; /* Number of effects the device can play at the same time */ int i; strncpy(device_file_name, "/dev/input/event0", 64); for (i=1; i= 0 && i < N_EFFECTS) { play.type = EV_FF; play.code = effects[i].id; play.value = 1; if (write(fd, (const void*) &play, sizeof(play)) == -1) { perror("Play effect"); exit(1); } } else { printf("No such effect\n"); } } while (i>=0); /* Stop the effects */ for (i=0; i