This is an automated email from Gerrit.

"Jia Han Liu <[email protected]>" just uploaded a new patch set to Gerrit, 
which you can find at https://review.openocd.org/c/openocd/+/9718

-- gerrit

commit 5985da2552426138041f2c4fb62ac34f7561b4bd
Author: Jonah Liu <[email protected]>
Date:   Thu May 14 06:12:50 2026 +0000

    drivers/ch347: add explicit set_configuration before claim_interface
    
    On some ARM64 platforms (e.g., NVIDIA Jetson with xhci_hcd), libusb
    returns LIBUSB_ERROR_NOT_FOUND when attempting to claim the JTAG
    interface immediately after libusb_open(). This happens because the
    device remains in the "Addressed" state and the host controller
    requires an explicit SET_CONFIGURATION before interface resources
    are allocated.
    
    The CH347F is a single-configuration composite device with
    bConfigurationValue == 1. Adding libusb_set_configuration(1) before
    the claim loop makes the driver behave consistently across x86_64
    and ARM64 without affecting existing functionality.
    
    Tested on:
    - x86_64 (Ubuntu 24.04.4, kernel 6.17.0-23-generic) - regression verified
    - aarch64 (Jetson, Ubuntu 22.04.4, kernel 5.15.136-tegra) - previously
      failed, now passes JTAG scan_chain successfully
    
    Change-Id: Ic98eaf7e1099ce4156cc8cabf0c26dcce392d605
    Signed-off-by: Jonah Liu <[email protected]>

diff --git a/src/jtag/drivers/ch347.c b/src/jtag/drivers/ch347.c
index 0a33dbdf06..8a7cd7d326 100644
--- a/src/jtag/drivers/ch347.c
+++ b/src/jtag/drivers/ch347.c
@@ -1453,6 +1453,12 @@ static int ch347_open_device(void)
                return retval;
        }
 
+       // Fix for CH347F on ARM64
+       // Force set configuration 1 (required on some ARM64 platforms)
+       retval = libusb_set_configuration(ch347_handle, 1);
+       if (retval != LIBUSB_SUCCESS && retval != LIBUSB_ERROR_BUSY)
+               LOG_WARNING("CH347 set_configuration failed: %s", 
libusb_error_name(retval));
+
        // CH347T / CH347F detection
        // if we can claim interface 4 we found a CH347F chip; if we can claim 
interface 2 we found CH347T chip
        retval = libusb_claim_interface(ch347_handle, CH347F_MPHSI_INTERFACE);

-- 

Reply via email to