Getting gamepad to work, detection problems.

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
000dom000
Level 2
Level 2
Posts: 11
Joined: Fri Apr 18, 2008 5:54 am

Getting gamepad to work, detection problems.

Post by 000dom000 »

Hi I recently got my PS3 sixaxis working and its under /dev/input/js1.
I am now running ubuntu hardy.

It doesn't operate in wine games etc so I need to edit the registry using <joystick name> = <axes mapping> in "directinput"

In http://wiki.winehq.org/UsefulRegistryKeys it says to use the command:

Code: Select all

WINEDEBUG=+dinput wine program.exe 2>&1 | grep joydev_enum_device 
to find the name of the device but doing it gives me no output.

Also, doing jstest with js1 I get this:

Code: Select all

Driver version is 2.1.0.
Joystick (Sony PLAYSTATION(R)3 Controller) has 28 axes (X, Y, Z, Rz, (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null))
and 19 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2, PinkieBtn, BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4, BaseBtn5, BaseBtn6, BtnDead, BtnA, BtnB, BtnC, BtnX, BtnY, BtnZ).
Testing ... (interrupt to exit)
Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0  8:     0  9:     0 10:     0 11:     0 12:     0 13:     0 14:     0 15:     0 16:     0 17:     0 18:     0 19:     0 20:     0 21:     0 22:     0 23:     0 24:     0 25:     0 26:     0 27:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off 11:off 12:off 13:off 14:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0  8:     0  9:     0 10:     0 11:     0 12:     0 13:     0 14:     0 15:     0 16:     0 17:     0 18:     0 19:     0 20:     0 21:     0 22:     0 23:     0 24:     0 25:     0 26:     0 27:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off 11:off 12:off 13:off 14:off Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0  8:     0  9:     0 10:     0 11:     0 12:     0 13:     0 14:     0 15:     0 16:     0 17:     0 18:     0 19:     0 20:     0 21:     0 22:     0 23:     0 24:     0 25:     0 26:     0 27:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  
and so on..... it seems to work fine when pressing the buttons but at the top you can see that some of the axes com up as null so therefore cannot edit the directinput registry.

Thanks for your help!
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: Getting gamepad to work, detection problems.

Post by vitamin »

000dom000 wrote:

Code: Select all

WINEDEBUG=+dinput wine program.exe 2>&1 | grep joydev_enum_device
What "program.exe" did you use there? It should be your game or something that uses joystick.
000dom000
Level 2
Level 2
Posts: 11
Joined: Fri Apr 18, 2008 5:54 am

Re: Getting gamepad to work, detection problems.

Post by 000dom000 »

vitamin wrote:
000dom000 wrote:

Code: Select all

WINEDEBUG=+dinput wine program.exe 2>&1 | grep joydev_enum_device
What "program.exe" did you use there? It should be your game or something that uses joystick.
i used the game i am trying to get to work, which at the moment is silent hill 2. I just used sh2pc.exe from program files. I also tried gta san andreas. niether give me any output.
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: Getting gamepad to work, detection problems.

Post by vitamin »

000dom000 wrote:
vitamin wrote:
000dom000 wrote:

Code: Select all

WINEDEBUG=+dinput wine program.exe 2>&1 | grep joydev_enum_device
What "program.exe" did you use there? It should be your game or something that uses joystick.
i used the game i am trying to get to work, which at the moment is silent hill 2. I just used sh2pc.exe from program files. I also tried gta san andreas. niether give me any output.
Find which "/dev/input/event?" is your joystick under by looking at the output from "lshal". chmod it so you have access to it. Then try running your game again. If that still doesn't work, attach output from:

Code: Select all

WINEDEBUG=+dinput wine program.exe 2>&1 | grep find_joydevs
000dom000
Level 2
Level 2
Posts: 11
Joined: Fri Apr 18, 2008 5:54 am

Post by 000dom000 »

here is what lshal gives me

http://pastebin.com/m34859e8a

also starting trying it in the game doesn't work.

WINEDEBUG=+dinput wine program.exe 2>&1 | grep find_joydevs gives me no output.

also another thing to mention, since I have used the gamepad, in some of my wine games, the character is constantly moving left, as if the "a" key is being pressed. taking the gamepad out doesn't change things.
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

000dom000 wrote:here is what lshal gives me

http://pastebin.com/m34859e8a
That useless it's cut-off. I told you what to look for. If you want this to be fixed - help yourself.
000dom000
Level 2
Level 2
Posts: 11
Joined: Fri Apr 18, 2008 5:54 am

Post by 000dom000 »

vitamin wrote:
000dom000 wrote:here is what lshal gives me

http://pastebin.com/m34859e8a
That useless it's cut-off. I told you what to look for. If you want this to be fixed - help yourself.
sorry about that. in terminal the long output cuts off, is there a way to stop that? the short output doesn't give me enough info...

