Commit 16e5617e authored by Zinx Verituse's avatar Zinx Verituse Committed by Vojtech Pavlik

input: Add support for ThrustMaster ForceFeedback USB HID devices.

parent 2a5ae84e
...@@ -49,7 +49,7 @@ config HID_FF ...@@ -49,7 +49,7 @@ config HID_FF
If unsure, say N. If unsure, say N.
config HID_PID config HID_PID
bool "PID Devices" bool "PID Devices (Microsoft Sidewinder Force Feedback 2)"
depends on HID_FF depends on HID_FF
help help
Say Y here if you have a PID-compliant joystick and wish to enable force Say Y here if you have a PID-compliant joystick and wish to enable force
...@@ -67,6 +67,15 @@ config LOGITECH_FF ...@@ -67,6 +67,15 @@ config LOGITECH_FF
Note: if you say N here, this device will still be supported, but without Note: if you say N here, this device will still be supported, but without
force feedback. force feedback.
config THRUSTMASTER_FF
bool "ThrustMaster FireStorm Dual Power 2 support (EXPERIMENTAL)"
depends on HID_FF && EXPERIMENTAL
help
Say Y here if you have a THRUSTMASTER FireStore Dual Power 2,
and want to enable force feedback support for it.
Note: if you say N here, this device will still be supported, but without
force feedback.
config USB_HIDDEV config USB_HIDDEV
bool "/dev/hiddev raw HID device support" bool "/dev/hiddev raw HID device support"
depends on USB_HID depends on USB_HID
...@@ -81,7 +90,6 @@ config USB_HIDDEV ...@@ -81,7 +90,6 @@ config USB_HIDDEV
If unsure, say Y. If unsure, say Y.
menu "USB HID Boot Protocol drivers" menu "USB HID Boot Protocol drivers"
depends on USB!=n && USB_HID!=y depends on USB!=n && USB_HID!=y
......
...@@ -19,6 +19,9 @@ endif ...@@ -19,6 +19,9 @@ endif
ifeq ($(CONFIG_LOGITECH_FF),y) ifeq ($(CONFIG_LOGITECH_FF),y)
hid-objs += hid-lgff.o hid-objs += hid-lgff.o
endif endif
ifeq ($(CONFIG_THRUSTMASTER_FF),y)
hid-objs += hid-tmff.o
endif
ifeq ($(CONFIG_HID_FF),y) ifeq ($(CONFIG_HID_FF),y)
hid-objs += hid-ff.o hid-objs += hid-ff.o
endif endif
......
...@@ -38,7 +38,7 @@ typedef s16 fixp_t; ...@@ -38,7 +38,7 @@ typedef s16 fixp_t;
#define FRAC_MASK ((1<<FRAC_N)-1) #define FRAC_MASK ((1<<FRAC_N)-1)
// Not to be used directly. Use fixp_{cos,sin} // Not to be used directly. Use fixp_{cos,sin}
fixp_t cos_table[45] = { static fixp_t cos_table[45] = {
0x0100, 0x00FF, 0x00FF, 0x00FE, 0x00FD, 0x00FC, 0x00FA, 0x00F8, 0x0100, 0x00FF, 0x00FF, 0x00FE, 0x00FD, 0x00FC, 0x00FA, 0x00F8,
0x00F6, 0x00F3, 0x00F0, 0x00ED, 0x00E9, 0x00E6, 0x00E2, 0x00DD, 0x00F6, 0x00F3, 0x00F0, 0x00ED, 0x00E9, 0x00E6, 0x00E2, 0x00DD,
0x00D9, 0x00D4, 0x00CF, 0x00C9, 0x00C4, 0x00BE, 0x00B8, 0x00B1, 0x00D9, 0x00D4, 0x00CF, 0x00C9, 0x00C4, 0x00BE, 0x00B8, 0x00B1,
...@@ -49,7 +49,7 @@ fixp_t cos_table[45] = { ...@@ -49,7 +49,7 @@ fixp_t cos_table[45] = {
/* a: 123 -> 123.0 */ /* a: 123 -> 123.0 */
inline fixp_t fixp_new(s16 a) static inline fixp_t fixp_new(s16 a)
{ {
return a<<FRAC_N; return a<<FRAC_N;
} }
...@@ -58,12 +58,12 @@ inline fixp_t fixp_new(s16 a) ...@@ -58,12 +58,12 @@ inline fixp_t fixp_new(s16 a)
0x8000 -> 1.0 0x8000 -> 1.0
0x0000 -> 0.0 0x0000 -> 0.0
*/ */
inline fixp_t fixp_new16(s16 a) static inline fixp_t fixp_new16(s16 a)
{ {
return ((s32)a)>>(16-FRAC_N); return ((s32)a)>>(16-FRAC_N);
} }
inline fixp_t fixp_cos(unsigned int degrees) static inline fixp_t fixp_cos(unsigned int degrees)
{ {
int quadrant = (degrees / 90) & 3; int quadrant = (degrees / 90) & 3;
unsigned int i = degrees % 90; unsigned int i = degrees % 90;
...@@ -77,12 +77,12 @@ inline fixp_t fixp_cos(unsigned int degrees) ...@@ -77,12 +77,12 @@ inline fixp_t fixp_cos(unsigned int degrees)
return (quadrant == 1 || quadrant == 2)? -cos_table[i] : cos_table[i]; return (quadrant == 1 || quadrant == 2)? -cos_table[i] : cos_table[i];
} }
inline fixp_t fixp_sin(unsigned int degrees) static inline fixp_t fixp_sin(unsigned int degrees)
{ {
return -fixp_cos(degrees + 90); return -fixp_cos(degrees + 90);
} }
inline fixp_t fixp_mult(fixp_t a, fixp_t b) static inline fixp_t fixp_mult(fixp_t a, fixp_t b)
{ {
return ((s32)(a*b))>>FRAC_N; return ((s32)(a*b))>>FRAC_N;
} }
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
extern int hid_lgff_init(struct hid_device* hid); extern int hid_lgff_init(struct hid_device* hid);
extern int hid_lg3d_init(struct hid_device* hid); extern int hid_lg3d_init(struct hid_device* hid);
extern int hid_pid_init(struct hid_device* hid); extern int hid_pid_init(struct hid_device* hid);
extern int hid_tmff_init(struct hid_device* hid);
/* /*
* This table contains pointers to initializers. To add support for new * This table contains pointers to initializers. To add support for new
...@@ -56,6 +57,9 @@ static struct hid_ff_initializer inits[] = { ...@@ -56,6 +57,9 @@ static struct hid_ff_initializer inits[] = {
#endif #endif
#ifdef CONFIG_HID_PID #ifdef CONFIG_HID_PID
{0x45e, 0x001b, hid_pid_init}, {0x45e, 0x001b, hid_pid_init},
#endif
#ifdef CONFIG_THRUSTMASTER_FF
{0x44f, 0xb304, hid_tmff_init},
#endif #endif
{0, 0, NULL} /* Terminating entry */ {0, 0, NULL} /* Terminating entry */
}; };
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment