Sort input devices on Linux (#1926)

* Remove unused function

* Sort input devices on Linux

The readdir() function doesn't guarantee any specific ordering, so the
numbers of joysticks might change when restarting StepMania.
(Empirically this usually only happens after a reboot.)

Let's sort the input devices alphabetically before opening them to have
more consistent numbering and avoid annoying remapping of controllers.
This commit is contained in:
Martin Natano
2019-10-29 16:05:29 +01:00
committed by Colby Klein
parent b0765e9c56
commit 7dae1384e6
2 changed files with 9 additions and 13 deletions
@@ -69,19 +69,6 @@ struct EventDevice
static vector<EventDevice *> g_apEventDevices;
/* Return true if the numbered event device exists. sysfs may not always be
* there; return false if we don't know. */
static bool EventDeviceExists( int iNum )
{
RString sDir = ssprintf( "/sys/class" );
struct stat st;
if( stat(sDir, &st) == -1 )
return true;
RString sFile = ssprintf( "/sys/class/input/event%i", iNum );
return stat(sFile, &st) == 0;
}
static bool BitIsSet( const uint8_t *pArray, uint32_t iBit )
{
return !!(pArray[iBit/8] & (1<<(iBit%8)));