HID: fix hid-ff drivers so that devices work even without ff support

Currently, the hid-*ff force feedback drivers, which claim the blacklisted
device on a HID bus, are only compiled in if the user selects force feedback
support.

However we want the device to be supported even when the kernel is configured
without force feedback.

This patch fixes the drivers in a way that they get compiled even if force
feedback is turned off; all the force feedback support code is compiled out in
such case, and the driver works as a usual driver on HID bus, claiming and
initializing the device, making it operational without FF effects.

Reported-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
Jiri Kosina 2009-05-15 15:46:44 +02:00
parent fac733f029
commit 0f6f4319a7
6 changed files with 95 additions and 25 deletions

View file

@ -116,9 +116,16 @@ config HID_CYPRESS
---help---
Support for cypress mouse and barcode readers.
config DRAGONRISE_FF
tristate "DragonRise Inc. force feedback support"
config HID_DRAGONRISE
tristate "DragonRise Inc. support" if EMBEDDED
depends on USB_HID
default !EMBEDDED
---help---
Say Y here if you have DragonRise Inc.game controllers.
config DRAGONRISE_FF
bool "DragonRise Inc. force feedback support"
depends on HID_DRAGONRISE
select INPUT_FF_MEMLESS
---help---
Say Y here if you want to enable force feedback support for DragonRise Inc.
@ -160,7 +167,7 @@ config HID_LOGITECH
Support for Logitech devices that are not fully compliant with HID standard.
config LOGITECH_FF
bool "Logitech force feedback"
bool "Logitech force feedback support"
depends on HID_LOGITECH
select INPUT_FF_MEMLESS
help
@ -176,7 +183,7 @@ config LOGITECH_FF
force feedback.
config LOGIRUMBLEPAD2_FF
bool "Logitech Rumblepad 2 force feedback"
bool "Logitech Rumblepad 2 force feedback support"
depends on HID_LOGITECH
select INPUT_FF_MEMLESS
help
@ -211,11 +218,19 @@ config HID_PANTHERLORD
---help---
Support for PantherLord/GreenAsia based device support.
config HID_PANTHERLORD
tristate "Pantherlord support" if EMBEDDED
depends on USB_HID
default !EMBEDDED
---help---
Say Y here if you have a PantherLord/GreenAsia based game controller
or adapter.
config PANTHERLORD_FF
bool "Pantherlord force feedback support"
depends on HID_PANTHERLORD
select INPUT_FF_MEMLESS
help
---help---
Say Y here if you have a PantherLord/GreenAsia based game controller
or adapter and want to enable force feedback support for it.
@ -247,9 +262,17 @@ config HID_SUNPLUS
---help---
Support for Sunplus wireless desktop.
config GREENASIA_FF
tristate "GreenAsia (Product ID 0x12) force feedback support"
config HID_GREENASIA
tristate "GreenAsia (Product ID 0x12) support" if EMBEDDED
depends on USB_HID
default !EMBEDDED
---help---
Say Y here if you have a GreenAsia (Product ID 0x12) based game
controller or adapter.
config GREENASIA_FF
bool "GreenAsia (Product ID 0x12) force feedback support"
depends on HID_GREENASIA
select INPUT_FF_MEMLESS
---help---
Say Y here if you have a GreenAsia (Product ID 0x12) based game controller
@ -278,13 +301,22 @@ config HID_TOPSEED
---help---
Say Y if you have a TopSeed Cyberlink remote control.
config THRUSTMASTER_FF
tristate "ThrustMaster devices support"
config HID_THRUSTMASTER
tristate "ThrustMaster devices support" if EMBEDDED
depends on USB_HID
select INPUT_FF_MEMLESS
help
default !EMBEDDED
---help---
Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or
a THRUSTMASTER Ferrari GT Rumble Force or Force Feedback Wheel.
a THRUSTMASTER Ferrari GT Rumble Wheel.
config THRUSTMASTER_FF
bool "ThrustMaster devices force feedback support"
depends on HID_THRUSTMASTER
select INPUT_FF_MEMLESS
---help---
Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or
a THRUSTMASTER Ferrari GT Rumble Force or Force Feedback Wheel and
want to enable force feedback support for it.
config HID_WACOM
tristate "Wacom Bluetooth devices support" if EMBEDDED
@ -293,13 +325,21 @@ config HID_WACOM
---help---
Support for Wacom Graphire Bluetooth tablet.
config ZEROPLUS_FF
tristate "Zeroplus based game controller support"
config HID_ZEROPLUS
tristate "Zeroplus based game controller support" if EMBEDDED
depends on USB_HID
select INPUT_FF_MEMLESS
help
default !EMBEDDED
---help---
Say Y here if you have a Zeroplus based game controller.
config ZEROPLUS_FF
bool "Zeroplus based game controller force feedback support"
depends on HID_ZEROPLUS
select INPUT_FF_MEMLESS
---help---
Say Y here if you have a Zeroplus based game controller and want
to have force feedback support for it.
endmenu
endif # HID_SUPPORT

