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