Force power should be switched of with a delay
Currently when boltd
starts and does not find any thunderbolt domains, it will force-power the thunderbolt controller. After this it waits until a domain appears and then enumerate the devices and after enumeration force-power will be switched off again and control will be passed back to the mainloop which in turn will process the uevents; most likely we will get a some add
uevents followed by some remove
events. If the uevent handlers we access properties of the thunderbolt controller they might not be available anymore because the controller is powering down. For a similar in fwupd problem see kernel bug #199631. The solution could be similar as what was pointed out in ibid. comment 41: we don't immediately switch the force_power off when we are done enumerating, but delay it by a fixed amount of time (20sec). To be totally on the safe side, we could reset that timer on subsequent activities (uevents
) so we make sure will process all of them properly before powering the controller down again.
Another solution (more fragile), that could additionally be done is to ignore add
events for devices we already know (which are most likely the corresponding uevents of devices that were already enumerated after the force-power.