@@ -3,6 +3,7 @@ package kvm
3
3
import (
4
4
"encoding/json"
5
5
"fmt"
6
+ "kvm/internal/usbgadget"
6
7
"os"
7
8
"sync"
8
9
)
@@ -12,40 +13,26 @@ type WakeOnLanDevice struct {
12
13
MacAddress string `json:"macAddress"`
13
14
}
14
15
15
- type UsbConfig struct {
16
- VendorId string `json:"vendor_id"`
17
- ProductId string `json:"product_id"`
18
- SerialNumber string `json:"serial_number"`
19
- Manufacturer string `json:"manufacturer"`
20
- Product string `json:"product"`
21
- }
22
-
23
- type UsbDevicesConfig struct {
24
- AbsoluteMouse bool `json:"absolute_mouse"`
25
- RelativeMouse bool `json:"relative_mouse"`
26
- Keyboard bool `json:"keyboard"`
27
- MassStorage bool `json:"mass_storage"`
28
- }
29
-
30
16
type Config struct {
31
- CloudURL string `json:"cloud_url"`
32
- CloudAppURL string `json:"cloud_app_url"`
33
- CloudToken string `json:"cloud_token"`
34
- GoogleIdentity string `json:"google_identity"`
35
- JigglerEnabled bool `json:"jiggler_enabled"`
36
- AutoUpdateEnabled bool `json:"auto_update_enabled"`
37
- IncludePreRelease bool `json:"include_pre_release"`
38
- HashedPassword string `json:"hashed_password"`
39
- LocalAuthToken string `json:"local_auth_token"`
40
- LocalAuthMode string `json:"localAuthMode"` //TODO: fix it with migration
41
- WakeOnLanDevices []WakeOnLanDevice `json:"wake_on_lan_devices"`
42
- EdidString string `json:"hdmi_edid_string"`
43
- ActiveExtension string `json:"active_extension"`
44
- DisplayMaxBrightness int `json:"display_max_brightness"`
45
- DisplayDimAfterSec int `json:"display_dim_after_sec"`
46
- DisplayOffAfterSec int `json:"display_off_after_sec"`
47
- UsbConfig * UsbConfig `json:"usb_config"`
48
- UsbDevices * UsbDevicesConfig `json:"usb_devices"`
17
+ CloudURL string `json:"cloud_url"`
18
+ CloudAppURL string `json:"cloud_app_url"`
19
+ CloudToken string `json:"cloud_token"`
20
+ GoogleIdentity string `json:"google_identity"`
21
+ JigglerEnabled bool `json:"jiggler_enabled"`
22
+ AutoUpdateEnabled bool `json:"auto_update_enabled"`
23
+ IncludePreRelease bool `json:"include_pre_release"`
24
+ HashedPassword string `json:"hashed_password"`
25
+ LocalAuthToken string `json:"local_auth_token"`
26
+ LocalAuthMode string `json:"localAuthMode"` //TODO: fix it with migration
27
+ WakeOnLanDevices []WakeOnLanDevice `json:"wake_on_lan_devices"`
28
+ EdidString string `json:"hdmi_edid_string"`
29
+ ActiveExtension string `json:"active_extension"`
30
+ DisplayMaxBrightness int `json:"display_max_brightness"`
31
+ DisplayDimAfterSec int `json:"display_dim_after_sec"`
32
+ DisplayOffAfterSec int `json:"display_off_after_sec"`
33
+ TLSMode string `json:"tls_mode"`
34
+ UsbConfig * usbgadget.Config `json:"usb_config"`
35
+ UsbDevices * usbgadget.Devices `json:"usb_devices"`
49
36
}
50
37
51
38
const configPath = "/userdata/kvm_config.json"
@@ -58,14 +45,15 @@ var defaultConfig = &Config{
58
45
DisplayMaxBrightness : 64 ,
59
46
DisplayDimAfterSec : 120 , // 2 minutes
60
47
DisplayOffAfterSec : 1800 , // 30 minutes
61
- UsbConfig : & UsbConfig {
48
+ TLSMode : "" ,
49
+ UsbConfig : & usbgadget.Config {
62
50
VendorId : "0x1d6b" , //The Linux Foundation
63
51
ProductId : "0x0104" , //Multifunction Composite Gadget
64
52
SerialNumber : "" ,
65
53
Manufacturer : "JetKVM" ,
66
54
Product : "USB Emulation Device" ,
67
55
},
68
- UsbDevices : & UsbDevicesConfig {
56
+ UsbDevices : & usbgadget. Devices {
69
57
AbsoluteMouse : true ,
70
58
RelativeMouse : true ,
71
59
Keyboard : true ,
0 commit comments