also you said to find out which dev/input/event it is. isn't that what I use for native games. that is /dev/input/js1
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

000dom000 wrote: sorry about that. in terminal the long output cuts off, is there a way to stop that? the short output doesn't give me enough info...

Code: Select all

lshal | less
And look for your joystick's name. You need :

Code: Select all

input.device = '/dev/input/event0'  (string)
Where "0" will be some number.
000dom000 wrote:also you said to find out which dev/input/event it is. isn't that what I use for native games. that is /dev/input/js1
Yes and no. There are 2 joystick input interfaces - "Linux input" and "event device" aka evdev. Evdev is a newer interface. But most distros configured so you don't have direct access to those devices.

You should find which device is it, and chmod it so Wine can use it.
000dom000
Level 2
Level 2
Posts: 11
Joined: Fri Apr 18, 2008 5:54 am

Post by 000dom000 »

wow so simple but it worked!
everything works except the left analogue stick which is rather strange. If I move it a little it goes in the right direction but if I move it all the way in one direction, it suddenly moves in the opposite direction...

EDIT: this only happens for down and right on the analogue stick
gnivler
Level 3
Level 3
Posts: 54
Joined: Wed May 07, 2008 9:30 pm

Post by gnivler »

vitamin wrote:
000dom000 wrote: sorry about that. in terminal the long output cuts off, is there a way to stop that? the short output doesn't give me enough info...

Code: Select all

lshal | less
And look for your joystick's name. You need :

Code: Select all

input.device = '/dev/input/event0'  (string)
Where "0" will be some number.
000dom000 wrote:also you said to find out which dev/input/event it is. isn't that what I use for native games. that is /dev/input/js1
Yes and no. There are 2 joystick input interfaces - "Linux input" and "event device" aka evdev. Evdev is a newer interface. But most distros configured so you don't have direct access to those devices.

You should find which device is it, and chmod it so Wine can use it.
Hi there, I'm brand new to Wine and these forums, and I've jumped into this thread because it seems like that with which I am dealing.

