On Tue Mar 19 15:55:41 2024 +0000, Rémi Bernon wrote:
why parsing must be on the PE side
This is coming from the faily recent PE/unix separation introduction, which enforces the boundaries between the PE and unix world in Wine. It was previously much less strictly enforced and code could be shared more freely as there was no clear boundaries. Now the HID parser is implemented as the Windows hidparse.sys static library, and uses Windows APIs internally, which means that using it from the unix side it would fail to link many of its symbols. It could perhaps be made more portable, and the static library used from the unix side, but that would require more change and didn't seem necessary so far.
we couldn't just call `winebus_call(device_remove, ¶ms);` when
hidraw device is not preferred and rely on the device subsystem hierarchy? I'm not sure what you mean by that. It wasn't done when devices were ignored, but that was an oversight and I added a call now so that we also stop listening on ignored device events. If you mean, delay the moment we discard one of the devices up to the point where we have their report descriptors parsed already, and remove one of the duplicated devices, then it could perhaps have been done like that too, I only preferred to avoid having the devices exposed even briefly.
The question was badly formed, mostly because of my still quite fuzzy/unclear picture of architecture and all components, but let me try rephrase it:
Because in the context of UDEV bus, when a device is created, the report descriptor is **already** parsed by hid subsystem, which in turn has created necessary devices, so why do we need to parse report descriptors and read the usage pages when we could just rely on hid subsystem's capability on doing so? If the HID device is an input device, hid asks input subsystem to a create an event device for it. If it's not, then an event device is not created.
And now that I asked that, is the reason for not relying on host's hid subsystem in this regard, that we want to be in charge how usage pages are interpreted?