LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 02-23-2009, 06:07 PM   #1
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,197

Rep: Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642
using gamepad as keyboard input


hi, how do i bind a certain button on my gamepad to the space bar ?

is there something like xpadder for linux.

i think i can get what i want by doing something like:
Code:
cat /dev/input/js0 | od
but i dont know where to pipe that output to emulate key presses.
 
Old 02-23-2009, 08:06 PM   #2
gergely89
Member
 
Registered: Feb 2009
Posts: 100

Rep: Reputation: 21
There is a thread on Linuxquestions.org about emulating keypresses at http://www.linuxquestions.org/questi...-press-606487/

It uses xvkbd for that purpose. Maybe you can lead your input to xvkbd in some way, maybe with a small bash script or whatever.

Let us know if it did solve the problem, or at least why it failed.

linux

Last edited by gergely89; 02-27-2009 at 11:54 PM. Reason: syntax error
 
Old 02-23-2009, 08:51 PM   #3
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,197

Original Poster
Rep: Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642
^ thx, but this seems to depend on x11 and i get compilation errors.

i also get this error:
Code:
 sudo echo hello >>  /dev/input/event1
bash: /dev/input/event1: Permission denied
 
Old 02-23-2009, 11:09 PM   #4
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,197

Original Poster
Rep: Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642
i was able to install joy2key after installing libX11-devel

i am currently playing around with that...
 
Old 02-24-2009, 01:35 AM   #5
gergely89
Member
 
Registered: Feb 2009
Posts: 100

Rep: Reputation: 21
Do you want to use the gamepad by a single compiled application only, or is the gamepad supposed to provide input for the whole Linux system?
(I just wonder what purpose is, though game development seems to be the most likely explanation.)
 
Old 02-24-2009, 09:42 AM   #6
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,197

Original Poster
Rep: Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642
^ actually i am using find + file to find all media on my hard drive.
then i am using a zenity checklist to build a playlist that will be passed to xine.
i would prefer not to have to walk to the tv to skip to the next chapter or something.

at this point joy2key only controls 1 window returned by xwininfo so my band-aid approach is to call it twice (once for zenity and once for xine)


is there a way to start a program or script based on a event like joystick button 1 being pressed ?

Last edited by schneidz; 02-24-2009 at 09:45 AM.
 
Old 02-24-2009, 09:52 AM   #7
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,197

Original Poster
Rep: Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642
^ this seems close:
http://www.howtogeek.com/howto/ubunt...-ubuntu-linux/
 
Old 02-25-2009, 02:02 AM   #8
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,197

Original Poster
Rep: Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642
i am using joy2key and it seems like when it runs, the shift key is being pressed along with the keys i assign it to.

this means no lower-case letters...

the problem is, i need to emulate a tab to zenity but it keeps coming out as shift-tab .

any suggestions ?

whats weird is it works fine when using -rawconsole or -terminal
but not when using -X

Last edited by schneidz; 02-25-2009 at 02:04 AM.
 
Old 02-25-2009, 11:29 AM   #9
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,197

Original Poster
Rep: Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642
^ i installed qjoypad and i am having problems mapping buttons to it in the gui.
(for some reason the axises map fine but when i try a button and hit the 'c' key for example the gui says [no key]).

can someone post their config file (layout file) so i can compare and modify it for my needs; the gui isnt generating it correctly for me.
__________________________
# QJoyPad 3.4 Layout File
Code:
Joystick 1 {
Axis 1: gradient, maxSpeed 30, mouse+h
Axis 2: gradient, maxSpeed 10, mouse+v
Axis 3: gradient, maxSpeed 10, mouse+h
Axis 4: gradient, maxSpeed 10, mouse+v
Button 5: mouse 4
Button 6: key 27
Button 7: mouse 5
Button 8: rapidfire, key 41
Button 13: key 25
Button 14: key 40
Button 15: key 39
Button 16: key 38
}

#end of file
i found an example in the ununtu forums.
thx

Last edited by schneidz; 02-25-2009 at 06:40 PM.
 
Old 07-03-2009, 07:09 PM   #10
Oakems
Member
 
Registered: Nov 2008
Posts: 43

Rep: Reputation: 16
Hi, I haven't read the whole post but you asked for a layout file, here's mine;

Code:
# QJoyPad 3.4 Layout File

Joystick 1 {
	Axis 1: gradient, maxSpeed 5, mouse+h
	Axis 2: gradient, maxSpeed 5, mouse+v
	Button 1: sticky, mouse 1
	Button 2: mouse 2
	Button 3: mouse 1
	Button 4: mouse 3
	Button 5: key 9
	Button 7: key 9
}
I just got this working today, I'd been trying to get "js2mouse" working, but was clueless. This was really easy, and everything seems to be working nicely for me, so if you need any help finding out what keys do what (or where they are), just ask. My keyboard has 105 keys, so if yours has that many, then they should be the same.

Last edited by Oakems; 07-03-2009 at 07:10 PM.
 
Old 07-16-2009, 04:04 PM   #11
zarathustra674
Member
 
Registered: Jan 2003
Location: Bible Belt Appalachian Mnts of Western VA/Eastern KY ah hell i don't care, I'm from Grundy. Woo Hoo A megatropolis.
Distribution: Mint KDE w/ a ton of PPA's and Repo's., Might be switching back to Mageia or PCLOS.
Posts: 98

Rep: Reputation: 15
To Schneidz, To get qjoypad working properly, I had to recompile. I don't know what the problem was but If you are using a pre-built package, it could be an older version. If i remember correctly, A lot of distros have packages for 3.4. You need 3.4.1. Anyway this is what worked for me.

As far as js2mouse, I was successful in getting that working years ago to use my logitech cordless wingman as a remote control, if you need help with it let me know. I would recommend sticking to qjoypad.

I have not tried joy2key

I know this was solved but I never saw the solution unless you simply edited the config file manually
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Logitech Wingman Cordless gamepad not showing up in /dev/input Oxagast Linux - Hardware 1 07-24-2008 08:41 PM
convert usb gamepad to wireless gamepad schneidz Linux - Hardware 1 06-12-2008 04:13 PM
Repeated "input: AT Translated Set 2 keyboard as /class/input/input" messages AcerKev Mandriva 2 09-16-2007 09:35 AM
use SDL to read joystick/gamepad input samel_tvom Programming 7 10-09-2006 04:11 PM
my mouse input is takes as keyboard input in BASH e1000 Slackware 5 12-08-2003 04:00 PM


All times are GMT -5. The time now is 10:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration