mirror of https://github.com/jetkvm/kvm.git
renamed usb name to usb product to match convention
added usb config defaults
This commit is contained in:
parent
ac1403defc
commit
21b458b59a
|
@ -15,8 +15,8 @@ type UsbConfig struct {
|
|||
UsbVendorId string `json:"usb_vendor_id"`
|
||||
UsbProductId string `json:"usb_product_id"`
|
||||
UsbSerialNumber string `json:"usb_serial_number"`
|
||||
UsbName string `json:"usb_name"`
|
||||
UsbManufacturer string `json:"usb_manufacturer"`
|
||||
UsbProduct string `json:"usb_product"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
|
@ -38,6 +38,13 @@ const configPath = "/userdata/kvm_config.json"
|
|||
var defaultConfig = &Config{
|
||||
CloudURL: "https://api.jetkvm.com",
|
||||
AutoUpdateEnabled: true, // Set a default value
|
||||
UsbConfig: UsbConfig{
|
||||
UsbVendorId: "0x1d6b",
|
||||
UsbProductId: "0104",
|
||||
UsbSerialNumber: "",
|
||||
UsbManufacturer: "JetKVM",
|
||||
UsbProduct: "JetKVM USB Emulation Device",
|
||||
},
|
||||
}
|
||||
|
||||
var config *Config
|
||||
|
|
|
@ -75,7 +75,7 @@ function UpdateUsbConfigModal({
|
|||
usb_product_id: '',
|
||||
usb_serial_number: '',
|
||||
usb_manufacturer: '',
|
||||
usb_name: '',
|
||||
usb_product: '',
|
||||
})
|
||||
const handleUsbVendorIdChange = (vendorId: string) => {
|
||||
setUsbConfig({... usbConfig, usb_vendor_id: vendorId})
|
||||
|
@ -93,8 +93,8 @@ function UpdateUsbConfigModal({
|
|||
setUsbConfig({... usbConfig, usb_manufacturer: manufacturer})
|
||||
};
|
||||
|
||||
const handleUsbName = (name: string) => {
|
||||
setUsbConfig({... usbConfig, usb_name: name})
|
||||
const handleUsbProduct = (name: string) => {
|
||||
setUsbConfig({... usbConfig, usb_product: name})
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -141,10 +141,10 @@ function UpdateUsbConfigModal({
|
|||
/>
|
||||
<InputFieldWithLabel
|
||||
required
|
||||
label="Name"
|
||||
placeholder="Enter Name"
|
||||
value={usbConfig.usb_name || ""}
|
||||
onChange={e => handleUsbName(e.target.value)}
|
||||
label="Product Name"
|
||||
placeholder="Enter Product Name"
|
||||
value={usbConfig.usb_product || ""}
|
||||
onChange={e => handleUsbProduct(e.target.value)}
|
||||
/>
|
||||
<div className="flex gap-x-2">
|
||||
<Button
|
||||
|
|
2
usb.go
2
usb.go
|
@ -74,7 +74,7 @@ func UpdateGadgetConfig() error {
|
|||
strAttrs := [][]string{
|
||||
{"serialnumber", config.UsbConfig.UsbSerialNumber},
|
||||
{"manufacturer", config.UsbConfig.UsbManufacturer},
|
||||
{"product", config.UsbConfig.UsbName},
|
||||
{"product", config.UsbConfig.UsbProduct},
|
||||
}
|
||||
gadgetStringsPath := filepath.Join(kvmGadgetPath, "strings", "0x409")
|
||||
err = os.MkdirAll(gadgetStringsPath, 0755)
|
||||
|
|
Loading…
Reference in New Issue