Tizen / jkeys

Automatically exported from code.google.com/p/jkeys
1 stars 1 forks source link

After a few presses on the joystick it stops working #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a configuration file
2. Start jkeys using the configuration file and firefox
3. Start playing (works only for the first few button presses)
4. jkeys stops working

What is the expected output? What do you see instead?
It should continue working as expected, but instead it stops working after a 
few button presses.

What version of the product are you using? On what operating system?
I synced to the latest version from the svn repo. I am on 64 bit Ubuntu 9.10 
(Karmic) with 2.6.31-22-generic kernel.

Please provide any additional information below.
Joystick mappings found : 
 - axis 7 direction low mapped to key Return
 - axis 7 direction high mapped to key Shift
 - button 1 mapped to key 2
 - button 0 mapped to key 1
 - button 3 mapped to key 3
 - button 2 mapped to key 4
 - button 4 mapped to key 5
Starting application
['firefox']

(firefox:7558): GLib-WARNING **: g_set_prgname() called multiple times
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 525, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.6/threading.py", line 477, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/dhruva/Games/jkeys/joystick.py", line 115, in run
    res = gethatcode(ev)
NameError: global name 'gethatcode' is not defined

Original issue reported on code.google.com by dhruva.s...@gmail.com on 13 Jul 2010 at 4:41

GoogleCodeExporter commented 9 years ago
I realise this is a really old report, but I had the same issue using a 
Swordfish PS3 clone / PC controller on Ubuntu. 'Hat' events weren't handled 
properly, so if your joystick has hats ( 
http://en.wikipedia.org/wiki/Joystick#Hat_switch ) jkeys would fail as soon as 
a hat event occurred.

Attached is a patch for joystick.py that fixes this issue and allows hats to be 
configured by combining two axes in a .joy file as follows:

    <!-- DPad -->
        <axis number="4" low="Left" high="Right" />
        <axis number="5" low="Down" high="Up" />
    <hat number="0" x="4" y="5" />

I wrote the patch some time ago, and can't remember all the details, but if 
there is interest I can provide more info and examples. There may be a better 
way to configure joystick hats, but this works for my controller.

Hope this helps someone!

Original comment by charles....@gmail.com on 17 Sep 2011 at 6:24

Attachments:

GoogleCodeExporter commented 9 years ago
I tried to set the gamepade (saitek 580) for playing teeworlds via jkeys 
command and config file (attached file tee.joy). This works only for a few 
button presses, then I get the same error you descripted here. I'd like to test 
your hat.patch, but don't know how. My gamepade has 6 axes and 13 buttons. 
Could you please give some more info?

Original comment by ales.raz...@gmail.com on 7 Dec 2011 at 7:47

Attachments:

GoogleCodeExporter commented 9 years ago
Hi there,

If you are using a Linux OS and already have jkeys installed, 

1) download the hat.patch file into the 'jkeys-read-only' directory
2) open up a command line shell and cd to jkeys-read-only
3) type:
     patch < hat.patch

That should modify the joystick.py file to fix the error for you so at least 
jkeys runs without falling over.

The controller you are using looks similar to mine, although the axis are 
probably assigned different numbers. I am guessing it is your d-pad that is the 
hat that is causing the problem and from the tee.joy file axis 0 and 1 are l/r 
and up/down, so try this in your tee.joy config:
        <axis number="0" low="a" high="d" />
        <axis number="1" low="s" high="w" />
    <hat number="0" x="0" y="1" />

Let me know if you have trouble with the patch command, and whether the 
suggested config works! Good luck :)

Original comment by charles....@gmail.com on 8 Dec 2011 at 11:44