From 3004fdf68da99b5ea75bbdd6a04a471c1a7232af Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Mon, 22 Feb 2021 11:02:57 -0600 Subject: [PATCH] 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 --- device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/device.c b/device.c index 78322d9..42115d8 100644 --- a/device.c +++ b/device.c @@ -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)