[PATCH 2/2] hid: Don't sign-extend 16-bit values.

Kai Krakow kai at kaishome.de
Mon Feb 11 15:26:26 CST 2019


Hey Zeb!

> >> Wine can pick up controllers from udev, either via hidraw or evdev, as
> >> well as from SDL. As of bd9e130ee, we shouldn't be using signed offsets
> >> anymore when reporting SDL controllers, so I assumed that your
> >> controller was coming through hidraw directly.
> >
> > Not sure, does the log show this? I'm pretty sure it's going through
> > SDL because I can apply SDL controller mappings to it through
> > environment.
>
> Log should show this, yes.
>
> >> The symptoms you describe imply that anything above 0x6000 (?) is
> >> somehow wrapping around to negative, though that doesn't necessarily
> >> make very much sense.
> >
> > Indeed, I'm confused too. ;-)
>
> Well, it's close to an explanation. INSIDE, which prompted these
> patches, showed very similar symptoms: the game assumed that the
> controller had a range of 0-32767, and so mapped 0-16383 to "left" and
> 16384-32767 to "right", and negative values were interpreted as above
> 16384 and therefore also "right". Thus the effect was basically the same
> as you describe, except inverted.
>
> >> Can you provide a log with
> >> +hid,+hidp,+hid_report,+rawinput?
> >
> > Sure, I'll do. But please wait, I really need some sleep now, this was
> > bothering me for a few hours now. ;-)
> >
> > Just let me know: Two logs? One with patches reverted and one without?
>
> Just without any patches reverted (so with the bug visible) will
> hopefully be enough.

Here's the log:
https://gist.github.com/a9b51a975f933482a7125792a66bf3cd

After starting Shadow of the Tomb Raider and at the main menu, I
slowly moved the right stick to the right, then to the left. I
repeated this for the left stick. Then exited the game with dpad and A
button.


Thanks,
Kai



More information about the wine-devel mailing list