rendered paste bodydiff -rup ~joystick-20051019/utils/jscal.c joystick-20051019/utils/jscal.c
--- jscal.c 2009-05-19 12:07:27.000000000 +0200
+++ jscal.c 2009-05-19 18:01:28.000000000 +0200
@@ -355,7 +355,7 @@ void print_mappings(char *devicename)
}
if (ioctl(fd, JSIOCGBTNMAP, &buttonmap)) {
perror("jscal: error getting button map");
- exit(1);
+ //exit(1);
}
printf("jscal -u %d", axes);
@@ -457,13 +457,14 @@ void set_mappings(char *p)
sscanf(++p, "%d", &btns_on_cl);
p = strstr(p, ",");
- if (btns_on_cl != buttons) {
+ if ((btns_on_cl != buttons)&&(btns_on_cl!=-1)) {
fprintf(stderr, "jscal: joystick has %d buttons and not %d as specified on command line\n",
buttons, btns_on_cl);
exit(1);
}
-
+if(btns_on_cl!=-1)
+{
for (i = 0; i < buttons; i++)
{
if (!p) {
@@ -484,7 +485,7 @@ void set_mappings(char *p)
}
buttonmap[i] = btn_mapping;
}
-
+}
if (p) {
fprintf(stderr, "jscal: too many values\n");
exit(1);
@@ -494,11 +495,14 @@ void set_mappings(char *p)
perror("jscal: error setting axis map");
exit(1);
}
+if(btns_on_cl!=-1)
+{
if (ioctl(fd, JSIOCSBTNMAP, &buttonmap)) {
perror("jscal: error setting button map");
exit(1);
}
}
+}
void set_correction(char *p)
{