You are not logged in.

#1 2012-05-31 22:10:41

jwm-art
Member
Registered: 2011-02-01
Posts: 87

Phantom Joystick or M$ "Digital Media" Keyboard !? [solved]

Hi,

Over the past couple of days I've been trying to get a python pygame based game to work. Currently I've had to disable the joystick code in the game to prevent the character relentlessly moving north-west across the screen.

As I don't have a joystick I assumed the game code logic to be faulty in it's handling of non-existent joysticks. However I have since tried an update for another game and discovered the character relentlessly runs around in anticlockwise circles and then remembered this happened the last time I tried that game some time last year (IIRC).

The python game spits out "SDL_JoystickGetAxis value:-32767".

using jstest (from joyutils) on /dev/input/js0 says: 
Joystick (Microsoft Microsoft® Digital Media Keyboard) has 37 axes and 57 buttons. Driver version is 2.1.0.

jstest also reveals the same numerical value as the SDL message above.

While playing either of the games, unplugging the keyboard and/or mouse has no effect on the relentless movement.

I'm only a very casual gamer so haven't found this behaviour elsewhere. The two games I've found to be effected are E.S.P Hadouken, and, Tiny And Big (demo). Games I've found to behave themselves are Minecraft, and OpenRA.

What other tools/utils/diagnostics could I try to pinpoint the problem?

Cheers,
James.

Last edited by jwm-art (2012-06-21 23:31:27)

Offline

#2 2012-05-31 22:24:40

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: Phantom Joystick or M$ "Digital Media" Keyboard !? [solved]

It is not a laptop, is it?  My HP has accelerometers that are normally used to detect a fall to allow the system to unload the disk heads prior to an impact.  My system treats those accelerometers as a virtual joystick.  Kind of cool, really -- but it has caused some games to hiccup.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2012-06-01 14:23:27

jwm-art
Member
Registered: 2011-02-01
Posts: 87

Re: Phantom Joystick or M$ "Digital Media" Keyboard !? [solved]

No not a laptop so no accelerometers. It has something resembling a slider for zoom -/+, and audio volume mute, -/+, and an asortment of other fairly pointless keys.

Looking again at jstest,

* All the axis values begin at zero and the program behaves as if one by one each has been set to -32767
* Moving the "zoom" slider to '+' (up) sets button 38 'on'
* Moving "zoom" slider down to '-' sets button 39 'on' (ie it's not potentiated).
* Pressing the 'Log Off' key sets button 52 'on'.
* Pressing the 'Sleep' key sets axis 13 *from* -32510 *to* -32767

Weird?

Offline

#4 2012-06-12 13:01:48

Hannes
Member
Registered: 2012-06-12
Posts: 1

Re: Phantom Joystick or M$ "Digital Media" Keyboard !? [solved]

Hi,

there are two launchpad bugs, the comments say it's a kernel thing:
https://bugs.launchpad.net/ubuntu/+sour … bug/987622
https://bugs.launchpad.net/ubuntu/+sour … bug/987877

I worked around it by making the corresponding js* devices have permissions 0000.

In /usr/lib/udev/rules.d/52-ms-keyboard.rules:

SUBSYSTEM=="input", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0745", KERNEL=="js[0-9]*", MODE="0000"

your idProduct is probably different.

 $ udevadm info --query=all --name=/input/js0
P: /devices/pci0000:00/0000:00:02.0/usb2/2-3/2-3:1.2/input/input56/js0
N: input/js0
...
E: ID_MODEL_ID=0745
...

This should show your idProduct as ID_MODEL_ID.

$ lsusb
...
Bus 002 Device 015: ID 045e:0745 Microsoft Corp. Nano Transceiver v1.0 for Bluetooth
...

Here it's the id part after the ":"

Unplugging and replugging the keyboard should have udev run the new rule.

does that work for you?

Offline

#5 2012-06-12 14:49:18

jwm-art
Member
Registered: 2011-02-01
Posts: 87

Re: Phantom Joystick or M$ "Digital Media" Keyboard !? [solved]

Hi Hannes,

Yes that works. Thanks a lot!

EDIT: Here's the device ID:

Bus 005 Device 007: ID 045e:00b4 Microsoft Corp. Digital Media Keyboard 1.0A


James.

Last edited by jwm-art (2012-06-12 14:52:53)

Offline

Board footer

Powered by FluxBB