[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-mm-commits
Subject: + input-force-feedback-driver-for-zeroplus-devices.patch added to -mm tree
From: akpm () osdl ! org
Date: 2006-05-31 23:11:39
Message-ID: 200605312308.k4VN8ZoJ011090 () shell0 ! pdx ! osdl ! net
[Download RAW message or body]
The patch titled
input: force feedback driver for Zeroplus devices
has been added to the -mm tree. Its filename is
input-force-feedback-driver-for-zeroplus-devices.patch
See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this
------------------------------------------------------
Subject: input: force feedback driver for Zeroplus devices
From: Anssi Hannula <anssi.hannula@gmail.com>
Add force feedback driver for some PSX-style Zeroplus devices.
Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>
Cc: Dmitry Torokhov <dtor_core@ameritech.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
drivers/usb/input/Kconfig | 7 +
drivers/usb/input/Makefile | 3
drivers/usb/input/hid-ff.c | 4 +
drivers/usb/input/hid-zpff.c | 124 +++++++++++++++++++++++++++++++++
drivers/usb/input/hid.h | 1
5 files changed, 139 insertions(+)
diff -puN drivers/usb/input/hid-ff.c~input-force-feedback-driver-for-zeroplus-devices \
drivers/usb/input/hid-ff.c
--- 25/drivers/usb/input/hid-ff.c~input-force-feedback-driver-for-zeroplus-devices Wed \
May 31 16:11:37 2006
+++ 25-akpm/drivers/usb/input/hid-ff.c Wed May 31 16:11:37 2006
@@ -54,6 +54,10 @@ static struct hid_ff_initializer inits[]
#ifdef CONFIG_THRUSTMASTER_FF
{0x44f, 0xb304, hid_tmff_init},
#endif
+#ifdef CONFIG_ZEROPLUS_FF
+ {0xc12, 0x0005, zpff_init},
+ {0xc12, 0x0030, zpff_init},
+#endif
{0, 0, NULL} /* Terminating entry */
};
diff -puN drivers/usb/input/hid.h~input-force-feedback-driver-for-zeroplus-devices \
drivers/usb/input/hid.h
--- 25/drivers/usb/input/hid.h~input-force-feedback-driver-for-zeroplus-devices Wed \
May 31 16:11:37 2006
+++ 25-akpm/drivers/usb/input/hid.h Wed May 31 16:11:37 2006
@@ -527,6 +527,7 @@ static inline void hid_ff_exit(struct hi
int hid_lgff_init(struct hid_device* hid);
int hid_tmff_init(struct hid_device* hid);
+int zpff_init(struct hid_device* hid);
#ifdef CONFIG_HID_PID
int pidff_init(struct hid_device *hid);
diff -puN /dev/null drivers/usb/input/hid-zpff.c
--- /dev/null Thu Apr 11 07:25:15 2002
+++ 25-akpm/drivers/usb/input/hid-zpff.c Wed May 31 16:11:37 2006
@@ -0,0 +1,124 @@
+/*
+ * Force feedback support for Zeroplus based devices
+ *
+ * Copyright (c) 2005, 2006 Anssi Hannula <anssi.hannula@gmail.com>
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+/* #define DEBUG */
+
+#define debug(format, arg...) pr_debug("hid-zpff: " format "\n" , ## arg)
+
+#include <linux/input.h>
+#include <linux/usb.h>
+#include "hid.h"
+struct zpff_device {
+ struct hid_report *report;
+};
+
+static int zpff_play(struct input_dev *dev, struct ff_effect *effect,
+ struct ff_effect *old)
+{
+ struct hid_device *hid = dev->private;
+ struct zpff_device *zpff = hid->ff_private;
+ int left, right;
+
+ /* The following is specified the other way around in the Zeroplus
+ datasheet, but the order below is correct for the XFX Executioner */
+ /* However it is possible that the XFX Executioner is an exception */
+
+ left = effect->u.rumble.strong_magnitude;
+ right = effect->u.rumble.weak_magnitude;
+ debug("called with 0x%04x 0x%04x", left, right);
+
+ left = left * 0x7f / 0xffff;
+ right = right * 0x7f / 0xffff;
+
+ zpff->report->field[2]->value[0] = left;
+ zpff->report->field[3]->value[0] = right;
+ debug("running with 0x%02x 0x%02x", left, right);
+ hid_submit_report(hid, zpff->report, USB_DIR_OUT);
+ return 0;
+}
+
+static void zpff_exit(struct hid_device *hid)
+{
+ struct zpff_device *zpff = hid->ff_private;
+ hid->ff_private = NULL;
+ kfree(zpff);
+}
+
+static struct ff_driver zpff_driver = {
+ .upload = zpff_play,
+};
+
+int zpff_init(struct hid_device *hid)
+{
+ struct zpff_device *zpff;
+ struct hid_report *report;
+ struct hid_input *hidinput =
+ list_entry(hid->inputs.next, struct hid_input, list);
+ struct input_dev *dev = hidinput->input;
+ int ret;
+
+ if (list_empty(&hid->report_enum[HID_OUTPUT_REPORT].report_list)) {
+ printk(KERN_ERR "hid-zpff: no output report found\n");
+ return -1;
+ }
+ report =
+ list_entry(hid->report_enum[HID_OUTPUT_REPORT].report_list.next,
+ struct hid_report, list);
+
+ if (report->maxfield < 4) {
+ printk(KERN_ERR "hid-zpff: not enough fields in report\n");
+ return -1;
+ }
+
+ ret = input_ff_allocate(dev);
+ if (ret)
+ return ret;
+
+ zpff = kzalloc(sizeof(*zpff), GFP_KERNEL);
+ if (!zpff) {
+ return -ENOMEM;
+ }
+
+ hid->ff_private = zpff;
+ hid->ff_exit = zpff_exit;
+
+ set_bit(FF_RUMBLE, dev->ff->flags);
+
+ zpff->report = report;
+ zpff->report->field[0]->value[0] = 0x00;
+ zpff->report->field[1]->value[0] = 0x02;
+ zpff->report->field[2]->value[0] = 0x00;
+ zpff->report->field[3]->value[0] = 0x00;
+ hid_submit_report(hid, zpff->report, USB_DIR_OUT);
+
+ ret = input_ff_register(dev, &zpff_driver);
+ if (ret) {
+ kfree(zpff);
+ return ret;
+ }
+
+ printk(KERN_INFO "Force feedback for Zeroplus based devices by "
+ "Anssi Hannula <anssi.hannula@gmail.com>\n");
+
+ return 0;
+}
diff -puN drivers/usb/input/Kconfig~input-force-feedback-driver-for-zeroplus-devices \
drivers/usb/input/Kconfig
--- 25/drivers/usb/input/Kconfig~input-force-feedback-driver-for-zeroplus-devices Wed \
May 31 16:11:37 2006
+++ 25-akpm/drivers/usb/input/Kconfig Wed May 31 16:11:37 2006
@@ -87,6 +87,13 @@ config THRUSTMASTER_FF
Note: if you say N here, this device will still be supported, but without
force feedback.
+config ZEROPLUS_FF
+ bool "Zeroplus based game controller support"
+ depends on HID_FF
+ help
+ Say Y here if you have a Zeroplus based game controller and want to
+ enable force feedback for it.
+
config USB_HIDDEV
bool "/dev/hiddev raw HID device support"
depends on USB_HID
diff -puN drivers/usb/input/Makefile~input-force-feedback-driver-for-zeroplus-devices \
drivers/usb/input/Makefile
--- 25/drivers/usb/input/Makefile~input-force-feedback-driver-for-zeroplus-devices Wed \
May 31 16:11:37 2006
+++ 25-akpm/drivers/usb/input/Makefile Wed May 31 16:11:37 2006
@@ -22,6 +22,9 @@ endif
ifeq ($(CONFIG_THRUSTMASTER_FF),y)
usbhid-objs += hid-tmff.o
endif
+ifeq ($(CONFIG_ZEROPLUS_FF),y)
+ usbhid-objs += hid-zpff.o
+endif
ifeq ($(CONFIG_HID_FF),y)
usbhid-objs += hid-ff.o
endif
_
Patches currently in -mm which might be from anssi.hannula@gmail.com are
input-move-fixp-arithh-to-drivers-input.patch
input-fix-accuracy-of-fixp-arithh.patch
input-new-force-feedback-interface.patch
input-adapt-hid-force-feedback-drivers-for-the-new-interface.patch
input-adapt-uinput-for-the-new-force-feedback-interface.patch
input-adapt-iforce-driver-for-the-new-force-feedback-interface.patch
input-force-feedback-driver-for-pid-devices.patch
input-force-feedback-driver-for-zeroplus-devices.patch
input-update-documentation-of-force-feedback.patch
input-drop-the-remains-of-the-old-ff-interface.patch
input-drop-the-old-pid-driver.patch
input-use-enospc-instead-of-enomem-in-iforce-when-device-full.patch
-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic