Code Monkey home page Code Monkey logo

Comments (2)

KarsMulder avatar KarsMulder commented on June 12, 2024 1

This is currently not possible.

It does seem like a feature worth adding, however it is not simple to extend the --map syntax to make this possible due to details of implementation, the evdev protocol, and UX.

So I am considering adding a --rel-to-abs argument (relatedly: I think it was a a mistake to add relative maps instead of a --abs-to-rel argument), which would look something like either...

    --input /dev/input/by-id/[mouse] \
    --rel-to-abs range=0~255 speed=1 \
    --output

... or ...

    --input /dev/input/by-id/[mouse] \
    --rel-to-abs rel:x abs:x:0~255 speed=1 \
    --rel-to-abs rel:y abs:y:0~255 speed=1 \
    --output

... but I'm still figuring out some UI aspects of it. (I'll follow up on this later, I just thought I should write something to show that this issue isn't getting ignored...)

from evsieve.

KarsMulder avatar KarsMulder commented on June 12, 2024

I have now implemented the --rel-to-abs argument on the master branch according to the second plan:

    --input /dev/input/by-id/[mouse] \
    --rel-to-abs rel:x abs:x:0~255 speed=1 \
    --rel-to-abs rel:y abs:y:0~255 speed=1 \
    --output

I'm not sure if I actually like the current design though. I may significantly change the API before this reaches stable, but you can already use it if you don't mind your scripts getting broken in a future update.

Maybe I should make more generic and rename it to --add-to instead. Or maybe it should be more specific and have a way to map rel:x → abs:x, rel:y → abs:y, rel:z → abs:z, rel:rx → abs:rx, rel:ry → abs:ry, rel:rz → abs:rz without using six arguments, one for each of those.

It currently requires you to define a range for the output values, because the evdev protocol requires you to define which range the values can take. But maybe it is possible to figure out some sensible default range if the user does not provide one?

Relatedly, currently the initial value of the axes is zero. Maybe it should instead be the center of the output range, which makes sense for rel-to-abs conversion, but perhaps not if I were to rename the argument to something generic like --add-to.

Also undecided on whether I should keep the speed clause. It currently causes some i32-to-f64-to-i32 conversions in the internal mechanics, even if the default speed of 1 is used (which I imagine to be the by-far-most-common usage.) Those conversions don't use that much computing power, but it still feels a bit bloaty. Multiplying values by a factor is already possible with --map anyway (e.g. --map abs ::2x will double the value of all abs-type events.)

from evsieve.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.