Skip to content
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

Support for AbsInfo #9

Open
BrendanBall opened this issue Aug 27, 2019 · 3 comments
Open

Support for AbsInfo #9

BrendanBall opened this issue Aug 27, 2019 · 3 comments

Comments

@BrendanBall
Copy link

Hi
I'm busy looking at using uinput from rust. At the moment I'm specifically trying to implement absolute positioning pointers. This high level crate doesn't seem to support this right now. Is this crate considered unmaintained seen as it hasn't been worked on in quite a while?

@BrendanBall
Copy link
Author

Ok, I've found it does currently support it, but using an old deprecated method, which is why my search didn't find what I was looking for. see torvalds/linux@052876f

@meh
Copy link
Owner

meh commented Aug 28, 2019

It's not unmaintained, I'm just depressed. Is there documentation on how to use the non-deprecated one?

@BrendanBall
Copy link
Author

Sorry man :( .
I mostly figured it out between the comments at uinput.h and the uinput relative mouse example and created a c prototype example for abs mouse which you can see here.

I can create a PR in the rust-uinput-sys crate as it's currently missing some structs and things, but I think this high level api should likely change, e.g. in .event(Absolute(Position(X))) Absolute should probably take in an AbsInfo because it doesn't work without any configuration (by work I mean the device doesn't end up doing anything even if you create events, at minimum it needs a maximum > 0) as in my c prototype.

One important thing to note regarding the API design taken from the commit that changed this:

These ioctls support all features of the old method, plus a "resolution" field
for absinfo. Furthermore, it's properly forward-compatible to new ABS codes
and a growing "struct input_absinfo" structure.

So ideally this high level api should also be forward compatible to adding more fields to that struct.

The uinput docs do mention though that

UI_ABS_SETUP - Set absolute axis information for the device to setup
----
 This ioctl can be called multiple times and will overwrite previous values.
 If this ioctl fails with -EINVAL, it is recommended to use the old
 "uinput_user_dev" method via write() as a fallback, in case you run on an
 old kernel that does not support this ioctl."

I'm not exactly sure which kernel version this was deprecated at, and how much you want to support old kernels in this crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants