Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gamepad Emulator
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gamers & Players
View previous topic :: View next topic  
Author Message
Holysword
l33t
l33t


Joined: 19 Nov 2006
Posts: 946
Location: Greece

PostPosted: Tue Aug 19, 2014 4:15 am    Post subject: Gamepad Emulator Reply with quote

Is there any way to emulate a gamepad? Its quite easy to find tools to do the other way around, to map your gamepad buttons to keyboard keys, but what I want is the opposite: I don't have a gamepad, I want to pretend I have one using my keyboard.

EDIT#1: The gamepad events seem to be something like this:
http://askubuntu.com/questions/14457/remapping-both-mouse-and-keyboard-to-a-gamepad

but I have no idea how to fake them. Is there anything like xdotool that can do that?
_________________
"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Sat Aug 23, 2014 9:54 am    Post subject: Reply with quote

I tried to do something else in the past quite similar but did not succeed.

It all depends how to generate those key events and how to map them
Back to top
View user's profile Send private message
Holysword
l33t
l33t


Joined: 19 Nov 2006
Posts: 946
Location: Greece

PostPosted: Mon Aug 25, 2014 5:08 pm    Post subject: Reply with quote

tw04l124 wrote:
I tried to do something else in the past quite similar but did not succeed.

It all depends how to generate those key events and how to map them

Well yeah, my dilemma is how to even generate those key events - mapping them to something else should be more or less trivial, I hope. Don't you have an idea on how to generate those?
_________________
"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Tue Aug 26, 2014 3:02 pm    Post subject: Reply with quote

Well half of the solution is to use xmodmap.

Though I will have to experiment how to change my events to something useful

https://wiki.archlinux.org/index.php/xmodmap

My events are from this kind:

Code:
Aug 26 16:57:26 localhost logger: ACPI event unhandled: hotkey ATKD 00000053 00000000
Aug 26 16:57:28 localhost kernel: asus_laptop: Unknown key 52 pressed
Aug 26 16:57:27 localhost logger: ACPI event unhandled: hotkey ATKD 00000052 00000002
Aug 26 16:57:29 localhost kernel: asus_laptop: Unknown key 53 pressed
Aug 26 16:57:28 localhost logger: ACPI event unhandled: hotkey ATKD 00000053 00000001
Aug 26 16:57:30 localhost kernel: asus_laptop: Unknown key 54 pressed
Aug 26 16:57:29 localhost logger: ACPI event unhandled: hotkey ATKD 00000054 00000000
Aug 26 16:57:30 localhost logger: ACPI event unhandled: hotkey ATKD 00000055 00000000
Aug 26 16:57:31 localhost kernel: asus_laptop: Unknown key 56 pressed
Aug 26 16:57:30 localhost logger: ACPI event unhandled: hotkey ATKD 00000056 00000000
Aug 26 16:57:35 localhost kernel: asus_laptop: Unknown key 56 pressed
Aug 26 16:57:34 localhost logger: ACPI event unhandled: hotkey ATKD 00000056 00000001
Aug 26 16:57:38 localhost logger: ACPI event unhandled: hotkey ATKD 0000005c 00000000
Aug 26 16:57:41 localhost kernel: asus_laptop: Unknown key c2 pressed
Aug 26 16:57:40 localhost logger: ACPI event unhandled: hotkey ATKD 000000c2 00000000
Aug 26 16:57:42 localhost kernel: asus_laptop: Unknown key c2 pressed
Aug 26 16:57:41 localhost logger: ACPI event unhandled: hotkey ATKD 000000c2 00000001
Aug 26 16:57:43 localhost logger: ACPI event unhandled: hotkey ATKD 0000006b 00000000
Aug 26 16:57:47 localhost logger: ACPI event unhandled: hotkey ATKD 0000005c 00000001
Aug 26 16:57:50 localhost logger: ACPI event unhandled: hotkey ATKD 0000008a 00000000
Aug 26 16:57:53 localhost logger: ACPI event unhandled: hotkey ATKD 0000005c 00000002
Aug 26 16:57:54 localhost logger: ACPI event unhandled: hotkey ATKD 0000005c 00000003
Aug 26 16:57:55 localhost logger: ACPI event unhandled: hotkey ATKD 0000005c 00000004
Aug 26 16:57:57 localhost logger: ACPI event unhandled: hotkey ATKD 0000005c 00000005
Aug 26 17:00:46 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 0000000f
Aug 26 17:00:47 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000010
Aug 26 17:00:47 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000011
Aug 26 17:00:47 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000012
Aug 26 17:00:47 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000013
Aug 26 17:00:47 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000014
Aug 26 17:00:48 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000015
Aug 26 17:00:48 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000016
Aug 26 17:00:48 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000017


Well when I find time I will make some tests.

Basically the x-server is forced to reasign those events, it is now all a matter to write some new rules and test them out here.

The other path is to make your own input device driver altering an existing version of your keyboard and hardcode the desired abilities.
Back to top
View user's profile Send private message
Holysword
l33t
l33t


Joined: 19 Nov 2006
Posts: 946
Location: Greece

PostPosted: Tue Aug 26, 2014 9:20 pm    Post subject: Reply with quote

tw04l124 wrote:
Well half of the solution is to use xmodmap.

Though I will have to experiment how to change my events to something useful

https://wiki.archlinux.org/index.php/xmodmap

My events are from this kind:

Code:
Aug 26 16:57:26 localhost logger: ACPI event unhandled: hotkey ATKD 00000053 00000000
Aug 26 16:57:28 localhost kernel: asus_laptop: Unknown key 52 pressed
Aug 26 16:57:27 localhost logger: ACPI event unhandled: hotkey ATKD 00000052 00000002
Aug 26 16:57:29 localhost kernel: asus_laptop: Unknown key 53 pressed
Aug 26 16:57:28 localhost logger: ACPI event unhandled: hotkey ATKD 00000053 00000001
Aug 26 16:57:30 localhost kernel: asus_laptop: Unknown key 54 pressed
Aug 26 16:57:29 localhost logger: ACPI event unhandled: hotkey ATKD 00000054 00000000
Aug 26 16:57:30 localhost logger: ACPI event unhandled: hotkey ATKD 00000055 00000000
Aug 26 16:57:31 localhost kernel: asus_laptop: Unknown key 56 pressed
Aug 26 16:57:30 localhost logger: ACPI event unhandled: hotkey ATKD 00000056 00000000
Aug 26 16:57:35 localhost kernel: asus_laptop: Unknown key 56 pressed
Aug 26 16:57:34 localhost logger: ACPI event unhandled: hotkey ATKD 00000056 00000001
Aug 26 16:57:38 localhost logger: ACPI event unhandled: hotkey ATKD 0000005c 00000000
Aug 26 16:57:41 localhost kernel: asus_laptop: Unknown key c2 pressed
Aug 26 16:57:40 localhost logger: ACPI event unhandled: hotkey ATKD 000000c2 00000000
Aug 26 16:57:42 localhost kernel: asus_laptop: Unknown key c2 pressed
Aug 26 16:57:41 localhost logger: ACPI event unhandled: hotkey ATKD 000000c2 00000001
Aug 26 16:57:43 localhost logger: ACPI event unhandled: hotkey ATKD 0000006b 00000000
Aug 26 16:57:47 localhost logger: ACPI event unhandled: hotkey ATKD 0000005c 00000001
Aug 26 16:57:50 localhost logger: ACPI event unhandled: hotkey ATKD 0000008a 00000000
Aug 26 16:57:53 localhost logger: ACPI event unhandled: hotkey ATKD 0000005c 00000002
Aug 26 16:57:54 localhost logger: ACPI event unhandled: hotkey ATKD 0000005c 00000003
Aug 26 16:57:55 localhost logger: ACPI event unhandled: hotkey ATKD 0000005c 00000004
Aug 26 16:57:57 localhost logger: ACPI event unhandled: hotkey ATKD 0000005c 00000005
Aug 26 17:00:46 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 0000000f
Aug 26 17:00:47 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000010
Aug 26 17:00:47 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000011
Aug 26 17:00:47 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000012
Aug 26 17:00:47 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000013
Aug 26 17:00:47 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000014
Aug 26 17:00:48 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000015
Aug 26 17:00:48 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000016
Aug 26 17:00:48 localhost logger: ACPI event unhandled: hotkey ATKD 00000031 00000017


Well when I find time I will make some tests.

Basically the x-server is forced to reasign those events, it is now all a matter to write some new rules and test them out here.

The other path is to make your own input device driver altering an existing version of your keyboard and hardcode the desired abilities.

I've used this before but completely forgot about its existence... thanks for the reminder. I will try it out and see how much I can achieve.
_________________
"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
Holysword
l33t
l33t


Joined: 19 Nov 2006
Posts: 946
Location: Greece

PostPosted: Sun Sep 14, 2014 4:51 pm    Post subject: Reply with quote

The events are defined in /usr/src/linux/include/uapi/linux/input.h

The block is:

Code:

#define BTN_JOYSTICK      0x120
#define BTN_TRIGGER      0x120
#define BTN_THUMB      0x121
#define BTN_THUMB2      0x122
#define BTN_TOP         0x123
#define BTN_TOP2      0x124
#define BTN_PINKIE      0x125
#define BTN_BASE      0x126
#define BTN_BASE2      0x127
#define BTN_BASE3      0x128
#define BTN_BASE4      0x129
#define BTN_BASE5      0x12a
#define BTN_BASE6      0x12b
#define BTN_DEAD      0x12f



There might be might be more in the file though.
_________________
"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
Holysword
l33t
l33t


Joined: 19 Nov 2006
Posts: 946
Location: Greece

PostPosted: Thu Oct 30, 2014 7:20 pm    Post subject: Reply with quote

Okay, I think that the answer is here:
http://steamcommunity.com/app/221410/discussions/0/558748653738497361/

It is specifically for XBOX controllers, but that should be good enough. Basically you need xboxdrv to remap something into XBOX events, if I understood correctly. I haven't fully tested that though.
_________________
"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gamers & Players All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum