Only in /usr/src/linux-2.6.4: config-2.6.4-rc1 diff -r -u linux-2.6.4/drivers/input/joystick/gamecon.c /usr/src/linux-2.6.4/drivers/input/joystick/gamecon.c --- linux-2.6.4/drivers/input/joystick/gamecon.c 2004-03-11 03:55:54.000000000 +0100 +++ /usr/src/linux-2.6.4/drivers/input/joystick/gamecon.c 2004-03-11 15:30:59.000000000 +0100 @@ -47,6 +47,7 @@ MODULE_PARM(gc_2,"2-6i"); MODULE_PARM(gc_3,"2-6i"); MODULE_PARM(gc_psx_delay, "i"); +MODULE_PARM(gc_psx_map_axes, "i"); #define GC_SNES 1 #define GC_NES 2 @@ -231,6 +232,7 @@ #define GC_PSX_ID(x) ((x) >> 4) /* High nibble is device type */ #define GC_PSX_LEN(x) ((x) & 0xf) /* Low nibble is length in words */ +static int gc_psx_map_axes = 0; static int gc_psx_delay = GC_PSX_DELAY; static short gc_psx_abs[] = { ABS_X, ABS_Y, ABS_RX, ABS_RY, ABS_HAT0X, ABS_HAT0Y }; static short gc_psx_btn[] = { BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_A, BTN_B, BTN_X, BTN_Y, @@ -410,7 +412,6 @@ case GC_PSX_NEGCON: case GC_PSX_ANALOG: - for (j = 0; j < 4; j++) input_report_abs(dev + i, gc_psx_abs[j], data[j + 2]); @@ -429,11 +430,23 @@ case GC_PSX_NORMAL: - input_report_abs(dev + i, ABS_X, 128 + !(data[0] & 0x20) * 127 - !(data[0] & 0x80) * 128); - input_report_abs(dev + i, ABS_Y, 128 + !(data[0] & 0x40) * 127 - !(data[0] & 0x10) * 128); + if (!gc_psx_map_axes) { + input_report_abs(dev + i, ABS_X, 128 + !(data[0] & 0x20) * 127 - !(data[0] & 0x80) * 128); + input_report_abs(dev + i, ABS_Y, 128 + !(data[0] & 0x40) * 127 - !(data[0] & 0x10) * 128); + + for (j = 0; j < 8; j++) + input_report_key(dev + i, gc_psx_btn[j], ~data[1] & (1 << j)); + } else { + // map axes to buttons + input_report_key(dev + i, BTN_TL, (~data[0] & 0x80) | (~data[1] & 0x01)); + input_report_key(dev + i, BTN_TR, (~data[0] & 0x20) | (~data[1] & 0x02)); + input_report_key(dev + i, BTN_TL2, (~data[0] & 0x10) | (~data[1] & 0x04)); + input_report_key(dev + i, BTN_TR2, (~data[0] & 0x40) | (~data[1] & 0x08)); + + for (j = 4; j < 8; j++) + input_report_key(dev + i, gc_psx_btn[j], ~data[1] & (1 << j)); + } - for (j = 0; j < 8; j++) - input_report_key(dev + i, gc_psx_btn[j], ~data[1] & (1 << j)); input_report_key(dev + i, BTN_START, ~data[0] & 0x08); input_report_key(dev + i, BTN_SELECT, ~data[0] & 0x01); @@ -656,10 +669,17 @@ } static int __init gc_psx_setup(char *str) { +static int __init gc_psx_map_setup(char *str) +{ + get_option(&str, &gc_psx_map_axes); + return 1; +} + get_option(&str, &gc_psx_delay); return 1; } __setup("gc=", gc_setup); +__setup("gc_psx_map_axes=", gc_psx_map_setup); __setup("gc_2=", gc_setup_2); __setup("gc_3=", gc_setup_3); __setup("gc_psx_delay=", gc_psx_setup);