-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invert ABS values when min greater than max #21
Invert ABS values when min greater than max #21
Conversation
uinput runs validation on event definitions to ensure min is less than max. This means uinput can't clone devices like the "ADC attached joystick" driver which says: > If min > max, it is left to userspace to treat the axis as inverted. https://www.kernel.org/doc/Documentation/devicetree/bindings/input/adc-joystick.yaml So we need something which inverts everything in user-space. That's what this commit does.
Thank you for the report. I did not expect it to be possible that some device's axis would have a smaller minimum than maximum value, but here we are. Currently quite some capability-propagation logic has been assuming that the invariant max >= min would be upheld. For example, if some device Consequently, the pull request you submitted does not fix the whole issue yet: it happens to work in simple situations where events are passed verbatim like This means that either the capability propagation needs to be revisited to consider how to deal with inverted ranges, or that this issue should be tackled at the Since I am not sure if it is even possible to deal with inverted ranges in the general case (e.g. what should happen if the events of devices with ranges I added commit 13ad710 to simply interpret inverted ranges like It does not yet invert the events that were generated by said device. What is not clear so far is if it would be correct to do so: we have documentation of one linux kernel device driver which says that userspace is expected to interpret malformed ranges as if the event codes were inverted, but does that hold for all device drivers that can output malformed ranges? If all device drivers that output malformed ranges expect their events to be interpreted as if they were inverted, then it would make sense for (Relatedly: I am aware that there is currently no map that inverts the events in a range. I am now working on that now.) Do you know whether it is kernel convention that an axis with a bigger minimum than maximum means that the userspace is intended to treat the received events as inverted? |
@KarsMulder I've had a quick look through the kernel source and I can't easily see another case where the range is documented that it's allowed to be backwards. I do see a few places where the values are passed in straight from the device tree (e.g. I also had a look at the ADC joystick driver's uses and there's nothing in-tree today which has the range inverted. Only thing I can find is my my out-of-tree device, Maybe this is just a weird case and we should just live with an inverting event mapper. |
I suppose that magically inverting some events without being certain that doing so is the right thing, might end up causing more trouble than it solves. If at this point the only known source of In the meanwhile, it is now possible to manually revert axes in userspace using affine maps that are have been added to the main branch (issue #17), e.g.
If the range of |
The ADC joystick driver is in the mainline Linux kernel but the weird uses of it (e.g. DTS files) are out of tree today. Even if the device configurations were merged (hopefully one day soon) I agree that it's not enough evidence that this should be handled specially within evsieve. The range for me is |
uinput runs validation on event definitions to ensure min is less than max. This means uinput can't clone devices like the "ADC attached joystick" driver which says:
https://www.kernel.org/doc/Documentation/devicetree/bindings/input/adc-joystick.yaml
So we need something which inverts everything in user-space. That's what this commit does.