Move the common functions to a helper and use this from
assert_device_present.
Make assert_device_present accept a fourth parameter for a timeout,
which will cause the assert to wait for the given amount of time for the
device to appear.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>