Fix more linter issues.

Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
SuperQ 2025-03-11 18:28:32 +01:00
parent 75296b4b7e
commit 97ce785056
No known key found for this signature in database
GPG Key ID: C646B23C9E3245F1
7 changed files with 9 additions and 20 deletions

View File

@ -3,9 +3,10 @@ package kvm
import (
"encoding/json"
"fmt"
"kvm/internal/usbgadget"
"os"
"sync"
"github.com/jetkvm/kvm/internal/usbgadget"
)
type WakeOnLanDevice struct {

View File

@ -6,10 +6,6 @@ import (
var lastUserInput = time.Now()
func resetUserInputTime() {
lastUserInput = time.Now()
}
var jigglerEnabled = false
func rpcSetJigglerState(enabled bool) {

View File

@ -5,7 +5,6 @@ import (
"encoding/json"
"errors"
"fmt"
"kvm/internal/usbgadget"
"os"
"os/exec"
"path/filepath"
@ -15,6 +14,8 @@ import (
"github.com/pion/webrtc/v4"
"go.bug.st/serial"
"github.com/jetkvm/kvm/internal/usbgadget"
)
type JSONRPCRequest struct {

1
log.go
View File

@ -5,5 +5,4 @@ import "github.com/pion/logging"
// we use logging framework from pion
// ref: https://github.com/pion/webrtc/wiki/Debugging-WebRTC
var logger = logging.NewDefaultLoggerFactory().NewLogger("jetkvm")
var usbLogger = logging.NewDefaultLoggerFactory().NewLogger("usb")
var cloudLogger = logging.NewDefaultLoggerFactory().NewLogger("cloud")

View File

@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"kvm/resource"
"net"
"os"
"os/exec"

6
usb.go
View File

@ -1,7 +1,7 @@
package kvm
import (
"kvm/internal/usbgadget"
"github.com/jetkvm/kvm/internal/usbgadget"
"time"
)
@ -37,10 +37,6 @@ func rpcWheelReport(wheelY int8) error {
return gadget.AbsMouseWheelReport(wheelY)
}
func rpcRelMouseReport(mx, my int8, buttons uint8) error {
return gadget.RelMouseReport(mx, my, buttons)
}
var usbState = "unknown"
func rpcGetUSBState() (state string) {

View File

@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"kvm/resource"
"net/http"
"os"
"path"
@ -16,14 +15,12 @@ import (
"time"
"github.com/gin-gonic/gin"
"github.com/psanford/httpreadat"
"github.com/google/uuid"
"github.com/pion/webrtc/v4"
)
const massStorageName = "mass_storage.usb0"
"github.com/jetkvm/kvm/resource"
)
func writeFile(path string, data string) error {
return os.WriteFile(path, []byte(data), 0644)
@ -65,11 +62,11 @@ func onDiskMessage(msg webrtc.DataChannelMessage) {
func mountImage(imagePath string) error {
err := setMassStorageImage("")
if err != nil {
return fmt.Errorf("Remove Mass Storage Image Error", err)
return fmt.Errorf("Remove Mass Storage Image Error: %w", err)
}
err = setMassStorageImage(imagePath)
if err != nil {
return fmt.Errorf("Set Mass Storage Image Error", err)
return fmt.Errorf("Set Mass Storage Image Error: %w", err)
}
return nil
}