From 3e1e6029102a59a64d1f49897d01f3aa2cea198c Mon Sep 17 00:00:00 2001 From: Marvin Date: Mon, 16 Mar 2026 08:18:49 -0300 Subject: [PATCH] Add boot delay and handshake retry logic - Add 100ms delay before device initialization to allow USB power stabilization - Implement retry logic (3 attempts) for initial handshake with 50ms between retries - Warn on each failed handshake attempt This addresses enumeration failures during system boot where the US-200 needs additional time to become ready after USB bus power-up. --- us144mkii.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/us144mkii.c b/us144mkii.c index 44a658d..21c8c11 100644 --- a/us144mkii.c +++ b/us144mkii.c @@ -253,9 +253,18 @@ static int tascam_probe(struct usb_interface *intf, const struct usb_device_id * goto free_card; } - usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), VENDOR_REQ_MODE_CONTROL, + msleep(100); + + for (int retry = 0; retry < 3; retry++) { + int handshake_result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), VENDOR_REQ_MODE_CONTROL, RT_D2H_VENDOR_DEV, MODE_VAL_HANDSHAKE_READ, 0x0000, tascam->scratch_buf, 1, USB_CTRL_TIMEOUT_MS); + if (handshake_result >= 0) + break; + + dev_warn(&dev->dev, "Handshake failed (attempt %d/3), retrying...\n", retry + 1); + msleep(50); + } usb_set_interface(dev, 0, 1); usb_set_interface(dev, 1, 1);