hid-tmff.c (48a732dfaa77a4dfec803aa8f248373998704f76) hid-tmff.c (d881427253da011495f4193663d809d0e9dfa215)
1/*
2 * Force feedback support for various HID compliant devices by ThrustMaster:
3 * ThrustMaster FireStorm Dual Power 2
4 * and possibly others whose device ids haven't been added.
5 *
6 * Modified to support ThrustMaster devices by Zinx Verituse
7 * on 2003-01-25 from the Logitech force feedback driver,
8 * which is by Johann Deneux.

--- 16 unchanged lines hidden (view full) ---

25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 */
29
30#include <linux/hid.h>
31#include <linux/input.h>
32#include <linux/slab.h>
1/*
2 * Force feedback support for various HID compliant devices by ThrustMaster:
3 * ThrustMaster FireStorm Dual Power 2
4 * and possibly others whose device ids haven't been added.
5 *
6 * Modified to support ThrustMaster devices by Zinx Verituse
7 * on 2003-01-25 from the Logitech force feedback driver,
8 * which is by Johann Deneux.

--- 16 unchanged lines hidden (view full) ---

25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 */
29
30#include <linux/hid.h>
31#include <linux/input.h>
32#include <linux/slab.h>
33#include <linux/usb.h>
34#include <linux/module.h>
35
36#include "hid-ids.h"
37
38static const signed short ff_rumble[] = {
39 FF_RUMBLE,
40 -1
41};
42
43static const signed short ff_joystick[] = {
44 FF_CONSTANT,
45 -1
46};
47
48#ifdef CONFIG_THRUSTMASTER_FF
33#include <linux/module.h>
34
35#include "hid-ids.h"
36
37static const signed short ff_rumble[] = {
38 FF_RUMBLE,
39 -1
40};
41
42static const signed short ff_joystick[] = {
43 FF_CONSTANT,
44 -1
45};
46
47#ifdef CONFIG_THRUSTMASTER_FF
49#include "usbhid/usbhid.h"
50
51/* Usages for thrustmaster devices I know about */
52#define THRUSTMASTER_USAGE_FF (HID_UP_GENDESK | 0xbb)
53
54struct tmff_device {
55 struct hid_report *report;
56 struct hid_field *ff_field;
57};

--- 40 unchanged lines hidden (view full) ---

98 ff_field->logical_maximum);
99 y = tmff_scale_s8(effect->u.ramp.end_level,
100 ff_field->logical_minimum,
101 ff_field->logical_maximum);
102
103 dbg_hid("(x, y)=(%04x, %04x)\n", x, y);
104 ff_field->value[0] = x;
105 ff_field->value[1] = y;
48
49/* Usages for thrustmaster devices I know about */
50#define THRUSTMASTER_USAGE_FF (HID_UP_GENDESK | 0xbb)
51
52struct tmff_device {
53 struct hid_report *report;
54 struct hid_field *ff_field;
55};

--- 40 unchanged lines hidden (view full) ---

96 ff_field->logical_maximum);
97 y = tmff_scale_s8(effect->u.ramp.end_level,
98 ff_field->logical_minimum,
99 ff_field->logical_maximum);
100
101 dbg_hid("(x, y)=(%04x, %04x)\n", x, y);
102 ff_field->value[0] = x;
103 ff_field->value[1] = y;
106 usbhid_submit_report(hid, tmff->report, USB_DIR_OUT);
104 hid_hw_request(hid, tmff->report, HID_REQ_SET_REPORT);
107 break;
108
109 case FF_RUMBLE:
110 left = tmff_scale_u16(effect->u.rumble.weak_magnitude,
111 ff_field->logical_minimum,
112 ff_field->logical_maximum);
113 right = tmff_scale_u16(effect->u.rumble.strong_magnitude,
114 ff_field->logical_minimum,
115 ff_field->logical_maximum);
116
117 dbg_hid("(left,right)=(%08x, %08x)\n", left, right);
118 ff_field->value[0] = left;
119 ff_field->value[1] = right;
105 break;
106
107 case FF_RUMBLE:
108 left = tmff_scale_u16(effect->u.rumble.weak_magnitude,
109 ff_field->logical_minimum,
110 ff_field->logical_maximum);
111 right = tmff_scale_u16(effect->u.rumble.strong_magnitude,
112 ff_field->logical_minimum,
113 ff_field->logical_maximum);
114
115 dbg_hid("(left,right)=(%08x, %08x)\n", left, right);
116 ff_field->value[0] = left;
117 ff_field->value[1] = right;
120 usbhid_submit_report(hid, tmff->report, USB_DIR_OUT);
118 hid_hw_request(hid, tmff->report, HID_REQ_SET_REPORT);
121 break;
122 }
123 return 0;
124}
125
126static int tmff_init(struct hid_device *hid, const signed short *ff_bits)
127{
128 struct tmff_device *tmff;

--- 138 unchanged lines hidden ---
119 break;
120 }
121 return 0;
122}
123
124static int tmff_init(struct hid_device *hid, const signed short *ff_bits)
125{
126 struct tmff_device *tmff;

--- 138 unchanged lines hidden ---