From 558dd43a9378d9c0e61eaec246eced307c63dbf9 Mon Sep 17 00:00:00 2001 From: john-- Date: Wed, 14 May 2025 13:29:11 -0400 Subject: [PATCH] Rebind Experiment --- internal/usbgadget/config.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/usbgadget/config.go b/internal/usbgadget/config.go index 5c287da..04e84f8 100644 --- a/internal/usbgadget/config.go +++ b/internal/usbgadget/config.go @@ -200,6 +200,14 @@ func (u *UsbGadget) Init() error { u.log.Error().Err(err).Msg("failed to mount configfs, usb stack might not function properly") } + if _, err := os.Stat(u.configC1Path); err == nil { + u.log.Error().Str("configC1Path", u.configC1Path).Msg("removing existing config path") + err := os.RemoveAll(u.configC1Path); + if err != nil { + u.log.Error().Err(err).Msg("failed to remove existing config path") + } + } + if err := os.MkdirAll(u.configC1Path, 0755); err != nil { u.log.Error().Err(err).Msg("failed to create config path") }