Hi we wrote a complete guide on how to setup both a spinner and a trackball at the same time, so that the configurations are persistent and will apply to a whole game folder.
The idea is to set up a default retroarch config for mame/fbneo that will configure one of these devices as the default mouse (for example, the trackball), and create then just a file for rom folders that will be spinner specific.
For example, you have a roms/mame folder -> all games in there will work with the trackball by default, thanks to the global default config. Then you have roms/mame/spinner then for this folder, you will have to generate a retroarch "content configuration file" that will apply just for this folder, and set the mouse_index to the one of the spinner.
Trap: the retroarch menu will not let you save mouse_index configs, but will create the config files. You will have to add manually a line with player1_mouse_index = 2 for example...
We wrote a detailed guide (in french, use deepl.com to translate) with screenshots, etc. And we use it on several Retropie arcade cabinet that we built, that have both trackball and spinner in the control panel.
Trackball and Spinner persistent configuration guide HOWTO (Google Doc, french)alt text
alt text