All of lore.kernel.org
 help / color / mirror / Atom feed
* bad handling of HID input reports for a Delcom foot pedal
@ 2014-05-19 19:37 Benjamin Tissoires
  2014-06-18 12:13 ` Jiri Kosina
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Tissoires @ 2014-05-19 19:37 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-input, bmills

Hi Jiri,

Please have a look at: https://bugzilla.kernel.org/show_bug.cgi?id=76461

To me, this device sends garbage and should not send the modifiers
both in a Var input and in an Array input.

I can fix it either by amending the report descriptor of the device
(one byte to change) or by changing hid-input.c for it to send the
events in the array processing no matter what was the previous state
(see below).

I don't know which one to pick because this seems to be a corner case,
so fixing hid-input might not be the place, but I am afraid of
removing part of the reports coming from the device (what if the
modifiers are actually used for something in the report).

Any thoughts on it?

For the record, fixing hid-input would just remove the test in hid_input_field:

                if (value[n] >= min && value[n] <= max
-                       && field->usage[value[n] - min].hid
-                       && search(field->value, value[n], count))
+                       && field->usage[value[n] - min].hid)
                                hid_process_event(hid, field,
&field->usage[value[n] - min], 1, interrupt);
        }

(Sorry, gmail, whitespace damaged and everything)

Cheers,
Benjamin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bad handling of HID input reports for a Delcom foot pedal
  2014-05-19 19:37 bad handling of HID input reports for a Delcom foot pedal Benjamin Tissoires
@ 2014-06-18 12:13 ` Jiri Kosina
  2014-07-06 20:52   ` Bryan Mills
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Kosina @ 2014-06-18 12:13 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: linux-input, bmills

On Mon, 19 May 2014, Benjamin Tissoires wrote:

> Hi Jiri,
> 
> Please have a look at: https://bugzilla.kernel.org/show_bug.cgi?id=76461
> 
> To me, this device sends garbage and should not send the modifiers
> both in a Var input and in an Array input.
> 
> I can fix it either by amending the report descriptor of the device
> (one byte to change) or by changing hid-input.c for it to send the
> events in the array processing no matter what was the previous state
> (see below).
> 
> I don't know which one to pick because this seems to be a corner case,
> so fixing hid-input might not be the place, but I am afraid of
> removing part of the reports coming from the device (what if the
> modifiers are actually used for something in the report).
> 
> Any thoughts on it?
> 
> For the record, fixing hid-input would just remove the test in hid_input_field:
> 
>                 if (value[n] >= min && value[n] <= max
> -                       && field->usage[value[n] - min].hid
> -                       && search(field->value, value[n], count))
> +                       && field->usage[value[n] - min].hid)
>                                 hid_process_event(hid, field,
> &field->usage[value[n] - min], 1, interrupt);
>         }
> 
> (Sorry, gmail, whitespace damaged and everything)

So if modifying the report descriptor is not the option (which is what I 
understood from Bryan's mail), I have to say I don't really like this 
change in hid_input_field(), as it's really rather "non obvious".

How about just creating a device specific input event quirk for this?

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bad handling of HID input reports for a Delcom foot pedal
  2014-06-18 12:13 ` Jiri Kosina
@ 2014-07-06 20:52   ` Bryan Mills
  0 siblings, 0 replies; 3+ messages in thread
From: Bryan Mills @ 2014-07-06 20:52 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Benjamin Tissoires, linux-input

On Wed, Jun 18, 2014 at 8:13 AM, Jiri Kosina <jkosina@suse.cz> wrote:
> On Mon, 19 May 2014, Benjamin Tissoires wrote:
> > Hi Jiri,
> >
> > Please have a look at: https://bugzilla.kernel.org/show_bug.cgi?id=76461
> >
> > To me, this device sends garbage and should not send the modifiers
> > both in a Var input and in an Array input.
> >
> > I can fix it either by amending the report descriptor of the device
> > (one byte to change) or by changing hid-input.c for it to send the
> > events in the array processing no matter what was the previous state
> > (see below).
> >
> > I don't know which one to pick because this seems to be a corner case,
> > so fixing hid-input might not be the place, but I am afraid of
> > removing part of the reports coming from the device (what if the
> > modifiers are actually used for something in the report).
> >
> > Any thoughts on it?
> >
> > For the record, fixing hid-input would just remove the test in hid_input_field:
> >
> >                 if (value[n] >= min && value[n] <= max
> > -                       && field->usage[value[n] - min].hid
> > -                       && search(field->value, value[n], count))
> > +                       && field->usage[value[n] - min].hid)
> >                                 hid_process_event(hid, field,
> > &field->usage[value[n] - min], 1, interrupt);
> >         }
> >
> > (Sorry, gmail, whitespace damaged and everything)
>
> So if modifying the report descriptor is not the option (which is what I
> understood from Bryan's mail), I have to say I don't really like this
> change in hid_input_field(), as it's really rather "non obvious".
>
> How about just creating a device specific input event quirk for this?
>
> --
> Jiri Kosina
> SUSE Labs

A device-specific quirk would be fine.

But what's wrong with simply removing the "search" test?  It's a no-op
for non-quirky devices (which don't send redundant keycodes) and a bug
for quirky ones (which should take the union of redundant keycodes
instead of dropping them).

Removing the test produces simpler code and handles the quirky devices
correctly without the need to check for them explicitly.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-06 20:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-19 19:37 bad handling of HID input reports for a Delcom foot pedal Benjamin Tissoires
2014-06-18 12:13 ` Jiri Kosina
2014-07-06 20:52   ` Bryan Mills

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.