I have an Xbox360 guitar controller, for which I have compiled and installed working drivers in Linux (Ubuntu Hardy - Linux gnivler-desktop 2.6.24-16-generic #1 SMP Thu Apr 10 12:47:45 UTC 2008 x86_64 GNU/Linux).
jscalibrate seems to confirm the controller driver is working on /dev/input/js0, and cat /dev/input/event8 shows response to the controller activity also.

I have no output to the debug command also, which I had to execute with winedbg substituted for WINEDEBUG since I have no command WINEDEBUG that I can find. I ran it with GH3.exe as the program.exe. Zero output after getting into and exiting the game.

Forgive my complete noob-ness in this regard. but you previously mentioned using chmod to make the device(s) usable by wine, and I tried this with 755 and 777 temporarily without any luck (on /dev/input/js0 and /dev/input/event7). Is there more required than just that? Like the DirectInput registry additions or similar?

Thanks for any and all help.

Here is the output of lshal | grep input.device (doesn't seem to show any names at all):

Code: Select all

  input.device = '/dev/input/event5'  (string)
  input.device = '/dev/input/event4'  (string)
  input.device = '/dev/input/event0'  (string)
  input.device = '/dev/input/event10'  (string)
  input.device = '/dev/input/event3'  (string)
  input.device = '/dev/input/event2'  (string)
  input.device = '/dev/input/event1'  (string)
  input.device = '/dev/input/event9'  (string)
  input.device = '/dev/input/event8'  (string)
  input.device = '/dev/input/event7'  (string)
  input.device = '/dev/input/event6'  (string)
and dmesg | grep Xbox:

Code: Select all

[ 2314.573844] input: Microsoft Xbox 360 Wireless Controller (PC) as /devices/pci0000:00/0000:00:0a.0/usb1/1-2/1-2:1.0/input/input15
[ 2314.629628] input: Microsoft Xbox 360 Wireless Controller (PC) as /devices/pci0000:00/0000:00:0a.0/usb1/1-2/1-2:1.2/input/input16
[ 2314.677579] input: Microsoft Xbox 360 Wireless Controller (PC) as /devices/pci0000:00/0000:00:0a.0/usb1/1-2/1-2:1.4/input/input17
[ 2314.741554] input: Microsoft Xbox 360 Wireless Controller (PC) as /devices/pci0000:00/0000:00:0a.0/usb1/1-2/1-2:1.6/input/input18
[ 2314.789501] /home/mason/xpad/xpad.c: driver for Xbox controllers v0.1.7
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

gnivler wrote:I have no output to the debug command also, which I had to execute with winedbg substituted for WINEDEBUG since I have no command WINEDEBUG that I can find. I ran it with GH3.exe as the program.exe. Zero output after getting into and exiting the game.
Wrong. WINEDEBUG is an environment variable. You still have to use "wine" after it. Read closer what I've said above.
gnivler wrote:Forgive my complete noob-ness in this regard. but you previously mentioned using chmod to make the device(s) usable by wine, and I tried this with 755 and 777 temporarily without any luck (on /dev/input/js0 and /dev/input/event7).
So what part did not work?
gnivler wrote:Is there more required than just that? Like the DirectInput registry additions or similar?
You did not say what you want to do. So far you described what you did (which was all wrong). But not a single sentence stated what you need or what exactly doesn't work?
gnivler
Level 3
Level 3
Posts: 54
Joined: Wed May 07, 2008 9:30 pm

Post by gnivler »

vitamin wrote:Wrong. WINEDEBUG is an environment variable. You still have to use "wine" after it. Read closer what I've said above.
Thanks for replying! I ran (then exited the game):

Code: Select all

WINEDEBUG=+dinput wine e:\\games\\guitar\ hero\ iii\\gh3.exe 2>&1 | grep find_joydevs
No output that I can see from that command. I read your posts above several times over trying to find anything I missed. While troubleshooting I removed the grep and the terminal gets flooded with dinput debug information. grep for 'joy' or 'find_' also returning nothing.
vitamin wrote:So what part did not work?
The controller does not respond in game. The chmod changed the permissions though.
vitamin wrote:You did not say what you want to do. So far you described what you did (which was all wrong). But not a single sentence stated what you need or what exactly doesn't work?
I want to make my controller work with Guitar Hero 3 which seems to be working with Wine. I haven't added anything to the registry, and the controller works with linux, though I haven't played any games with it.

Let me know what other information I can provide to help.

thanks again
gnivler
Level 3
Level 3
Posts: 54
Joined: Wed May 07, 2008 9:30 pm

Post by gnivler »

I was reading some other threads here and found a suggestion you had made previously to someone else - I ran a windows joystick test program, and it is seeing the guitar controller and responds accordingly. If it works with one application and not another, does that definitively place the issue with the 2nd application? Seems so to me, but I know nothing about how wine works.

Going to work on it from another angle with native libs and see how that goes, it got the game running in the first place.
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

gnivler wrote:I was reading some other threads here and found a suggestion you had made previously to someone else - I ran a windows joystick test program, and it is seeing the guitar controller and responds accordingly. If it works with one application and not another, does that definitively place the issue with the 2nd application? Seems so to me, but I know nothing about how wine works.
If your game looking for a particular device with specific name then it won't work on Wine. Linux drivers add manufacturer name at the front of the device name. There is nothing Wine can do about this. Ex:
On windows: "Logitech MOMO Racing USB"
On Wine: "Logitech Logitech MOMO Racing"
gnivler wrote:Going to work on it from another angle with native libs and see how that goes, it got the game running in the first place.
Doubt that will help. Native dinput doesn't work with joysticks on Wine. The hardware interface completely different.
gnivler
Level 3
Level 3
Posts: 54
Joined: Wed May 07, 2008 9:30 pm

Post by gnivler »

vitamin wrote:If your game looking for a particular device with specific name then it won't work on Wine. Linux drivers add manufacturer name at the front of the device name. There is nothing Wine can do about this. Ex:
On windows: "Logitech MOMO Racing USB"
On Wine: "Logitech Logitech MOMO Racing"
Interesting and good to know. I am not sure what GH3 is looking for in terms of a controller name but it certainly doesn't seem to be finding it :) The game does not work with other guitar controllers like the one from Rock Band, even when played in Windows or on a console. They have something proprietary going on, not sure what but I did some reading before.
vitamin wrote:Doubt that will help. Native dinput doesn't work with joysticks on Wine. The hardware interface completely different.
You are correct, in fact the native dinput and dinput8 seemed to kill even the keyboard working in the game. Just grasping at straws really, I suspect this game won't work with Wine, based on the facts that the controller works in linux and Wine, but not with this game in Wine.

Did you have any ideas, relating maybe to WINEDEBUG=+dinput, that might shed more light on the process? It didn't output anything as I said earlier, find_joydevs related etc, but I don't understand what that implies at any meaningful level.

Thanks either way

edit/update:

What I have been able to figure out is that this device (from lshal) 'Xbox 360 Wireless Receiver for Windows' creates 4 /dev/input/event entries, in my case 6 to 9, also js0-3. When I delete js0-3, the linux app jscalibrator doesn't find the controller either, it only seems to work on js0-3, strangely on all 4 of them simultaneously.

This makes sense in the context that XBox360 supports 4 controllers, and each controller determines it's position, and this is usually reflected in the location of the LED. (Top left, top right, bottom left, bottom right denoting controller 1-4).

Anyway, I really don't know enough about what I'm trying to accomplish, I'll have to keep reading and learning.

Code: Select all

$ jstest /dev/input/event6
Driver version is 0.8.0.
Joystick (Unknown) has 2 axes and 2 buttons.
Testing ... (interrupt to exit)

jstest: error reading: Invalid argument
Locked