Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,12 @@ var (
Timezone: "UTC",
}
defaultUsbConfig = usbgadget.Config{
VendorId: "0x1d6b", //The Linux Foundation
ProductId: "0x0104", //Multifunction Composite Gadget
SerialNumber: "",
Manufacturer: "JetKVM",
Product: "USB Emulation Device",
VendorId: "0x1d6b", //The Linux Foundation
ProductId: "0x0104", //Multifunction Composite Gadget
SerialNumber: "",
Manufacturer: "JetKVM",
Product: "USB Emulation Device",
Configuration: "Config 1: HID",
}
defaultUsbDevices = usbgadget.Devices{
AbsoluteMouse: true,
Expand Down
1 change: 1 addition & 0 deletions internal/usbgadget/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func (u *UsbGadget) loadGadgetConfig() {
u.configMap["base_info"].attrs["serialnumber"] = u.customConfig.SerialNumber
u.configMap["base_info"].attrs["manufacturer"] = u.customConfig.Manufacturer
u.configMap["base_info"].attrs["product"] = u.customConfig.Product
u.configMap["base_info"].configAttrs["configuration"] = u.customConfig.Configuration
}

func (u *UsbGadget) SetGadgetConfig(config *Config) {
Expand Down
11 changes: 6 additions & 5 deletions internal/usbgadget/usbgadget.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ type Devices struct {
// Config is a struct that represents the customizations for a USB gadget.
// TODO: rename to something else that won't confuse with the USB gadget configuration
type Config struct {
VendorId string `json:"vendor_id"`
ProductId string `json:"product_id"`
SerialNumber string `json:"serial_number"`
Manufacturer string `json:"manufacturer"`
Product string `json:"product"`
VendorId string `json:"vendor_id"`
ProductId string `json:"product_id"`
SerialNumber string `json:"serial_number"`
Manufacturer string `json:"manufacturer"`
Product string `json:"product"`
Configuration string `json:"configuration"`

strictMode bool // when it's enabled, all warnings will be converted to errors
isEmpty bool
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,8 @@
"usb_config_update_identifiers": "Diweddaru Dynodwyr USB",
"usb_config_vendor_id_label": "ID Gwerthwr",
"usb_config_vendor_id_placeholder": "Rhowch ID Gwerthwr",
"usb_config_configuration_label": "Ffurfweddiad",
"usb_config_configuration_placeholder": "Rhowch ffurfweddiad",
"usb_device_classes_description": "Dosbarthiadau dyfais USB yn y ddyfais gyfansawdd",
"usb_device_classes_title": "Dosbarthiadau",
"usb_device_custom": "Personol",
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"usb_config_update_identifiers": "Opdater USB-identifikatorer",
"usb_config_vendor_id_label": "Leverandør-ID",
"usb_config_vendor_id_placeholder": "Indtast leverandør-ID",
"usb_config_configuration_label": "Konfiguration",
"usb_config_configuration_placeholder": "Indtast konfiguration",
"usb_device_classes_description": "USB-enhedsklasser i den sammensatte enhed",
"usb_device_classes_title": "Klasser",
"usb_device_custom": "Tilpasset",
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"usb_config_update_identifiers": "USB-Kennungen aktualisieren",
"usb_config_vendor_id_label": "Lieferanten-ID",
"usb_config_vendor_id_placeholder": "Geben Sie die Lieferanten-ID ein",
"usb_config_configuration_label": "Konfiguration",
"usb_config_configuration_placeholder": "Konfiguration eingeben",
"usb_device_classes_description": "USB-Geräteklassen im Verbundgerät",
"usb_device_classes_title": "Klassen",
"usb_device_custom": "Benutzerdefiniert",
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"usb_config_update_identifiers": "Update USB Identifiers",
"usb_config_vendor_id_label": "Vendor ID",
"usb_config_vendor_id_placeholder": "Enter Vendor ID",
"usb_config_configuration_label": "Configuration",
"usb_config_configuration_placeholder": "Enter Configuration",
"usb_device_classes_description": "USB device classes in the composite device",
"usb_device_classes_title": "Classes",
"usb_device_custom": "Custom",
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"usb_config_update_identifiers": "Actualizar identificadores USB",
"usb_config_vendor_id_label": "Identificación del proveedor",
"usb_config_vendor_id_placeholder": "Ingrese el ID del proveedor",
"usb_config_configuration_label": "Configuración",
"usb_config_configuration_placeholder": "Introducir configuración",
"usb_device_classes_description": "Clases de dispositivos USB en el dispositivo compuesto",
"usb_device_classes_title": "Clases",
"usb_device_custom": "Costumbre",
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"usb_config_update_identifiers": "Mettre à jour les identifiants USB",
"usb_config_vendor_id_label": "ID du fournisseur",
"usb_config_vendor_id_placeholder": "Entrez l'ID du fournisseur",
"usb_config_configuration_label": "Configuration",
"usb_config_configuration_placeholder": "Saisir la configuration",
"usb_device_classes_description": "Classes de périphériques USB dans le périphérique composite",
"usb_device_classes_title": "Classes",
"usb_device_custom": "Personnalisé",
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"usb_config_update_identifiers": "Aggiorna identificatori USB",
"usb_config_vendor_id_label": "ID fornitore",
"usb_config_vendor_id_placeholder": "Inserisci l'ID del fornitore",
"usb_config_configuration_label": "Configurazione",
"usb_config_configuration_placeholder": "Inserisci configurazione",
"usb_device_classes_description": "Classi di dispositivi USB nel dispositivo composito",
"usb_device_classes_title": "Classi",
"usb_device_custom": "Personalizzato",
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"usb_config_update_identifiers": "USB識別子を更新",
"usb_config_vendor_id_label": "ベンダーID",
"usb_config_vendor_id_placeholder": "ベンダーIDを入力",
"usb_config_configuration_label": "構成",
"usb_config_configuration_placeholder": "構成を入力",
"usb_device_classes_description": "複合デバイス内のUSBデバイスクラス",
"usb_device_classes_title": "クラス",
"usb_device_custom": "カスタム",
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"usb_config_update_identifiers": "Oppdater USB-identifikatorer",
"usb_config_vendor_id_label": "Leverandør-ID",
"usb_config_vendor_id_placeholder": "Skriv inn leverandør-ID",
"usb_config_configuration_label": "Konfigurasjon",
"usb_config_configuration_placeholder": "Angi konfigurasjon",
"usb_device_classes_description": "USB-enhetsklasser i den sammensatte enheten",
"usb_device_classes_title": "Klasser",
"usb_device_custom": "Tilpasset",
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"usb_config_update_identifiers": "Atualizar Identificadores USB",
"usb_config_vendor_id_label": "ID do Fornecedor",
"usb_config_vendor_id_placeholder": "Digite o ID do Fornecedor",
"usb_config_configuration_label": "Configuração",
"usb_config_configuration_placeholder": "Introduzir configuração",
"usb_device_classes_description": "Classes de dispositivo USB no dispositivo composto",
"usb_device_classes_title": "Classes",
"usb_device_custom": "Personalizado",
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"usb_config_update_identifiers": "Обновить идентификаторы USB",
"usb_config_vendor_id_label": "ID поставщика",
"usb_config_vendor_id_placeholder": "Введите ID поставщика",
"usb_config_configuration_label": "Конфигурация",
"usb_config_configuration_placeholder": "Введите конфигурацию",
"usb_device_classes_description": "Классы USB-устройств в составном устройстве",
"usb_device_classes_title": "Классы",
"usb_device_custom": "Пользовательский",
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"usb_config_update_identifiers": "Uppdatera USB-identifierare",
"usb_config_vendor_id_label": "Leverantörs-ID",
"usb_config_vendor_id_placeholder": "Ange leverantörs-ID",
"usb_config_configuration_label": "Konfiguration",
"usb_config_configuration_placeholder": "Ange konfiguration",
"usb_device_classes_description": "USB-enhetsklasser i den sammansatta enheten",
"usb_device_classes_title": "Klasser",
"usb_device_custom": "Anpassad",
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"usb_config_update_identifiers": "更新 USB 識別碼",
"usb_config_vendor_id_label": "供應商 ID",
"usb_config_vendor_id_placeholder": "輸入供應商 ID",
"usb_config_configuration_label": "設定",
"usb_config_configuration_placeholder": "輸入設定",
"usb_device_classes_description": "複合裝置中的 USB 裝置類別",
"usb_device_classes_title": "類別",
"usb_device_custom": "自訂",
Expand Down
2 changes: 2 additions & 0 deletions ui/localization/messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"usb_config_update_identifiers": "更新 USB 标识符",
"usb_config_vendor_id_label": "供应商ID",
"usb_config_vendor_id_placeholder": "输入供应商ID",
"usb_config_configuration_label": "配置",
"usb_config_configuration_placeholder": "输入配置",
"usb_device_classes_description": "复合设备中包含的 USB 设备类。",
"usb_device_classes_title": "设备类",
"usb_device_custom": "自定义",
Expand Down
17 changes: 17 additions & 0 deletions ui/src/components/UsbInfoSetting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface USBConfig {
serial_number: string;
manufacturer: string;
product: string;
configuration: string;
}

const usbConfigs = [
Expand Down Expand Up @@ -66,27 +67,31 @@ export function UsbInfoSetting() {
serial_number: deviceId,
manufacturer: "JetKVM",
product: "USB Emulation Device",
configuration: "Config 1: HID",
},
"Logitech USB Input Device": {
vendor_id: "0x046d",
product_id: "0xc52b",
serial_number: generatedSerialNumber,
manufacturer: "Logitech (x64)",
product: "Logitech USB Input Device",
configuration: "RQR24.11_B0036",
},
"Wireless MultiMedia Keyboard": {
vendor_id: "0x045e",
product_id: "0x005f",
serial_number: generatedSerialNumber,
manufacturer: "Microsoft",
product: "Wireless MultiMedia Keyboard",
configuration: "Config 1: HID",
},
"Multimedia Pro Keyboard": {
vendor_id: "0x413c",
product_id: "0x2011",
serial_number: generatedSerialNumber,
manufacturer: "Dell Inc.",
product: "Multimedia Pro Keyboard",
configuration: "Config 1: HID",
},
}),
[deviceId],
Expand Down Expand Up @@ -203,6 +208,7 @@ function USBConfigDialog({
serial_number: "",
manufacturer: "",
product: "",
configuration: "",
});

const { send } = useJsonRpc();
Expand Down Expand Up @@ -242,6 +248,10 @@ function USBConfigDialog({
setUsbConfigState({ ...usbConfigState, product: value });
};

const handleUsbConfiguration = (value: string) => {
setUsbConfigState({ ...usbConfigState, configuration: value });
};

return (
<div className="">
<div className="grid grid-cols-2 gap-4">
Expand Down Expand Up @@ -282,6 +292,13 @@ function USBConfigDialog({
defaultValue={usbConfigState?.product}
onChange={e => handleUsbProduct(e.target.value)}
/>
<InputFieldWithLabel
required
label={m.usb_config_configuration_label()}
placeholder={m.usb_config_configuration_placeholder()}
defaultValue={usbConfigState?.configuration}
onChange={e => handleUsbConfiguration(e.target.value)}
/>
</div>
<div className="mt-6 flex gap-x-2">
<Button
Expand Down
1 change: 1 addition & 0 deletions ui/src/hooks/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ export interface UsbConfigState {
serial_number: string;
manufacturer: string;
product: string;
configuration: string;
}

export const useUsbConfigModalStore = create<UsbConfigModalState>(set => ({
Expand Down
Loading