View file

@ -22,7 +22,7 @@ obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
obj-$(CONFIG_DRAGONRISE_FF) += hid-drff.o
obj-$(CONFIG_HID_DRAGONRISE) += hid-drff.o
obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
obj-$(CONFIG_HID_GYRATION) += hid-gyration.o
obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o
@ -37,10 +37,10 @@ obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o
obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o
obj-$(CONFIG_HID_SONY) += hid-sony.o
obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o
obj-$(CONFIG_GREENASIA_FF) += hid-gaff.o
obj-$(CONFIG_THRUSTMASTER_FF) += hid-tmff.o
obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o
obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o
obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o
obj-$(CONFIG_ZEROPLUS_FF) += hid-zpff.o
obj-$(CONFIG_HID_ZEROPLUS) += hid-zpff.o
obj-$(CONFIG_HID_WACOM) += hid-wacom.o
obj-$(CONFIG_USB_HID) += usbhid/

View file

@ -32,6 +32,8 @@
#include <linux/hid.h>
#include "hid-ids.h"
#ifdef CONFIG_DRAGONRISE_FF
#include "usbhid/usbhid.h"
struct drff_device {
@ -135,6 +137,12 @@ static int drff_init(struct hid_device *hid)
return 0;
}
#else
static inline int drff_init(struct hid_device *hid)
{
return 0;
}
#endif
static int dr_probe(struct hid_device *hdev, const struct hid_device_id *id)
{

View file

@ -31,6 +31,8 @@
#include <linux/usb.h>
#include <linux/hid.h>
#include "hid-ids.h"
#ifdef CONFIG_GREENASIA_FF
#include "usbhid/usbhid.h"
struct gaff_device {
@ -130,6 +132,12 @@ static int gaff_init(struct hid_device *hid)
return 0;
}
#else
static inline int gaff_init(struct hid_device *hdev)
{
return 0;
}
#endif
static int ga_probe(struct hid_device *hdev, const struct hid_device_id *id)
{

View file

@ -33,11 +33,6 @@
#include "hid-ids.h"
#include "usbhid/usbhid.h"
/* Usages for thrustmaster devices I know about */
#define THRUSTMASTER_USAGE_FF (HID_UP_GENDESK | 0xbb)
static const signed short ff_rumble[] = {
FF_RUMBLE,
-1
@ -48,6 +43,12 @@ static const signed short ff_joystick[] = {
-1
};
#ifdef CONFIG_THRUSTMASTER_FF
#include "usbhid/usbhid.h"
/* Usages for thrustmaster devices I know about */
#define THRUSTMASTER_USAGE_FF (HID_UP_GENDESK | 0xbb)
struct tmff_device {
struct hid_report *report;
struct hid_field *ff_field;
@ -209,6 +210,12 @@ fail:
kfree(tmff);
return error;
}
#else
static inline int tmff_init(struct hid_device *hid, const signed short *ff_bits)
{
return 0;
}
#endif
static int tm_probe(struct hid_device *hdev, const struct hid_device_id *id)
{

View file

@ -27,6 +27,7 @@
#include "hid-ids.h"
#ifdef CONFIG_ZEROPLUS_FF
#include "usbhid/usbhid.h"
struct zpff_device {
@ -108,6 +109,12 @@ static int zpff_init(struct hid_device *hid)
return 0;
}
#else
static inline int zpff_init(struct hid_device *hid)
{
return 0;
}
#endif
static int zp_probe(struct hid_device *hdev, const struct hid_device_id *id)
{