device: Reintroduce the alpaca "keep-usb-on" feature

For some reason the SC8180x Primus often fails to detect the attached
USB stick if USB is toggled as part of a power cycle, so let's continue
to support the property of not toggling it.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Bjorn Andersson
2021-02-22 11:02:57 -06:00
parent 7c231568aa
commit 3004fdf68d

View File

@@ -105,6 +105,9 @@ found:
if (device->console_dev)
console_open(device);
if (device->usb_always_on)
device_usb(device, true);
device->fastboot = fastboot_open(device->serial, fastboot_ops, NULL);
return device;
@@ -309,7 +312,8 @@ void device_info(const void *data, size_t dlen)
void device_close(struct device *dev)
{
device_usb(dev, false);
if (!dev->usb_always_on)
device_usb(dev, false);
device_power(dev, false);
if (dev->close)