diff --git a/examples/all-clusters-app/nrfconnect/main/main.cpp b/examples/all-clusters-app/nrfconnect/main/main.cpp index 400f9b30e0dd01..77d7bd785f91e0 100644 --- a/examples/all-clusters-app/nrfconnect/main/main.cpp +++ b/examples/all-clusters-app/nrfconnect/main/main.cpp @@ -33,9 +33,9 @@ static int InitUSB() { int err = usb_enable(nullptr); - if (err) + if ((err != 0) && (err != -EALREADY)) { - LOG_ERR("Failed to initialize USB device"); + LOG_ERR("Failed to initialize USB device %d", err); return err; } diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp b/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp index 400f9b30e0dd01..77d7bd785f91e0 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp +++ b/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp @@ -33,9 +33,9 @@ static int InitUSB() { int err = usb_enable(nullptr); - if (err) + if ((err != 0) && (err != -EALREADY)) { - LOG_ERR("Failed to initialize USB device"); + LOG_ERR("Failed to initialize USB device %d", err); return err; } diff --git a/examples/lighting-app/nrfconnect/main/main.cpp b/examples/lighting-app/nrfconnect/main/main.cpp index 69e83a6935d05a..2fa41047be0f82 100644 --- a/examples/lighting-app/nrfconnect/main/main.cpp +++ b/examples/lighting-app/nrfconnect/main/main.cpp @@ -40,9 +40,9 @@ static int InitUSB() { int err = usb_enable(nullptr); - if (err) + if ((err != 0) && (err != -EALREADY)) { - LOG_ERR("Failed to initialize USB device"); + LOG_ERR("Failed to initialize USB device %d", err); return err; } diff --git a/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc b/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc index 5f9705a37ea763..b4b59de774c04e 100644 --- a/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc +++ b/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc @@ -32,7 +32,7 @@ extern "C" void pw_sys_io_Init() #ifdef CONFIG_USB err = usb_enable(nullptr); - assert(err == 0); + assert(err == 0 || err == (-EALREADY)); #endif err = console_init();