Embed Notice
HTML Code
Corresponding Notice
- Embed this notice@alwayscurious @sima Then do that,the kernel provides you this information through sysfs, that is what it was explicitly designed for.
But yes, the race condition of "parse the topology, determine the device node, and go to open it" when the device is removed and a different one added right between those last two steps is real. Luckily in real-hardware situations, almost extremely rare if not physically impossible due to hardware debounce times, and one that we explicitly did not care about when we created sysfs and udev (i.e. physical access trumps anything).