Why the button numbers of jstest are different from the RGUI ones?

I have some bluetooth controllers (8bitdo Zero and an ípega). I’m used to configure the buttons getting the button numbers from the jstest utility and configure the retroarch.cfg properly. But when I start RetroArch the buttons don’t work (only the d-pad).

Then I went to Settings -> Input -> Input User 1 Binds -> User 1 Bind All, and configure it (yeah, the buttons are working!). After this I went to “Save New Config” to save a new retroarch.cfg file. Checking this file, I realized that the buttons numbers are different from those obtained from jstest.

Everything is running fine, I solved my problem. But I would like to know why these numbers are different for bluetooth controllers.

Perhaps RetroArch is using a different joypad driver than jstest is using? I know the RetroArch button codes change from udev to linuxraw to sdl2, so you could check to see if one of those matches your jstest results.

Well… I think the default jstest uses linuxraw (source code). I used sdl2-jstest (source code), which use sdl2, gives me the same button numbers.

I saw in RetroArch wiki that the default driver is udev, but I don’t know a jstest-like tool that uses udev… googling