dix: Ensure enough memory for ClassesChangedEvent for a new device.
Before we enable the device through the driver, we size it up and make sure that the events in the event list contain enough bytes for a possible ClassesChangedEvent lateron.
This commit is contained in:
parent
74628d6397
commit
750d702676
|
@ -206,6 +206,10 @@ EnableDevice(DeviceIntPtr dev)
|
|||
DeviceIntRec dummyDev;
|
||||
DeviceIntPtr other;
|
||||
devicePresenceNotify ev;
|
||||
int namelen = 0; /* dummy */
|
||||
int evsize = sizeof(xEvent);
|
||||
int listlen;
|
||||
EventListPtr evlist;
|
||||
|
||||
for (prev = &inputInfo.off_devices;
|
||||
*prev && (*prev != dev);
|
||||
|
@ -238,6 +242,18 @@ EnableDevice(DeviceIntPtr dev)
|
|||
}
|
||||
}
|
||||
|
||||
/* Before actually enabling the device, we need to make sure the event
|
||||
* list's events have enough memory for a ClassesChangedEvent from the
|
||||
* device
|
||||
*/
|
||||
|
||||
SizeDeviceInfo(dev, &namelen, &evsize);
|
||||
|
||||
listlen = GetEventList(&evlist);
|
||||
OsBlockSignals();
|
||||
SetMinimumEventSize(evlist, listlen, evsize);
|
||||
OsReleaseSignals();
|
||||
|
||||
if ((*prev != dev) || !dev->inited ||
|
||||
((ret = (*dev->deviceProc)(dev, DEVICE_ON)) != Success)) {
|
||||
ErrorF("[dix] couldn't enable device %d\n", dev->id);
|
||||
|
|
Loading…
Reference in New Issue
Block a user