REVIEWED: Mouse device support on PLATFORM_DRM #2381

This commit is contained in:
Ray 2022-06-05 11:34:23 +02:00
parent cda89ebb58
commit 865a44adda

View file

@ -6058,12 +6058,13 @@ static void ConfigureEvdevDevice(char *device)
fd = open(device, O_RDONLY | O_NONBLOCK); fd = open(device, O_RDONLY | O_NONBLOCK);
if (fd < 0) if (fd < 0)
{ {
TRACELOG(LOG_WARNING, "RPI: Failed to open input device %s", device); TRACELOG(LOG_WARNING, "RPI: Failed to open input device: %s", device);
return; return;
} }
worker->fd = fd; worker->fd = fd;
// Grab number on the end of the devices name "event<N>" // Grab number on the end of the devices name "event<N>"
// TODO: Grab number on the end of the device name "mouse<N>"
int devNum = 0; int devNum = 0;
char *ptrDevName = strrchr(device, 't'); char *ptrDevName = strrchr(device, 't');
worker->eventNum = -1; worker->eventNum = -1;
@ -6072,6 +6073,7 @@ static void ConfigureEvdevDevice(char *device)
{ {
if (sscanf(ptrDevName, "t%d", &devNum) == 1) worker->eventNum = devNum; if (sscanf(ptrDevName, "t%d", &devNum) == 1) worker->eventNum = devNum;
} }
else worker->eventNum = 0; // HACK for mouse0 device!
// At this point we have a connection to the device, but we don't yet know what the device is. // At this point we have a connection to the device, but we don't yet know what the device is.
// It could be many things, even as simple as a power button... // It could be many things, even as simple as a power button...