Add ff-memless-next driver
Subsystems (2)
RFC 1/1 Add ff-memless-next driver
Hi,
"ff-memless-next" driver is an extended modification of the original ff-memless driver. Unlike ff-memless, ff-memless-next targets only "serious" FFB devices such as racing wheels and hi(ish)-end joysticks with FFB actuators instead of simple rumble motors. Modifications in ff-memless-next include:
- Support of periodic and ramp effects
These are treated as "combinable" effects and forces created by each of these effects is superposed into one total force
- Support for conditional effects
As these effects cannot be effectively combined together, they are handled separately depending on the capabilities of the underlying HW-specific driver
- Removed emulation of rumble effect
- Adjustable update rate
- Differentiation between "set effect's force to zero" and "stop effect"
- Checks whether the effect's parameters are valid upon upload - this should better be handled by ff-core though IMHO.
At the moment there is no HW-specific backend that would make use of ff-memless-next, the plan is to update hid-lg4ff once ff-memless-next gets accepted by upstream. ff-memless-next can be tested with dummy FFB device module which is available here (git://prifuk.cz/ff-dummy-device).
My primary motivation to write ff-memless-next were limitations of the current ff-memless driver I came across during work on the driver for Logitech gaming wheels. However, ff-memless-next contains no code that would specifically target Logitech devices.
I must give a huge thanks to Elias Vanderstuyft (CC'd) for his extensive testing of the driver and numerous helpful suggestions.
---
From 12c7feb547ff16d91f6d04986862eaf5f266ddeb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20Mal=C3=BD?= <[email protected]>
Date: Sat, 14 Dec 2013 21:53:26 +0100
Subject: [PATCH 1/1] Add ff-memless-next driver
--- drivers/input/Kconfig | 12 + drivers/input/Makefile | 1 + drivers/input/ff-memless-next.c | 675 ++++++++++++++++++++++++++++++++++ include/linux/input/ff-memless-next.h | 29 ++ 4 files changed, 717 insertions(+) create mode 100644 drivers/input/ff-memless-next.c create mode 100644 include/linux/input/ff-memless-next.h
drivers/input/Kconfig +12 -0
@@ -77,6 +77,18 @@ config INPUT_MATRIXKMAP To compile this driver as a module, choose M here: the module will be called matrix-keymap. +config INPUT_FF_MEMLESS_NEXT + tristate "New version of support for memoryless force feedback devices" + help + Say Y here if you want to enable support for various memoryless + force feedback devices (as of now there is no hardware-specific + driver that supports this) + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called ff-memless-next. + comment "Userland interfaces" config INPUT_MOUSEDEV
drivers/input/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o obj-$(CONFIG_INPUT_MATRIXKMAP) += matrix-keymap.o +obj-$(CONFIG_INPUT_FF_MEMLESS_NEXT) += ff-memless-next.o obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o obj-$(CONFIG_INPUT_JOYDEV) += joydev.o
drivers/input/ff-memless-next.c new file +675 -0
675 lines not on this page · raw message
include/linux/input/ff-memless-next.h new file +29 -0
@@ -0,0 +1,29 @@ +#include <linux/input.h> + +enum mlnx_commands { +MLNX_START_COMBINED , +MLNX_STOP_COMBINED , +MLNX_START_UNCOMB , +MLNX_STOP_UNCOMB , +MLNX_CAN_PLAY +}; + +struct mlnx_simple_force { +const s32 x; +const s32 y; +}; + +struct mlnx_uncomb_effect { +const int id; +const struct ff_effect *effect; +}; + +struct mlnx_effect_command { +const enum mlnx_commands cmd; +union { +const struct mlnx_simple_force simple_force; +const struct mlnx_uncomb_effect uncomb; + } u; +}; + +int input_ff_create_mlnx (struct input_dev *dev,void *data,int (*control_effect)(struct input_dev *,void *,const struct mlnx_effect_command *),const u16 update_rate);
Signature · 7 lines
1.8.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
drivers/input/ff-memless-next.c
Quoted 1 line · Michal Malý
drivers/input/ff-memless-next.c +0
-0
[]
drivers/input/ff-memless-next.c line 87
Quoted 3 lines
drivers/input/ff-memless-next.c +3
-0+static inline s32 mlnx_clamp_level (const s32 level) +{ +return (level >0x7fff ) ?0x7fff : ((level <-0x7fff ) ?-0x7fff : level);
clamp(level, -0x7fff, 0x7fff);
[]
drivers/input/ff-memless-next.c line 93
Quoted 4 lines
drivers/input/ff-memless-next.c +4
-0+static inline int mlnx_is_conditional (const struct ff_effect *effect) +{ +return (effect->type ==FF_DAMPER ) || (effect->type ==FF_FRICTION ) || (effect->type ==FF_INERTIA ) || (effect->type ==FF_SPRING ); +}
Maybe try to run your patch through scripts/checkpatch.pl
bool?
80 char line max? (true for the file, not just here) switch?
switch (effect->type) {
case FF_DAMPER:
case FF_FRICTION:
case FF_INERTIA:
case FF_SPRING:
return true;
}
return false;Quoted 23 lines · On Saturday 14 of December 2013 18:04:02 Joe Perches wrote:
drivers/input/ff-memless-next.c
Quoted 2 lines · Michal Malý
drivers/input/ff-memless-next.c +0
-0[]
Quoted 4 lines
drivers/input/ff-memless-next.c +3
-0+static inline s32 mlnx_clamp_level (const s32 level) +{ + return (level > 0x7fff) ? 0x7fff : ((level < -0x7fff) ? -0x7fff :level);
clamp(level, -0x7fff, 0x7fff);[]
Quoted 4 lines
drivers/input/ff-memless-next.c +3
-0+static inline int mlnx_is_conditional (const struct ff_effect *effect) +{ + return (effect->type == FF_DAMPER) || (effect->type == FF_FRICTION) ||(
effect->type==FF_INERTIA) || (effect->type==FF_SPRING); +}Maybe try to run your patch through
scripts/checkpatch.plbool?
80 char line max? (true for the file, not just here) switch?
Quoted 8 lines
switch (effect->type) {
case FF_DAMPER:
case FF_FRICTION:
case FF_INERTIA:
case FF_SPRING:
return true;
}
return false;Okay, thanks for the input. I found a problem regarding effect updating in the code anyway. I'll submit a corrected version of the patch once I'm sure it's fixed.
Michal