device: don't wait for timeout if RemoveDevice is called
authorArchie Pusaka <apusaka@chromium.org>
Tue, 15 Sep 2020 03:04:19 +0000 (11:04 +0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:32 +0000 (19:08 +0530)
commit64aa55570523082fd88a9d170f082db6222a641b
treea7a0e10ac168fb0e28ba0f676a58e5a9f8c44c5b
parentd3dc7b116a0deb090b2f2c4d6ae303d5c3660db9
device: don't wait for timeout if RemoveDevice is called

RemoveDevice on adapter interface used to remove a device, even when
the device is connected. However, since the introduction of the new
30 seconds timeout when setting a device as temporary, RemoveDevice
doesn't immediately remove a connected device, but only disconnects
it and waits for the timer to expire before effectively removes it.

This patch removes the device as soon as it gets disconnected,
provided the disconnection is triggered by a call to RemoveDevice.
The regular timeout still applies for other cases.

Tested manually by calling RemoveDevice on a connected device,
and with ChromeOS autotest setup.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/adapter.c
src/adapter.h
src/device.c