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

Remaping Two Controlers into a single Virtual Controler #47

Open
Heaven-Art opened this issue Sep 9, 2024 · 1 comment
Open

Remaping Two Controlers into a single Virtual Controler #47

Heaven-Art opened this issue Sep 9, 2024 · 1 comment

Comments

@Heaven-Art
Copy link

Heaven-Art commented Sep 9, 2024

I've been trying to get this to work for the last 4 or 5 hours, so I'm not sure if it's me not getting it or what. :(

Basically I'm trying to map a HOTAS Setup (Joystick + Throttle) in a single Virtual Sick, I've manage to actually do so, but allot of the keys have the same designation so it becomes a mess of both controllers "pressing" the same key.
As such I'm trying to map these to the equivalent of a XBox controller (mostly because it fits my specific usecase), I was using the example in the Readme to go about doing it but I've run into a issue.

I'm trying to map the x and y axis on the Throttle controller (it has a mini stick) the --print gives me a range of 0 ~ 1023 but the virtual one ends up in something like -23000 ~ 23000, making it unusable.

 #!/bin/bash
 sudo evsieve --input /dev/input/by-id/usb-Thrustmaster_T.16000M-event-joystick domain=J grab \
         --input /dev/input/by-id/usb-Thrustmaster_TWCS_Throttle-event-joystick domain=T grab \
         --map yield abs:hat0y:-1@T             abs:hat0y:-1    \
         --map yield abs:hat0y:0@T         abs:hat0y:0    \
         --map yield abs:hat0y:1@T              abs:hat0y:1  \
         --map yield abs:hat0y:0@T          abs:hat0y:0  \
         --map yield abs:hat0x:-1@T             abs:hat0x:-1  \
         --map yield abs:hat0x:0@T         abs:hat0x:0  \
         --map yield abs:hat0x:1@T              abs:hat0x:1 \
         --map yield abs:hat0x:0@T          abs:hat0x:0 \
         --map yield btn:%300@T                btn:south       \
         --map yield btn:base6@T               btn:east       \
         --map yield btn:base5@T               btn:north       \
         --map yield btn:%301@T                btn:west       \
         --map yield rel:x@T    rel:x:0.25x     \
         --map yield rel:y@T    rel:y:0.25x      \
         --map yield abs:x:~0..1023~@J    abs:rx     \
         --map yield abs:y:~0..1023~@J    abs:ry     \
         --output name=VJoy create-link=/dev/input/by-id/VJoy

As far as I've speculated it might be because the mapping has the same name in both the original device to the virtual one?

But the rel:y:0.25x doesn't even seem to do any difference do anything vs just rel:y .

I've also tried

   --rel-to-abs rel:x@T    abs:x:0~1023 speed=1 \
   --rel-to-abs rel:y@T    abs:y:0~1023 speed=1 \

But for some reason I can't use --rel-to-abs

While parsing the arguments "--rel-to-abs rel:x abs:x:0~1000":
  Invalid argument: encountered unknown argument: --rel-to-abs
@KarsMulder
Copy link
Owner

The --rel-to-abs argument is still only available on the main branch, not in the latest stable version. It has been quite a while since I've last released a version of evsieve. Sorry, I'll try to release a new version in the next couple of weeks.

The --print argument doesn't show yielded events because yielded events are documented to ignore all other arguments except --output. I'm starting to think that that was a bad design decision.

         --map yield abs:hat0y:-1@T             abs:hat0y:-1    \
         --map yield abs:hat0y:0@T         abs:hat0y:0    \
         --map yield abs:hat0y:1@T              abs:hat0y:1  \
         --map yield abs:hat0y:0@T          abs:hat0y:0  \
         --map yield abs:hat0y:-1@T             abs:hat0y:-1    \
         --map yield abs:hat0y:0@T         abs:hat0y:0    \
         --map yield abs:hat0y:1@T              abs:hat0y:1  \
         --map yield abs:hat0y:0@T          abs:hat0y:0  \

These arguments seem to do nothing effectively nothing. They all map events to the same event and then yield the event. Yielding events is not necessary unless you need to prevent later maps from affecting the generated events (e.g. if you map A to B, and then do not want a later map to turn that B into a C.)

Also, there are two sets of the same four lines. I think you intended the latter set to use @J instead of @T?

         --map yield abs:x:~0..1023~@J    abs:rx     \
         --map yield abs:y:~0..1023~@J    abs:ry     \

These maps probably do not do what you think they do. They mean "if device J generates an abs:x event with a value of 0 or less, and the next abs:x event has a value of 1023 or greater, then create an abs:rx event with the value of the latter event".


I do have more thoughts about the situation, but I decided to scrap the long story I was writing here because it is not clear exactly what you're trying to accomplish and what is going wrong, so I might just be rambling about unrelated stuff.

Could you run the following simplified script with yields removed and prints inserted, and point out which events do not have the value that you want them to have?

#!/bin/bash
sudo evsieve --input /dev/input/by-id/usb-Thrustmaster_T.16000M-event-joystick domain=J grab \
        --input /dev/input/by-id/usb-Thrustmaster_TWCS_Throttle-event-joystick domain=T grab \
        --print \
        --map abs:hat0x    @out \
        --map abs:hat0y    @out \
        --map btn:%300@T   btn:south@out   \
        --map btn:base6@T  btn:east@out    \
        --map btn:base5@T  btn:north@out   \
        --map btn:%301@T   btn:west@out    \
        --map rel:x@T      rel:x:0.25x@out \
        --map rel:y@T      rel:y:0.25x@out \
        --map abs:x@J      abs:rx@out      \
        --map abs:y@J      abs:ry@out      \
        --print  @out \
        --output @out name=VJoy create-link=/dev/input/by-id/VJoy

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