From: Vojtech P. <vo...@us...> - 2005-03-22 13:12:55
|
Update of /cvsroot/linuxconsole/ruby/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12699 Modified Files: inputattach.c jstest.c Log Message: Update utilities. Index: inputattach.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/utils/inputattach.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- inputattach.c 6 Feb 2005 13:49:09 -0000 1.22 +++ inputattach.c 22 Mar 2005 13:12:29 -0000 1.23 @@ -342,6 +342,7 @@ int speed; int flags; unsigned long type; + unsigned long id; unsigned long extra; int flush; int (*init)(int fd, long *id, long *extra); @@ -349,29 +350,33 @@ struct input_types input_types[] = { -{ "--sunkbd", "-skb", B1200, CS8, SERIO_SUNKBD, 0x00, 1, NULL }, -{ "--lkkbd", "-lk", B4800, CS8|CSTOPB, SERIO_LKKBD, 0x00, 1, NULL }, -{ "--vsxxx-aa", "-vs", B4800, CS8|CSTOPB|PARENB|PARODD,SERIO_VSXXXAA, 0x00, 1, NULL }, -{ "--spaceorb", "-orb", B9600, CS8, SERIO_SPACEORB, 0x00, 1, NULL }, -{ "--spaceball", "-sbl", B9600, CS8, SERIO_SPACEBALL,0x00, 0, spaceball_init }, -{ "--magellan", "-mag", B9600, CS8 | CSTOPB | CRTSCTS, SERIO_MAGELLAN, 0x00, 1, magellan_init }, -{ "--warrior", "-war", B1200, CS7 | CSTOPB, SERIO_WARRIOR, 0x00, 1, warrior_init }, -{ "--stinger", "-sting", B1200, CS8, SERIO_STINGER, 0x00, 1, stinger_init }, -{ "--mousesystems", "-msc", B1200, CS8, SERIO_MSC, 0x01, 1, NULL }, -{ "--sunmouse", "-sun", B1200, CS8, SERIO_SUN, 0x01, 1, NULL }, -{ "--microsoft", "-bare", B1200, CS7, SERIO_MS, 0x00, 1, NULL }, -{ "--mshack", "-ms", B1200, CS7, SERIO_MS, 0x01, 1, NULL }, -{ "--mouseman", "-mman", B1200, CS7, SERIO_MP, 0x01, 1, NULL }, -{ "--intellimouse", "-ms3", B1200, CS7, SERIO_MZ, 0x11, 1, NULL }, -{ "--mmwheel", "-mmw", B1200, CS7 | CSTOPB, SERIO_MZP, 0x13, 1, mzp_init }, -{ "--iforce", "-ifor", B38400, CS8, SERIO_IFORCE, 0x00, 0, NULL }, -{ "--newtonkbd", "-newt", B9600, CS8, SERIO_NEWTON, 0x00, 0, newton_init }, -{ "--h3600ts", "-ipaq", B115200, CS8, SERIO_H3600, 0x00, 0, NULL }, -{ "--stowawaykbd", "-ipaqkbd", B115200, CS8, SERIO_STOWAWAY, 0x00, 0, NULL }, -{ "--ps2serkbd", "-ps2ser", B1200, CS8, SERIO_PS2SER, 0x00, 1, NULL }, -{ "--twiddler", "-twid", B2400, CS8, SERIO_TWIDKBD, 0x00, 0, twiddler_init }, -{ "--twiddler-joy", "-twidjoy", B2400, CS8, SERIO_TWIDJOY, 0x00, 0, twiddler_init }, -{ "--dump", "-dump", B2400, CS8, 0, 0x00, 0, dump_init }, +{ "--sunkbd", "-skb", B1200, CS8, SERIO_SUNKBD, 0, 0, 1, NULL }, +{ "--lkkbd", "-lk", B4800, CS8|CSTOPB, SERIO_LKKBD, 0, 0, 1, NULL }, +{ "--vsxxx-aa", "-vs", B4800, CS8|CSTOPB|PARENB|PARODD,SERIO_VSXXXAA, 0, 0, 1, NULL }, +{ "--spaceorb", "-orb", B9600, CS8, SERIO_SPACEORB, 0, 0, 1, NULL }, +{ "--spaceball", "-sbl", B9600, CS8, SERIO_SPACEBALL,0, 0, 0, spaceball_init }, +{ "--magellan", "-mag", B9600, CS8 | CSTOPB | CRTSCTS, SERIO_MAGELLAN, 0, 0, 1, magellan_init }, +{ "--warrior", "-war", B1200, CS7 | CSTOPB, SERIO_WARRIOR, 0, 0, 1, warrior_init }, +{ "--stinger", "-sting", B1200, CS8, SERIO_STINGER, 0, 0, 1, stinger_init }, +{ "--mousesystems", "-msc", B1200, CS8, SERIO_MSC, 0, 0x01, 1, NULL }, +{ "--sunmouse", "-sun", B1200, CS8, SERIO_SUN, 0, 0x01, 1, NULL }, +{ "--microsoft", "-bare", B1200, CS7, SERIO_MS, 0, 0, 1, NULL }, +{ "--mshack", "-ms", B1200, CS7, SERIO_MS, 0, 0x01, 1, NULL }, +{ "--mouseman", "-mman", B1200, CS7, SERIO_MP, 0, 0x01, 1, NULL }, +{ "--intellimouse", "-ms3", B1200, CS7, SERIO_MZ, 0, 0x11, 1, NULL }, +{ "--mmwheel", "-mmw", B1200, CS7 | CSTOPB, SERIO_MZP, 0, 0x13, 1, mzp_init }, +{ "--iforce", "-ifor", B38400, CS8, SERIO_IFORCE, 0, 0, 0, NULL }, +{ "--newtonkbd", "-newt", B9600, CS8, SERIO_NEWTON, 0, 0, 0, newton_init }, +{ "--h3600ts", "-ipaq", B115200, CS8, SERIO_H3600, 0, 0, 0, NULL }, +{ "--stowawaykbd", "-ipaqkbd", B115200, CS8, SERIO_STOWAWAY, 0, 0, 0, NULL }, +{ "--ps2serkbd", "-ps2ser", B1200, CS8, SERIO_PS2SER, 0, 0, 1, NULL }, +{ "--twiddler", "-twid", B2400, CS8, SERIO_TWIDKBD, 0, 0, 0, twiddler_init }, +{ "--twiddler-joy", "-twidjoy", B2400, CS8, SERIO_TWIDJOY, 0, 0, 0, twiddler_init }, +{ "--elotouch", "-elo", B9600, CS8 | CRTSCTS, SERIO_ELO, 0, 0, 0, NULL }, +{ "--elo4002", "-elo6b", B9600, CS8 | CRTSCTS, SERIO_ELO, 1, 0, 0, NULL }, +{ "--elo271-140", "-elo4b", B9600, CS8 | CRTSCTS, SERIO_ELO, 2, 0, 0, NULL }, +{ "--elo261-280", "-elo3b", B9600, CS8 | CRTSCTS, SERIO_ELO, 3, 0, 0, NULL }, +{ "--dump", "-dump", B2400, CS8, 0, 0, 0, 0, dump_init }, { "", "", 0, 0 } }; @@ -436,7 +441,7 @@ if (input_types[type].flush) while (!readchar(fd, &c, 100)); - id = 0; + id = input_types[type].id; extra = input_types[type].extra; if (input_types[type].init && input_types[type].init(fd, &id, &extra)) { Index: jstest.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/utils/jstest.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- jstest.c 19 Oct 2004 07:51:52 -0000 1.7 +++ jstest.c 22 Mar 2005 13:12:30 -0000 1.8 @@ -44,18 +44,38 @@ #include <errno.h> #include <string.h> #include <stdlib.h> +#include <stdint.h> +#include <linux/input.h> #include <linux/joystick.h> +char *axis_names[ABS_MAX + 1] = { +"X", "Y", "Z", "Rx", "Ry", "Rz", "Throttle", "Rudder", +"Wheel", "Gas", "Brake", "?", "?", "?", "?", "?", +"Hat0X", "Hat0Y", "Hat1X", "Hat1Y", "Hat2X", "Hat2Y", "Hat3X", "Hat3Y", +"?", "?", "?", "?", "?", "?", "?", +}; + +char *button_names[KEY_MAX - BTN_MISC + 1] = { +"Btn0", "Btn1", "Btn2", "Btn3", "Btn4", "Btn5", "Btn6", "Btn7", "Btn8", "Btn9", "?", "?", "?", "?", "?", "?", +"LeftBtn", "RightBtn", "MiddleBtn", "SideBtn", "ExtraBtn", "ForwardBtn", "BackBtn", "TaskBtn", "?", "?", "?", "?", "?", "?", "?", "?", +"Trigger", "ThumbBtn", "ThumbBtn2", "TopBtn", "TopBtn2", "PinkieBtn", "BaseBtn", "BaseBtn2", "BaseBtn3", "BaseBtn4", "BaseBtn5", "BaseBtn6", "BtnDead", +"BtnA", "BtnB", "BtnC", "BtnX", "BtnY", "BtnZ", "BtnTL", "BtnTR", "BtnTL2", "BtnTR2", "BtnSelect", "BtnStart", "BtnMode", "BtnThumbL", "BtnThumbR", "?", +"?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", +"WheelBtn", "Gear up", +}; + #define NAME_LENGTH 128 int main (int argc, char **argv) { - int fd; + int fd, i; unsigned char axes = 2; unsigned char buttons = 2; int version = 0x000800; char name[NAME_LENGTH] = "Unknown"; + uint16_t btnmap[KEY_MAX - BTN_MISC + 1]; + uint8_t axmap[ABS_MAX + 1]; if (argc < 2 || argc > 3 || !strcmp("--help", argv[1])) { puts(""); @@ -79,9 +99,23 @@ ioctl(fd, JSIOCGAXES, &axes); ioctl(fd, JSIOCGBUTTONS, &buttons); ioctl(fd, JSIOCGNAME(NAME_LENGTH), name); + ioctl(fd, JSIOCGAXMAP, axmap); + ioctl(fd, JSIOCGBTNMAP, btnmap); + + + printf("Driver version is %d.%d.%d.\n", + version >> 16, (version >> 8) & 0xff, version & 0xff); + + printf("Joystick (%s) has %d axes (", name, axes); + for (i = 0; i < axes; i++) + printf("%s%s", i > 0 ? ", " : "", axis_names[axmap[i]]); + puts(")"); + + printf("and %d buttons (", buttons); + for (i = 0; i < buttons; i++) + printf("%s%s", i > 0 ? ", " : "", button_names[btnmap[i] - BTN_MISC]); + puts(")."); - printf("Joystick (%s) has %d axes and %d buttons. Driver version is %d.%d.%d.\n", - name, axes, buttons, version >> 16, (version >> 8) & 0xff, version & 0xff); printf("Testing ... (interrupt to exit)\n"); /* |