hid-lg3ff.c (020abf03cd659388f94cb328e1e1df0656e0d7ff) hid-lg3ff.c (d881427253da011495f4193663d809d0e9dfa215)
1/*
2 * Force feedback support for Logitech Flight System G940
3 *
4 * Copyright (c) 2009 Gary Stein <LordCnidarian@gmail.com>
5 */
6
7/*
8 * This program is free software; you can redistribute it and/or modify

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

17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23
24#include <linux/input.h>
1/*
2 * Force feedback support for Logitech Flight System G940
3 *
4 * Copyright (c) 2009 Gary Stein <LordCnidarian@gmail.com>
5 */
6
7/*
8 * This program is free software; you can redistribute it and/or modify

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

17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23
24#include <linux/input.h>
25#include <linux/usb.h>
26#include <linux/hid.h>
27
25#include <linux/hid.h>
26
28#include "usbhid/usbhid.h"
29#include "hid-lg.h"
30
31/*
32 * G940 Theory of Operation (from experimentation)
33 *
34 * There are 63 fields (only 3 of them currently used)
35 * 0 - seems to be command field
36 * 1 - 30 deal with the x axis

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

87
88/*
89 * Sign backwards from other Force3d pro
90 * which get recast here in two's complement 8 bits
91 */
92 report->field[0]->value[1] = (unsigned char)(-x);
93 report->field[0]->value[31] = (unsigned char)(-y);
94
27#include "hid-lg.h"
28
29/*
30 * G940 Theory of Operation (from experimentation)
31 *
32 * There are 63 fields (only 3 of them currently used)
33 * 0 - seems to be command field
34 * 1 - 30 deal with the x axis

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

85
86/*
87 * Sign backwards from other Force3d pro
88 * which get recast here in two's complement 8 bits
89 */
90 report->field[0]->value[1] = (unsigned char)(-x);
91 report->field[0]->value[31] = (unsigned char)(-y);
92
95 usbhid_submit_report(hid, report, USB_DIR_OUT);
93 hid_hw_request(hid, report, HID_REQ_SET_REPORT);
96 break;
97 }
98 return 0;
99}
100static void hid_lg3ff_set_autocenter(struct input_dev *dev, u16 magnitude)
101{
102 struct hid_device *hid = input_get_drvdata(dev);
103 struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;

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

113 report->field[0]->value[2] = 0x00;
114 report->field[0]->value[3] = 0x7F;
115 report->field[0]->value[4] = 0x7F;
116 report->field[0]->value[31] = 0x00;
117 report->field[0]->value[32] = 0x00;
118 report->field[0]->value[33] = 0x7F;
119 report->field[0]->value[34] = 0x7F;
120
94 break;
95 }
96 return 0;
97}
98static void hid_lg3ff_set_autocenter(struct input_dev *dev, u16 magnitude)
99{
100 struct hid_device *hid = input_get_drvdata(dev);
101 struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;

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

111 report->field[0]->value[2] = 0x00;
112 report->field[0]->value[3] = 0x7F;
113 report->field[0]->value[4] = 0x7F;
114 report->field[0]->value[31] = 0x00;
115 report->field[0]->value[32] = 0x00;
116 report->field[0]->value[33] = 0x7F;
117 report->field[0]->value[34] = 0x7F;
118
121 usbhid_submit_report(hid, report, USB_DIR_OUT);
119 hid_hw_request(hid, report, HID_REQ_SET_REPORT);
122}
123
124
125static const signed short ff3_joystick_ac[] = {
126 FF_CONSTANT,
127 FF_AUTOCENTER,
128 -1
129};

--- 46 unchanged lines hidden ---
120}
121
122
123static const signed short ff3_joystick_ac[] = {
124 FF_CONSTANT,
125 FF_AUTOCENTER,
126 -1
127};

--- 46 unchanged lines hidden ---