]> Devoid-pointer.net GitWeb - KLGD_FF_plugin.git/commitdiff
Read autocentering support from ffbits
authorMichal Malý <madcatxster@devoid-pointer.net>
Wed, 19 Aug 2015 21:48:44 +0000 (23:48 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Wed, 19 Aug 2015 21:48:44 +0000 (23:48 +0200)
klgd_ff_plugin.c
klgd_ff_plugin.h
klgdff.c

index 30e65da7c84eeac0007ff02ffba103db81f21502..ae5526df297a83e467c41f87699c0dd6e4084655 100644 (file)
@@ -1393,12 +1393,14 @@ int ffpl_init_plugin(struct klgd_plugin **plugin, struct input_dev *dev, const s
                priv->has_native_gain = true;
                printk(KERN_NOTICE "KLGDFF: Using HAS_NATIVE_GAIN\n");
        }
-       if (FFPL_HAS_AUTOCENTER & flags) {
+
+       if (FF_AUTOCENTER & priv->supported_effects) {
                priv->has_autocenter = true;
-               set_bit(FF_AUTOCENTER, dev->ffbit);
+               input_set_capability(dev, EV_FF, FF_AUTOCENTER);
                printk(KERN_NOTICE "KLGDFF: Using HAS_AUTOCENTER\n");
        }
-       set_bit(FF_GAIN, dev->ffbit);
+
+       input_set_capability(dev, EV_FF, FF_GAIN);
        for (idx = 0; idx <= (FF_WAVEFORM_MAX - FF_EFFECT_MIN); idx++) {
                if (test_bit(idx, &priv->supported_effects)) {
                        printk(KERN_NOTICE "KLGDFF: Has bit %d, effect type %d\n", idx, FF_EFFECT_MIN + idx);
index e7c7e4c1f707879e8b8fde2f27f2dd35b47ff0d8..9a6cc49b23d4beb86b44bd9bc21a20d72bbec756 100644 (file)
@@ -20,7 +20,6 @@
 #define FFPL_TIMING_CONDITION BIT(9)    /* Let the plugin take care of starting and stopping of condition effects */
 
 #define FFPL_HAS_NATIVE_GAIN BIT(15)  /* Device can adjust the gain by itself */
-#define FFPL_HAS_AUTOCENTER BIT(16) /* Device supports autocentering */
 
 enum ffpl_control_command {
        /* Force feedback state transitions */
index 83fe1606a367c1fc7bf1279aadacb8f9d1596833..51b12607f879fd6696bf1f5408a2edd01ed228a0 100644 (file)
--- a/klgdff.c
+++ b/klgdff.c
@@ -354,9 +354,10 @@ static int __init klgdff_init(void)
        input_set_capability(dev, EV_KEY, BTN_TRIGGER);
        input_set_abs_params(dev, ABS_X, -0x7fff, 0x7fff, 0, 0);
        input_set_abs_params(dev, ABS_Y, -0x7fff, 0x7fff, 0, 0);
+       set_bit(FF_AUTOCENTER, &ffbits);
 
        ret = ffpl_init_plugin(&ff_plugin, dev, EFFECT_COUNT, ffbits,
-                              FFPL_HAS_EMP_TO_SRT | FFPL_REPLACE_STARTED | FFPL_HAS_AUTOCENTER | FFPL_MEMLESS_RAMP | FFPL_TIMING_CONDITION,
+                              FFPL_HAS_EMP_TO_SRT | FFPL_REPLACE_STARTED | FFPL_MEMLESS_RAMP | FFPL_TIMING_CONDITION,
                               klgdff_control, &test_user);
        if (ret) {
                printk(KERN_ERR "KLGDFF-TD: Cannot init plugin\n");