gobot icon indicating copy to clipboard operation
gobot copied to clipboard

Joystick:does not run properly on windows

Open wushu037 opened this issue 2 years ago • 7 comments

Thanks a lot for providing the joystick library, it works fine on Mac, but there are exceptions on windows

environment

  • I used the sample code from joystick's readme to run
  • gobot v1.16.0
  • go1.18

compilation warning joystick relies on go-sdl2, and this warning occurs when it is compiled cross-platform from Mac to Windows and directly on Windows. image

For this warning. I raised an issue with go-sdl2, and later I replaced it with 0.4.25 as suggested, and the warning disappeared. So maybe joystick should update the version of go-sdl2

running exception I'm using Xbox Wireless Controller (xsx2020) and it only occasionally listens to the trigger button, but not to all other keys!

I also tried to run scanner.go, but it quits immediately image

wushu037 avatar Oct 18 '22 17:10 wushu037

maybe related to #860

gen2thomas avatar Oct 19 '22 11:10 gen2thomas

maybe related to #860

sorry, don't see the obvious correlation

wushu037 avatar Oct 19 '22 11:10 wushu037

Hi @wushu037, currently "github.com/veandco/go-sdl2 v0.3.3" is referenced by go.mod. Your suggestion was to use "0.4.25". Therefor I assumed this means the module version, but maybe I'm wrong.

gen2thomas avatar Oct 19 '22 15:10 gen2thomas

Hi @gen2thomas , i read the issue you linked to, maybe I didn't understand it and didn't see any connection to the go-sdl2 module version. but yes, go-sdl2 needs to be replaced with the latest version in order to compile properly on windows. Also, even if it runs successfully, there are issues to troubleshoot during runtime (see first comment)

wushu037 avatar Oct 20 '22 03:10 wushu037

Hi @wushu037 , I have now fixed the old modules on dev branch. I started "go run scanner.go" like you have done, but without any joystick attached and in a Linux box - it do not exit immediately, it waits. Unfortunately I have no windows system to test it.

What do you mean with "it works fine on Mac"? Do you have used the same example? I ask, because the example use a "dualshock3" type. Is this compatible with your "Xbox Wireless Controller (xsx2020)"?

gen2thomas avatar Oct 20 '22 06:10 gen2thomas

Hi, @gen2thomas , thank you for your investigation of the problem Here's the thing. I tested it on Mac and Windows, and it works fine on Mac, but there is an exception on Windows. I didn't test it on Linux

It is the example of the sample. to describe the problem briefly, I do not give my program.. Although the example uses "dualshock3", on Mac, my xsx2020 joystick still has multiple keys that can be listened to. But on Windows, only the trigger key is occasionally listened to

To better solve the problem, I give my program file. It implements a very simple function: mapping the joystick's share keys to the system's share keys. In this program, the configuration file is set up by me running scanner.go on my Mac, and also only the trigger key is responded to.

gamepad-keys-map.zip

If you don't have Windows, you can install a virtual machine and the effect should be the same. Either on a win virtual machine or a win physical machine, I tried

wushu037 avatar Oct 20 '22 10:10 wushu037

Hi @wushu037 , I need to stop my support here, because windows and no joystick available.

Please could you change the headline to which is more pointing to the remaining problem, e.g. this words/phrases should be included "windows, scanner.go, only one key". So someone can pick up the issue with existing hardware and deeper knowledge.

gen2thomas avatar Oct 20 '22 11:10 gen2thomas