linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: Jiri Kosina <jkosina@suse.cz>
Cc: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>,
	linux-usb@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH] hid: add force feedback support for SmartJoy PLUS PS2/USB adapter
Date: Mon, 11 May 2009 17:48:55 +0200	[thread overview]
Message-ID: <4A0848E7.9080301@suse.cz> (raw)
In-Reply-To: <alpine.LNX.2.00.0905111712410.22712@wotan.suse.de>

On 05/11/2009 05:17 PM, Jiri Kosina wrote:
> On Fri, 8 May 2009, Jussi Kivilinna wrote:
> 
>> This driver adds force feedback support for SmartJoy PLUS PS2/USB 
>> adapter. I made this driver one device spesific instead of making 
>> generic 'wisegroup-ff' because I have another Wisegroup PS2/USB adapter 
>> that doesn't work same way as SmartJoy PLUS. If another device that is 
>> compatible pops up, this driver could be then renamed to something more 
>> generic.
> 
> Thanks for writing the driver!
> 
>> --- a/drivers/hid/hid-core.c
>> +++ b/drivers/hid/hid-core.c
>> @@ -1312,6 +1312,9 @@ static const struct hid_device_id hid_blacklist[] = {
>>  	{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) },
>>  	{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) },
>>  	{ HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
>> +#if defined(CONFIG_SMARTJOYPLUS_FF) || defined(CONFIG_SMARTJOYPLUS_FF_MODULE)
>> +	{ HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) },
>> +#endif
>>  	{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
>>  	{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
> 
> Hmm, this isn't really compatible with what we have for other drivers, we 
> require the config option to be turned on in order to have support (i.e. 
> we include them into hid_blacklist unconditionally).

Strictly speaking, it depends on whether the device is able to be
managed by the generic layer or not. And it seems it can; this driver
adds only a FF support. If we disabled the FF support in the config and
the #if macro wasn't there, we would lose the device completely even
though it can be handled by the core, without FF though.

So I think, in this particular case, it is OK to have the conditional
line in there.

Or maybe better, to not taint the core code by such a bloat, leave
conditonal only the part of the driver which takes care of FF. The rest
of the driver (only the init/deinit) would be left as unable-to-disable
if !EMBEDDED, like other drivers.

I mean, two Kconfig entries, driver and FF support, driver is built
always if !EMBEDDED, FF is optional and dependent on the driver.
CONFIG_SMARTJOYPLUS_FF is then around sjoyff_init and *_play.



Here comes some of my comments to the rest:

+#define debug(format, arg...) pr_debug("hid-sjoyff: " format "\n" , ## arg)

Define pr_fmt instead of this.

+static int hid_sjoyff_play(struct input_dev *dev, void *data,
+			 struct ff_effect *effect)
+{
+	struct hid_device *hid = input_get_drvdata(dev);
+	struct sjoyff_device *sjoyff = data;
+	u32 left, right;
+
+	left = effect->u.rumble.strong_magnitude;
+	right = effect->u.rumble.weak_magnitude;
+	debug("called with 0x%08x 0x%08x", left, right);
+
+	left = left * 0xff / 0xffff;

Confused here, * ff / ffff, what's the point? Is there any difference
with left /= 0xff?

Thanks for the driver.

  reply	other threads:[~2009-05-11 15:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-08  7:46 [PATCH] hid: add force feedback support for SmartJoy PLUS PS2/USB adapter Jussi Kivilinna
2009-05-08  8:02 ` Oliver Neukum
     [not found]   ` <200905081002.56647.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2009-05-08  8:37     ` Jussi Kivilinna
2009-05-11 15:17 ` Jiri Kosina
2009-05-11 15:48   ` Jiri Slaby [this message]
     [not found]     ` <4A0848E7.9080301-AlSwsSmVLrQ@public.gmane.org>
2009-05-11 15:51       ` Jiri Kosina
2009-05-11 15:53         ` Jiri Slaby
2009-05-25 10:16           ` Jiri Slaby
2009-06-02  9:16             ` Jiri Kosina
2009-05-11 16:05       ` Jussi Kivilinna
2009-05-11 21:46     ` Greg KH
2009-05-11 22:02       ` Jiri Slaby
2009-05-11 22:02         ` Greg KH
2009-05-13  8:10           ` Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A0848E7.9080301@suse.cz \
    --to=jslaby@suse.cz \
    --cc=jkosina@suse.cz \
    --cc=jussi.kivilinna@mbnet.fi \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).