hid-sjoy.c (48a732dfaa77a4dfec803aa8f248373998704f76) hid-sjoy.c (d881427253da011495f4193663d809d0e9dfa215)
1/*
2 * Force feedback support for SmartJoy PLUS PS2->USB adapter
3 *
4 * Copyright (c) 2009 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
5 *
6 * Based of hid-pl.c and hid-gaff.c
7 * Copyright (c) 2007, 2009 Anssi Hannula <anssi.hannula@gmail.com>
8 * Copyright (c) 2008 Lukasz Lubojanski <lukasz@lubojanski.info>

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

23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
27/* #define DEBUG */
28
29#include <linux/input.h>
30#include <linux/slab.h>
1/*
2 * Force feedback support for SmartJoy PLUS PS2->USB adapter
3 *
4 * Copyright (c) 2009 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
5 *
6 * Based of hid-pl.c and hid-gaff.c
7 * Copyright (c) 2007, 2009 Anssi Hannula <anssi.hannula@gmail.com>
8 * Copyright (c) 2008 Lukasz Lubojanski <lukasz@lubojanski.info>

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

23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
27/* #define DEBUG */
28
29#include <linux/input.h>
30#include <linux/slab.h>
31#include <linux/usb.h>
32#include <linux/hid.h>
33#include <linux/module.h>
34#include "hid-ids.h"
35
36#ifdef CONFIG_SMARTJOYPLUS_FF
31#include <linux/hid.h>
32#include <linux/module.h>
33#include "hid-ids.h"
34
35#ifdef CONFIG_SMARTJOYPLUS_FF
37#include "usbhid/usbhid.h"
38
39struct sjoyff_device {
40 struct hid_report *report;
41};
42
43static int hid_sjoyff_play(struct input_dev *dev, void *data,
44 struct ff_effect *effect)
45{

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

52 dev_dbg(&dev->dev, "called with 0x%08x 0x%08x\n", left, right);
53
54 left = left * 0xff / 0xffff;
55 right = (right != 0); /* on/off only */
56
57 sjoyff->report->field[0]->value[1] = right;
58 sjoyff->report->field[0]->value[2] = left;
59 dev_dbg(&dev->dev, "running with 0x%02x 0x%02x\n", left, right);
36
37struct sjoyff_device {
38 struct hid_report *report;
39};
40
41static int hid_sjoyff_play(struct input_dev *dev, void *data,
42 struct ff_effect *effect)
43{

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

50 dev_dbg(&dev->dev, "called with 0x%08x 0x%08x\n", left, right);
51
52 left = left * 0xff / 0xffff;
53 right = (right != 0); /* on/off only */
54
55 sjoyff->report->field[0]->value[1] = right;
56 sjoyff->report->field[0]->value[2] = left;
57 dev_dbg(&dev->dev, "running with 0x%02x 0x%02x\n", left, right);
60 usbhid_submit_report(hid, sjoyff->report, USB_DIR_OUT);
58 hid_hw_request(hid, sjoyff->report, HID_REQ_SET_REPORT);
61
62 return 0;
63}
64
65static int sjoyff_init(struct hid_device *hid)
66{
67 struct sjoyff_device *sjoyff;
68 struct hid_report *report;

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

110 kfree(sjoyff);
111 return error;
112 }
113
114 sjoyff->report = report;
115 sjoyff->report->field[0]->value[0] = 0x01;
116 sjoyff->report->field[0]->value[1] = 0x00;
117 sjoyff->report->field[0]->value[2] = 0x00;
59
60 return 0;
61}
62
63static int sjoyff_init(struct hid_device *hid)
64{
65 struct sjoyff_device *sjoyff;
66 struct hid_report *report;

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

108 kfree(sjoyff);
109 return error;
110 }
111
112 sjoyff->report = report;
113 sjoyff->report->field[0]->value[0] = 0x01;
114 sjoyff->report->field[0]->value[1] = 0x00;
115 sjoyff->report->field[0]->value[2] = 0x00;
118 usbhid_submit_report(hid, sjoyff->report, USB_DIR_OUT);
116 hid_hw_request(hid, sjoyff->report, HID_REQ_SET_REPORT);
119 }
120
121 hid_info(hid, "Force feedback for SmartJoy PLUS PS2/USB adapter\n");
122
123 return 0;
124}
125#else
126static inline int sjoyff_init(struct hid_device *hid)

--- 58 unchanged lines hidden ---
117 }
118
119 hid_info(hid, "Force feedback for SmartJoy PLUS PS2/USB adapter\n");
120
121 return 0;
122}
123#else
124static inline int sjoyff_init(struct hid_device *hid)

--- 58 unchanged lines hidden ---