mirror of https://github.com/jetkvm/kvm.git
Fix USB HID errors during browser refresh
When browser refreshes (Shift+R), USB state changes from "configured" to "default" temporarily. Previously, HID files remained open with stale file handles, causing "transport endpoint shutdown" errors. Now proactively close HID files when USB transitions away from "configured" state, preventing writes to invalid endpoints. Fixes USB HID transport endpoint shutdown errors during browser refresh.
This commit is contained in:
parent
b15cbc5890
commit
12d7ac69b9
5
usb.go
5
usb.go
|
|
@ -113,6 +113,11 @@ func checkUSBState() {
|
|||
usbState = newState
|
||||
usbLogger.Info().Str("from", oldState).Str("to", newState).Msg("USB state changed")
|
||||
|
||||
if oldState == "configured" && newState != "configured" {
|
||||
usbLogger.Info().Msg("USB deconfigured, closing HID files")
|
||||
gadget.CloseHidFiles()
|
||||
}
|
||||
|
||||
if newState == "configured" && oldState != "configured" {
|
||||
usbLogger.Info().Msg("USB configured, reopening HID files")
|
||||
gadget.CloseHidFiles()
|
||||
|
|
|
|||
Loading…
Reference in New Issue