Hi

sorry for the following rather vague description but I am just starting to think about it, so I have not yet explored any options.

The background of what I want to do is to use a wireless presenter (a Genius RingPresenter to be precise) that also can transmit mouse-events to remote-control a raspberry pi.

I do not want to use it as a mouse-replacement (the pi runs headless) but I rather want mouse-movements to be translated into actions, e.g. when I swipe upwards I want the volume of mpd to be increased or something along those lines.

For that what I do is to read mouse-events from a /dev/input/event* device and what I get are events that basically give me a timestamp, an axis (either up-down or left-right) and a some relative movement.

What I now would like to do is detect swipe-movements (ie. "swipe-up", "swipe-down", "swipe-left", "swipe-right") from an array of such events.

Now an up-swipe will probably be defined as some motion that "mainly" goes upwards in a certain amount of time.

Evidently when performing an up-swipe there will also be some events of small movements to the right or left and maybe even a small amount of downward movement so I need some sort of "fuzzyness" in my detection.

Can someone point me to some modules that may be of use for such a task?

Many thanks!


In reply to Detecting swipe movements by morgon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.