Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi Joystick - USB device name issue with Unity Engine #258

Open
Velenon opened this issue Dec 5, 2022 · 3 comments
Open

Multi Joystick - USB device name issue with Unity Engine #258

Velenon opened this issue Dec 5, 2022 · 3 comments

Comments

@Velenon
Copy link

Velenon commented Dec 5, 2022

Description of Issue

The Unity engine for Kerbal Space Program experiences a limitation whereby it identifies input devices by their reported name rather than a unique hardwareID therefore when trying to use 2No input devices with the same name the game will not recognise any inputs from one of the devices.

Current project

My current project is to build a Multi Joystick control box for Kerbal Space Program(KSP), I could not get KSP to recognise all 6 axes required + the "throttle" axis as KSP would not recognise the libraries "Throttle" axis so I chose to create 2No Joystick devices using the example code given here and use the "Rz Axis" on the first joystick as the throttle axis.

This all works fine and Windows sees and reports these axes doing what I expected, however both devices have the same name of "Arduino Micro" and for that reason only one of the Joysticks inputs are recognised by the game engine and passed to KSP

This project is being run on windows 10 for reference.

Question

My question is this and please pardon my lack of knowledge when it comes to windows drivers and exactly what and how this library does what it does.

But when creating/enumerating the two joystick devices or passing their information on as I assume this library does when connected, is it possible for two joystick names or numbers to be passed along to windows so that they can be indentified separately instead of having the same Adruino Micro name, or is the name shown in the windows USB game controller screen controlled entirely by the USB chip on the Arduino Micro?

Thank you for any help you can give.
@darkmos
Copy link

darkmos commented Dec 29, 2022

You need to modify the boards.txt file and change the line
micro.build.usb_product="Arduino Micro" to micro.build.usb_product="Arduino Micro Joystick 01" for example. After you're done uploading the sketch to the first board modify again the line to micro.build.usb_product="Arduino Micro Joystick 02" and upload the sketch to second board.
Note there is a cleaner way to edit the boards.txt to add sub-menus variants to a particular board if you're often tinkering with your devices, there are some examples quickly found on Goggle.

This file is located in following path on my computer: C:\Users\DarkMoS\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6

@Velenon
Copy link
Author

Velenon commented Jan 9, 2023

Thanks Darkmos, this is indeed how I ended up doing this, though I had to use 2 separate arduino boards to be able to do it, I was hoping there was a way to achieve it when running the multiple joysticks instances from the single arduino board but it seems not.

@marcelkraus
Copy link

I am sorry to chime in after two months, but does one have an idea how to find this file on a Mac? I would be very happy to modify the device name for my button box… ;) Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants