mirror of https://github.com/jetkvm/kvm.git
[WIP] Updates: reduce PR complexity
This commit is contained in:
parent
6ccd9fdf19
commit
4c12783107
|
@ -42,4 +42,3 @@ formatters:
|
|||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
|
||||
|
|
|
@ -3,6 +3,5 @@
|
|||
"cva",
|
||||
"cx"
|
||||
],
|
||||
"git.ignoreLimitWarning": true,
|
||||
"cmake.ignoreCMakeListsMissing": true
|
||||
"git.ignoreLimitWarning": true
|
||||
}
|
10
display.go
10
display.go
|
@ -326,9 +326,12 @@ func startBacklightTickers() {
|
|||
dimTicker = time.NewTicker(time.Duration(config.DisplayDimAfterSec) * time.Second)
|
||||
|
||||
go func() {
|
||||
for range dimTicker.C {
|
||||
for { //nolint:staticcheck
|
||||
select {
|
||||
case <-dimTicker.C:
|
||||
tick_displayDim()
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
|
@ -337,9 +340,12 @@ func startBacklightTickers() {
|
|||
offTicker = time.NewTicker(time.Duration(config.DisplayOffAfterSec) * time.Second)
|
||||
|
||||
go func() {
|
||||
for range offTicker.C {
|
||||
for { //nolint:staticcheck
|
||||
select {
|
||||
case <-offTicker.C:
|
||||
tick_displayOff()
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -321,7 +321,8 @@ func (u *UsbGadget) keyboardWriteHidFile(modifier byte, keys []byte) error {
|
|||
_, err := u.writeWithTimeout(u.keyboardHidFile, append([]byte{modifier, 0x00}, keys[:hidKeyBufferSize]...))
|
||||
if err != nil {
|
||||
u.logWithSuppression("keyboardWriteHidFile", 100, u.log, err, "failed to write to hidg0")
|
||||
// Keep file open on write errors to reduce I/O overhead
|
||||
u.keyboardHidFile.Close()
|
||||
u.keyboardHidFile = nil
|
||||
return err
|
||||
}
|
||||
u.resetLogSuppressionCounter("keyboardWriteHidFile")
|
||||
|
|
|
@ -77,7 +77,8 @@ func (u *UsbGadget) absMouseWriteHidFile(data []byte) error {
|
|||
_, err := u.writeWithTimeout(u.absMouseHidFile, data)
|
||||
if err != nil {
|
||||
u.logWithSuppression("absMouseWriteHidFile", 100, u.log, err, "failed to write to hidg1")
|
||||
// Keep file open on write errors to reduce I/O overhead
|
||||
u.absMouseHidFile.Close()
|
||||
u.absMouseHidFile = nil
|
||||
return err
|
||||
}
|
||||
u.resetLogSuppressionCounter("absMouseWriteHidFile")
|
||||
|
|
|
@ -60,14 +60,15 @@ func (u *UsbGadget) relMouseWriteHidFile(data []byte) error {
|
|||
var err error
|
||||
u.relMouseHidFile, err = os.OpenFile("/dev/hidg2", os.O_RDWR, 0666)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open hidg2: %w", err)
|
||||
return fmt.Errorf("failed to open hidg1: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
_, err := u.writeWithTimeout(u.relMouseHidFile, data)
|
||||
if err != nil {
|
||||
u.logWithSuppression("relMouseWriteHidFile", 100, u.log, err, "failed to write to hidg2")
|
||||
// Keep file open on write errors to reduce I/O overhead
|
||||
u.relMouseHidFile.Close()
|
||||
u.relMouseHidFile = nil
|
||||
return err
|
||||
}
|
||||
u.resetLogSuppressionCounter("relMouseWriteHidFile")
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
|
||||
"github.com/creack/pty"
|
||||
"github.com/pion/webrtc/v4"
|
||||
|
@ -34,10 +33,6 @@ func handleTerminalChannel(d *webrtc.DataChannel) {
|
|||
}
|
||||
|
||||
go func() {
|
||||
// Lock to OS thread to isolate PTY I/O
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
||||
buf := make([]byte, 1024)
|
||||
for {
|
||||
n, err := ptmx.Read(buf)
|
||||
|
|
Loading…
Reference in New Issue