Bad design of device registration (API of evdi_add_device function)
Hello,
I've stumbled across this project, because I'm in search of Linux compatible USB 3.0 to digital video output adapter.
I've read the API specification, and the part of it seems to be not well designed:
evdi_device_status evdi_check_device(int device);
int evdi_add_device(); // returns 0 or 1 - indicates success
evdi_handle evdi_open(int device);
In short: I see at least two problems with it:
- the caller of
evdi_add_devicedoesn't know theIDof added device, which will cause troubles at simultaneous usage of thelibevdiby multiple additional display providers, - it seems to allow device stealing (might be a security issue).
Detailed: in order to register a new device, the user-space display provider has to:
- request a new device node using
evdi_add_devicefunction, - iterate over all possible values (
1toa possible large number), and find all EVDI devices byevdi_check_devicefunction, - iterate over all EVDI devices, and try to open it using
evdi_open.
This weird and complicated setup is caused, because evdi_add_device returns success indicator and no information about registered device ID. Instead of, the specification of return value should have been at least:
-
ID(where,ID > 0) - ID of the new, successfully added, device, -
-1- otherwise, ie. unsuccessful.
Kind regards, Miro K.
@kravemir a pull request would probably have helped fix this issue.
@MatthewBooth Currently, my free time is dedicated to another FOSS projects. And, I don't own any DisplayLink device to test functionality.