kozec / sc-controller

User-mode driver and GTK3 based GUI for Steam Controller
GNU General Public License v2.0
1.53k stars 129 forks source link

Mouse / pen pressure emulation #300

Open Kalabasa opened 6 years ago

Kalabasa commented 6 years ago

I would like to map the analog trigger to a mouse axis (eg, REL_Z).

xinput test does not log any input event from trigger press.

The action is

mouse(Rels.REL_Z, 1)

Actually, the trigger does not work for any of the mouse axes (REL_X, REL_Y).

Use case is a paint program (GIMP actually) that accepts "pressure" input for painting. Trying to emulate pressure input through trigger pressure. I figured the gyro + touchpad + analog trigger would make for a good input device for digital painting, but I can't make it work.

kozec commented 6 years ago

REL_Z is currently not supported as emulated mouse has only XY and wheel, but I can check if it can be added.

kozec commented 6 years ago

Ok, I have to ask you what gave you idea that anything of this should work and what's expected output of xinput test. It doesn't looks like it can handle any of REL_Z, ABS_Z nor ABS_PRESSURE.

Kalabasa commented 6 years ago

Well, it is just a wild idea. The Steam controller is a very versatile input device, I think, so I'm trying to use it on everything. I know little about xinput stuff. :sweat_smile:

Here's a sample output of xinput test from someone who has a digital pen

$ xinput test 21 # (excerpt)
motion a[0]=1130 a[1]=525 a[2]=946 a[3]=0 a[4]=0 a[5]=0 
motion a[6]=0 a[7]=0 a[8]=0 a[9]=0 a[10]=0 a[11]=0 
motion a[12]=0 
button press   1 
motion a[0]=1130 a[1]=525 a[2]=1002 a[3]=92 a[4]=0 a[5]=0 
motion a[6]=0 a[7]=0 a[8]=0 a[9]=0 a[10]=0 a[11]=0 
motion a[12]=0 
motion a[0]=1130 a[1]=525 a[2]=1012 a[3]=92 a[4]=0 a[5]=0 
motion a[6]=0 a[7]=0 a[8]=0 a[9]=0 a[10]=0 a[11]=0 
motion a[12]=0 

That digital pen is able to do about 13 axes of motion input. While SC Controller seems to only do a[0] up to a[3].

kozec commented 6 years ago

Just as sad status report, I was not able to get this to work. There is no problem with enabling any kind of mouse axes here, but no combination seems to work with GIMP. Some combinations may cause xinput to stop recognizing SCController Mouse as mouse, but nothing registers as pen.

I'll leave issue open just in case someone knows more, but right now, I just don't know what to emulate :(

insomniacUNDERSCORElemon commented 4 years ago

Any update on this? Particularly for not just pen pressure, but also pen tilt and rotation. I'm interested in using the SC alongside other devices (be it a mouse or drawing tablet/monitor) as in the other device is used for positioning still (and pressure from a pen OR from SC triggers*). The SC would be in your other hand and could also be used for application-specific shortcuts (which obviously is already possible), the really interesting part would be mapping gyro to brush tilt (and trackpad to rotation) which would allow for brush dynamics a user otherwise wouldn't have access to.


A trick I've found is using a mouse as an assist** for my drawing monitor, but in a recent version of Krita the canvas seems bugged (ignores mouse buttons) when doing so (and this might be an issue for input mixing if it did work with the SC controller). However it oddly works fine in the brush scratchpad, if you click outside of the canvas, or just if pen input is lost for a few seconds.

*=triggers offering no need of screen contact (no nib wear, particularly for high-pressure) and potentially better control+sensitivity

**=full-pressure from mouseclick and position from pen without needing screen contact, middle-mouse to pan, GUI control without moving drawing hand, right-click menu etc