linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
To: johann deneux <johann.deneux@gmail.com>
Cc: Anssi Hannula <anssi.hannula@gmail.com>,
	"STenyaK (Bruno Gonzalez)" <stenyak@gmail.com>,
	linux-input <linux-input@atrey.karlin.mff.cuni.cz>,
	Valentin Zagura <puthre@gmail.com>
Subject: Re: [PATCH] Added device to hid-ff
Date: Fri, 16 Feb 2007 12:28:44 -0500	[thread overview]
Message-ID: <d120d5000702160928t23741e18jf3dc0fd95c3ab4cd@mail.gmail.com> (raw)
In-Reply-To: <d120d5000702160803g54616f28ya1d13fb4bb78503b@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1481 bytes --]

On 2/16/07, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> On 2/16/07, johann deneux <johann.deneux@gmail.com> wrote:
> > On 2/15/07, Anssi Hannula <anssi.hannula@gmail.com> wrote:
> > > Dmitry Torokhov wrote:
> > > > On 2/15/07, STenyaK (Bruno Gonzalez) <stenyak@gmail.com> wrote:
> > > >> Sorry for not providing a proper patch, could you please also add
> > > >>         {0x46d, 0xc294, hid_lgff_init}, // Logitech G25 wheel
> > > >> to the list? I tested it here and that wheel is also working.
> > > >>
> > > >
> > > > OK.
> > > >
> > >
> > > Hmm.. Shouldn't an entry also be added to the devices[] list in
> > > hid-lgff.c for these devices? (and it seems one device is already
> > > missing from there in the current kernel).
> > >
> > > I'm not able to check right now, but I think some earlier kernels may
> > > have defaulted to ff_joystick if no entry is present in devices[], hence
> > > these devices working for some without the entry.
> > > (so the alternative is to restore that behaviour)
> >
> > Yes, defaulting to joystick was the way it was when I wrote hid-lgff.c, and
> > I guess Valentin made his original patch on a kernel where defaulting was
> > still there.
> > I'll send a separate mail with the patch adding the devices there too, but I
> > personally think defaulting was nice. Was there a reason behind the removal?
> >
>
> Simple oversight. I think we should restore defaulting.
>

Something like the attached should do I think...

-- 
Dmitry

[-- Attachment #2: hid-lgff-default-to-joystick.patch --]
[-- Type: text/plain, Size: 1593 bytes --]

Input: hid-lgff - treat devices as joysticks unless told otherwise

By default threat devices as joysticks with constant force-feedback
effect.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
 drivers/usb/input/hid-lgff.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Index: linux/drivers/usb/input/hid-lgff.c
===================================================================
--- linux.orig/drivers/usb/input/hid-lgff.c
+++ linux/drivers/usb/input/hid-lgff.c
@@ -55,7 +55,6 @@ static const struct dev_type devices[] =
 	{ 0x046d, 0xc294, ff_joystick },
 	{ 0x046d, 0xc295, ff_joystick },
 	{ 0x046d, 0xca03, ff_joystick },
-	{ 0x0000, 0x0000, ff_joystick }
 };
 
 static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *effect)
@@ -107,8 +106,9 @@ int hid_lgff_init(struct hid_device* hid
 	struct input_dev *dev = hidinput->input;
 	struct hid_report *report;
 	struct hid_field *field;
+	const signed short *ff_bits = ff_joystick;
 	int error;
-	int i, j;
+	int i;
 
 	/* Find the report to use */
 	if (list_empty(report_list)) {
@@ -132,12 +132,14 @@ int hid_lgff_init(struct hid_device* hid
 	for (i = 0; i < ARRAY_SIZE(devices); i++) {
 		if (dev->id.vendor == devices[i].idVendor &&
 		    dev->id.product == devices[i].idProduct) {
-			for (j = 0; devices[i].ff[j] >= 0; j++)
-				set_bit(devices[i].ff[j], dev->ffbit);
+			ff_bits = devices[i].ff;
 			break;
 		}
 	}
 
+	for (i = 0; ff_bits[i] >= 0; i++)
+		set_bit(ff_bits[i], dev->ffbit);
+
 	error = input_ff_create_memless(dev, NULL, hid_lgff_play);
 	if (error)
 		return error;

      reply	other threads:[~2007-02-16 17:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-15 18:56 [PATCH] Added device to hid-ff johann deneux
2007-02-15 19:17 ` Dmitry Torokhov
2007-02-15 19:40 ` STenyaK (Bruno Gonzalez)
2007-02-15 19:42   ` Dmitry Torokhov
2007-02-15 19:46     ` Dmitry Torokhov
2007-02-15 19:53       ` STenyaK (Bruno Gonzalez)
2007-02-16 10:05       ` Valentin Zagura
2007-02-16 15:20         ` STenyaK (Bruno Gonzalez)
2007-02-15 19:51     ` Anssi Hannula
2007-02-15 20:09       ` Dmitry Torokhov
2007-02-16 15:43       ` johann deneux
2007-02-16 16:03         ` Dmitry Torokhov
2007-02-16 17:28           ` Dmitry Torokhov [this message]

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=d120d5000702160928t23741e18jf3dc0fd95c3ab4cd@mail.gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=anssi.hannula@gmail.com \
    --cc=johann.deneux@gmail.com \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    --cc=puthre@gmail.com \
    --cc=stenyak@gmail.com \
    /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).