Two Joystick HIDs at the Same Time (Teensy ++ 2.0)

Zer0

New member
Hello everyone!

I originally posted this in the project guidance section, but I think this question might be better suited here.

For the past couple of days I have been trying to write code to allow me to display two Joystick HID interfaces at once. (Having two separate HIDs in device manager and game controllers)

My objective is to connect two retro controllers to the Teensy and have them appear as their own gamepad interface in windows/mac/linux. I have found this repository that has managed to do what I intend https://github.com/jjstreet/teensyarcade but it uses the old version of Teensyduino, because of that, i'm limited to 8 buttons and 2 axis, and most of the new Joystick commands from version 1.45 are unavailable. I would like to ultimately make N64 and Gamecube controllers work as well, so I'd need 4 axis and 10 buttons + 4 for DPad.

I approached this problem in two ways: First I tried adding buttons and axis to the code I provided in the above link, but after hours of trying, even if I did manage to modify the USB.C file and other core files, I couldn't get the controller to work correctly or at all.

My second approach was to take the code as an inspiration and try to implement dual Joystick HIDs using the new version of Teensyduino and Arduino IDE, which supports 32 buttons 6 axis and one multi directional HAT switch. I managed to fix some of the compiler errors on my attempt to try and replicate the multiple HID joystick code on the newest version of the Teensy IDE. The Joysticks still don't appear in the device manager, it may be that I have the wrong usb hid device descriptors, or that my USB_API.cpp is wrong.

Here's the code if anyone would like to take a look.

Do you guys have any suggestions? or know of any other project that has done this same thing? I'm willing to start from scratch.

Thanks in advance!
 
Hi,

did you have any success regarding this topic meanwhile?

I am also urgently looking for a solution to drive two HID joystick with Teensy 2.0 ++ :-/

Thank you,

Fifsy
 
Hi,

did you have any success regarding this topic meanwhile?

I am also urgently looking for a solution to drive two HID joystick with Teensy 2.0 ++ :-/

Thank you,

Fifsy

I am in the same boat here. I have my own (what someone else called) frankenstein controller which registers itself as keyboard and mouse and two analog sticks, and I want to multiplex the inputs into two custom gamepads.
My idea for the time being, as this issue seems to be unresolved and that I am totally new to all this is, especially micro programmer electronics, so I am trying to gather all needed pieces and might be wrong here.

a) use a raspberry frontend as usb host to pick up the signals via evdev and then use uart to push the data to teensy where it then is sent as appropriate commands.

Now my idea is probably to use additional ftdi usb breakouts to open additional serial lines and to use two teensies to achieve that. Both basically run the same code with different conversion tables. But using two teensies seems hackish to me, if there was another way I would prefer it.
Anyway I am a newby here, and if my idea on this is not correct, feel free to correct me, I would be happy.
 
I guess this is a problem which needs to be solved at the Teensy side.
There are some libraries on the Arduino side, with MT32 controllers which can pull the trick off but of course they do not work with teensy, neither do many standard arduino libraries in this area. From an API standpoint I was able to see that with some extensions it could work, but thing is, it is not supported yet, maybe sometime in the future it will be.
For my problem I worked around that with 2 Teensies which is hardware overkill given that i just want to simulate 4 usb devices, one being j1+mouse+keyboard and the other one j2.
But I probably will move my code over to a single board solution in the long run (maybe an MT32 based one)
The issue seems to crawl up every bunch of years and a solution would be heavens sent for people who build their own arcade controller sets!
So maybe someone with the knowledge of pulling this off can spend some time on it.
 
Hypothetically... if I were to add this for Teensy LC - 4.1, which PC-side software should I use for testing?

A big question I have, which can probably only be answered by experimenting, is whether the PC software can recognize a single HID report as multiple joysticks. If a separate endpoint is needed, we may only be able to support this on Teensy LC to 3.6.

Also, is there a need for more than 2 joysticks? If this is going to be done, would be best to do it only once with enough to accommodate the largest application.
 
Well there are two ways for testing it on the pc side. Windows has a joystick/gampad tool which shows you the joysticks it can detect and then you you can test for the sticks buttons etc...

On the linux side every controller is mapped into the /dev/input<xxx> and you can use jstest for instance or a graphical tool.
The problem is does it have to be a single hid? The idea is more that it provides two hids, like it can do for keyboard, mouse, joystick within the same board. The problem then is more on the api side, the high level api atm does not allow to deal with a XInput(0) and XInput(1) for instance
 
Hypothetically... if I were to add this for Teensy LC - 4.1, which PC-side software should I use for testing?

A big question I have, which can probably only be answered by experimenting, is whether the PC software can recognize a single HID report as multiple joysticks. If a separate endpoint is needed, we may only be able to support this on Teensy LC to 3.6.

Also, is there a need for more than 2 joysticks? If this is going to be done, would be best to do it only once with enough to accommodate the largest application.

Most of the cases are retro gaming needs. Usually arcade cabinets.
Raspberry Pi Zero W 2 has only one USB port and is a very capable retro game platform.
Retro platforms easily manage USB Joysticks, so it will be great to plug just one USB and have 5 joysticks. (4 players and extra buttons)
These involve about 8 digital pins per virtual joystick .... so I guess that more than 2 is the way to go
For example, I do input analysis and translation before sending signals to the retro game to have a better experience.
To disable the mouse and keyboard function is a must, as you don't want your retro game to automatically recognize anything else.

I don´t care which Teensy I need to buy if I get this functionality.


Just my 2 cents !!
Thanks
 
Back
Top