hid-zpff.c (48a732dfaa77a4dfec803aa8f248373998704f76) hid-zpff.c (d881427253da011495f4193663d809d0e9dfa215)
1/*
2 * Force feedback support for Zeroplus based devices
3 *
4 * Copyright (c) 2005, 2006 Anssi Hannula <anssi.hannula@gmail.com>
5 */
6
7/*
8 * This program is free software; you can redistribute it and/or modify

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

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/hid.h>
25#include <linux/input.h>
26#include <linux/slab.h>
1/*
2 * Force feedback support for Zeroplus based devices
3 *
4 * Copyright (c) 2005, 2006 Anssi Hannula <anssi.hannula@gmail.com>
5 */
6
7/*
8 * This program is free software; you can redistribute it and/or modify

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

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/hid.h>
25#include <linux/input.h>
26#include <linux/slab.h>
27#include <linux/usb.h>
28#include <linux/module.h>
29
30#include "hid-ids.h"
31
32#ifdef CONFIG_ZEROPLUS_FF
27#include <linux/module.h>
28
29#include "hid-ids.h"
30
31#ifdef CONFIG_ZEROPLUS_FF
33#include "usbhid/usbhid.h"
34
35struct zpff_device {
36 struct hid_report *report;
37};
38
39static int zpff_play(struct input_dev *dev, void *data,
40 struct ff_effect *effect)
41{

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

54 dbg_hid("called with 0x%04x 0x%04x\n", left, right);
55
56 left = left * 0x7f / 0xffff;
57 right = right * 0x7f / 0xffff;
58
59 zpff->report->field[2]->value[0] = left;
60 zpff->report->field[3]->value[0] = right;
61 dbg_hid("running with 0x%02x 0x%02x\n", left, right);
32
33struct zpff_device {
34 struct hid_report *report;
35};
36
37static int zpff_play(struct input_dev *dev, void *data,
38 struct ff_effect *effect)
39{

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

52 dbg_hid("called with 0x%04x 0x%04x\n", left, right);
53
54 left = left * 0x7f / 0xffff;
55 right = right * 0x7f / 0xffff;
56
57 zpff->report->field[2]->value[0] = left;
58 zpff->report->field[3]->value[0] = right;
59 dbg_hid("running with 0x%02x 0x%02x\n", left, right);
62 usbhid_submit_report(hid, zpff->report, USB_DIR_OUT);
60 hid_hw_request(hid, zpff->report, HID_REQ_SET_REPORT);
63
64 return 0;
65}
66
67static int zpff_init(struct hid_device *hid)
68{
69 struct zpff_device *zpff;
70 struct hid_report *report;

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

99 return error;
100 }
101
102 zpff->report = report;
103 zpff->report->field[0]->value[0] = 0x00;
104 zpff->report->field[1]->value[0] = 0x02;
105 zpff->report->field[2]->value[0] = 0x00;
106 zpff->report->field[3]->value[0] = 0x00;
61
62 return 0;
63}
64
65static int zpff_init(struct hid_device *hid)
66{
67 struct zpff_device *zpff;
68 struct hid_report *report;

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

97 return error;
98 }
99
100 zpff->report = report;
101 zpff->report->field[0]->value[0] = 0x00;
102 zpff->report->field[1]->value[0] = 0x02;
103 zpff->report->field[2]->value[0] = 0x00;
104 zpff->report->field[3]->value[0] = 0x00;
107 usbhid_submit_report(hid, zpff->report, USB_DIR_OUT);
105 hid_hw_request(hid, zpff->report, HID_REQ_SET_REPORT);
108
109 hid_info(hid, "force feedback for Zeroplus based devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
110
111 return 0;
112}
113#else
114static inline int zpff_init(struct hid_device *hid)
115{

--- 42 unchanged lines hidden ---
106
107 hid_info(hid, "force feedback for Zeroplus based devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
108
109 return 0;
110}
111#else
112static inline int zpff_init(struct hid_device *hid)
113{

--- 42 unchanged lines hidden ---