I haven't done a full review yet, but here are some first comments. On 01.03.2017 17:16, Aric Stewart wrote:
+ subsystem = udev_device_get_subsystem(dev); usbdev = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_device"); if (usbdev) { + #ifdef HAS_PROPER_INPUT_HEADER + const platform_vtbl *other_vtbl = NULL; + DEVICE_OBJECT *dup = NULL; + if (strcmp(subsystem, "hidraw") == 0) + other_vtbl = &lnxev_vtbl; + else if (strcmp(subsystem, "input") == 0) + other_vtbl = &hidraw_vtbl; + + if (other_vtbl) + dup = bus_enumerate_hid_devices(other_vtbl, check_same_device, dev);
Shouldn't we have some preference of either hidraw or linux event devices? Otherwise this could lead to different results in each run.
}
+DEVICE_OBJECT* bus_enumerate_hid_devices(const platform_vtbl *vtbl, enum_func function, void* context) +{ + struct pnp_device *dev; + DEVICE_OBJECT *ret = NULL; + + TRACE("(%p)\n", vtbl); + + EnterCriticalSection(&device_list_cs); + LIST_FOR_EACH_ENTRY(dev, &pnp_devset, struct pnp_device, entry) + { + struct device_extension *ext = (struct device_extension *)dev->device->DeviceExtension; + if (ext->vtbl != vtbl) continue; + if (function(dev->device, context) == 0) + ret = dev->device; + break;
This is wrong and will always abort after the first function call.
+ } + LeaveCriticalSection(&device_list_cs); + return ret; +} +