Comments (2)
As for the first question, I suppose it can work by mapping the key-down and key-repeat events to EV_REL events that move your mouse. Of particular interest here is the --output name=...
clause that allows you to give your output devices a name that xinput recognises. The following script could turn a keyboard into a mouse:
--map key:up:1~ rel:y:-20 \
--map key:down:1~ rel:y:20 \
--map key:left:1~ rel:x:-20 \
--map key:right:1~ rel:x:20 \
--output rel name=fancy-mouse
... at least, that is what was supposed to work, but it turns out that some part of the xinput stack refuses to recognize something as a mouse unless it supports rel:x
, rel:y
and rel:hwheel
. My keyboard apparently has a scrolling wheel which mad the above work for me, but it may not work for others unless you map another key to the scrolling wheel.
evsieve --input /dev/input/by-id/keyboard \
--map key:up:1~ rel:y:-20 \
--map key:down:1~ rel:y:20 \
--map key:left:1~ rel:x:-20 \
--map key:right:1~ rel:x:20 \
--map key:pageup:1~ rel:hwheel:1 \
--map key:pagedown:1~ rel:hwheel:-1 \
--output name=fancy-mouse
Assuming that you can create something xinput recognises as a mouse, you can then assign it its own pointer using the following xinput commands:
xinput create-master "Fancy"
xinput reattach pointer:fancy-mouse "Fancy pointer"
I was further investigating the possibility of mapping a gamepad to a mouse, but then I ran into the above issue of needing to get a scrolling wheel from somewhere, and another issue that my the rate at which my gamepad emits events reporting the state of the sticks is inconsistent (lots of events if you move the stick a lot, zero events if you keep the stick at a stationary position).
Which means that a script that smoothly maps sticks to mice is probably not going to happen until I add some way to smooth out the rate of event reporting.
(Below is the script I was working on for the stick-to-mice map. It suffers from both of the aforementioned issues.)
evsieve --input /dev/input/by-id/usb-Sony_Interactive_Entertainment_Wireless_Controller-if03-event-joystick \
--map abs:x rel:x@mouse1 \
--map abs:y rel:y@mouse1 \
--map abs:rx rel:x@mouse2 \
--map abs:ry rel:y@mouse2 \
`# Multiply the value of all EV_REL events by 0.25 and subtract 32.` \
`# These values were designed for a controller that outputs values in the range 0~255 with value 127 being the rest stand.` \
--map rel ::0.25x-32 \
`# Remove small movements to avoid jitter.` \
--block rel::-2~2 \
--output @mouse1 name=first-mouse \
--output @mouse2 name=second-mouse
from evsieve.
thanks for the sample scripts. i will try it further on my end to see what works.
from evsieve.
Related Issues (20)
- Multi-touch finger count HOT 1
- Unknown event code mapping/copy issue HOT 2
- Possibility to map undefined keys (EV_KEY 300, 301) HOT 1
- 100% CPU usage when using --control-fifo HOT 2
- Handling of bluetooth input devices (no persistent device name, device may be unavailable at startup) HOT 2
- [RFC] Configuration file HOT 7
- compilation issues on 32 bits boards (+ patch) HOT 1
- Make virtual keyboard acts like "physical" HOT 3
- Is it possible to map a mouse's relative position to a controller's analog stick absolute position? HOT 2
- how to output as a virtual joystick? HOT 3
- Key repeat request to kernel HOT 2
- Mouse Accelertion Profile & Pointer Speed HOT 1
- Multi bouton support? HOT 1
- `persist=reopen` does not prevent evsieve from exiting HOT 7
- Generating scroll event from hook HOT 1
- Question: is realtime scheduling priority needed/advised on underpowered hosts? HOT 2
- Slow vertical mouse movements aren't registered when using "--map rel ::0.5x" to reduce mouse sensitivity HOT 4
- Using evsieve to use Wiimote as a mouse: Is it possible? HOT 1
- Hold down key HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from evsieve.