mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-09-12 10:34:24 +08:00
fix(hid): share macOS drag compatibility across OTG and CH9329
This commit is contained in:
@@ -818,8 +818,9 @@ export default {
|
||||
ch9329OptionsDesc: 'Configure runtime compatibility for the CH9329 serial HID chip',
|
||||
ch9329HybridMouse: 'Linux Absolute Mouse Compatibility',
|
||||
ch9329HybridMouseDesc: 'Keep absolute movement on absolute packets, but send buttons and wheel through relative packets',
|
||||
ch9329MacosDrag: 'macOS Drag Compatibility',
|
||||
ch9329MacosDragDesc: 'Use absolute packets for button edges and relative packets for movement while a button is held',
|
||||
mouseMacosDrag: 'macOS Drag Compatibility',
|
||||
mouseMacosDragRequiresBoth: 'Enable both relative and absolute mouse interfaces before saving.',
|
||||
mouseMacosDragDesc: 'Experimental workaround for interrupted drags in absolute mouse mode (OTG / CH9329). OTG requires both mouse interfaces. Tracking speed and drop position may vary with macOS settings; this version has not been tested on a Mac.',
|
||||
ch9329Descriptor: 'CH9329 USB Device Descriptor',
|
||||
ch9329DescriptorDesc: 'Read USB identification fields from the CH9329 chip before editing',
|
||||
ch9329DescriptorLoading: 'Reading CH9329 descriptor...',
|
||||
|
||||
@@ -817,8 +817,9 @@ export default {
|
||||
ch9329OptionsDesc: '配置 CH9329 串口 HID 芯片的运行兼容性',
|
||||
ch9329HybridMouse: 'Linux 绝对鼠标兼容模式',
|
||||
ch9329HybridMouseDesc: '绝对移动仍使用绝对鼠标包,点击和滚轮改用相对鼠标包发送',
|
||||
ch9329MacosDrag: 'macOS 拖拽兼容模式',
|
||||
ch9329MacosDragDesc: '按钮按下与释放使用绝对鼠标包,按住期间改用相对鼠标包移动',
|
||||
mouseMacosDrag: 'macOS 拖拽兼容模式',
|
||||
mouseMacosDragRequiresBoth: '请同时启用相对鼠标和绝对鼠标接口后保存。',
|
||||
mouseMacosDragDesc: '实验性缓解绝对鼠标模式下的拖拽中断,适用于 OTG / CH9329。OTG 需同时启用两种鼠标接口。移动速度和落点可能受 macOS 设置影响;本版本尚未进行 Mac 实机验证。',
|
||||
ch9329Descriptor: 'CH9329 USB 设备描述符',
|
||||
ch9329DescriptorDesc: '先从 CH9329 芯片读取 USB 标识信息,读取成功后再修改',
|
||||
ch9329DescriptorLoading: '正在读取 CH9329 描述符...',
|
||||
|
||||
@@ -71,7 +71,7 @@ export interface HidConfig {
|
||||
ch9329_port: string;
|
||||
ch9329_baudrate: number;
|
||||
ch9329_hybrid_mouse?: boolean;
|
||||
ch9329_macos_drag?: boolean;
|
||||
mouse_macos_drag?: boolean;
|
||||
ch9329_descriptor?: Ch9329DescriptorConfig;
|
||||
mouse_absolute: boolean;
|
||||
}
|
||||
@@ -571,7 +571,7 @@ export interface HidConfigUpdate {
|
||||
ch9329_port?: string;
|
||||
ch9329_baudrate?: number;
|
||||
ch9329_hybrid_mouse?: boolean;
|
||||
ch9329_macos_drag?: boolean;
|
||||
mouse_macos_drag?: boolean;
|
||||
ch9329_descriptor?: Ch9329DescriptorConfigUpdate;
|
||||
otg_udc?: string;
|
||||
otg_descriptor?: OtgDescriptorConfigUpdate;
|
||||
|
||||
@@ -692,7 +692,7 @@ const config = ref({
|
||||
} as OtgHidFunctions,
|
||||
hid_otg_keyboard_leds: false,
|
||||
hid_ch9329_hybrid_mouse: false,
|
||||
hid_ch9329_macos_drag: false,
|
||||
hid_mouse_macos_drag: false,
|
||||
msd_enabled: false,
|
||||
msd_dir: '',
|
||||
msd_flash_inquiry_string: 'One-KVM Virtual Flash',
|
||||
@@ -1177,6 +1177,8 @@ const isCh9329DescriptorDirty = computed(() => {
|
||||
|
||||
const isHidSettingsValid = computed(() =>
|
||||
isHidFunctionSelectionValid.value
|
||||
&& !(config.value.hid_backend === 'otg' && config.value.hid_mouse_macos_drag
|
||||
&& (!effectiveOtgFunctions.value.mouse_relative || !effectiveOtgFunctions.value.mouse_absolute))
|
||||
&& isCh9329DescriptorValid.value
|
||||
&& areMsdInquiryStringsValid.value
|
||||
)
|
||||
@@ -1457,8 +1459,10 @@ async function saveConfig() {
|
||||
const hidUpdate: HidConfigUpdate = configStore.hid?.backend === 'ch9329'
|
||||
? {
|
||||
ch9329_hybrid_mouse: config.value.hid_ch9329_hybrid_mouse,
|
||||
ch9329_macos_drag: config.value.hid_ch9329_macos_drag,
|
||||
} : {}
|
||||
if (['otg', 'ch9329'].includes(config.value.hid_backend)) {
|
||||
hidUpdate.mouse_macos_drag = config.value.hid_mouse_macos_drag
|
||||
}
|
||||
if (config.value.hid_backend === 'ch9329' && isCh9329DescriptorDirty.value) {
|
||||
hidUpdate.ch9329_descriptor = {
|
||||
vendor_id: parseInt(ch9329VendorIdHex.value, 16) || 0x1a86,
|
||||
@@ -1528,7 +1532,7 @@ async function saveConfig() {
|
||||
const hidFeatureBaseline = ref('')
|
||||
function hidFeatureSnapshot() {
|
||||
return JSON.stringify({
|
||||
fields: Object.fromEntries(Object.entries(config.value).filter(([key]) => key.startsWith('msd_') || key.startsWith('otg_network_') || key.startsWith('uac_') || ['hid_otg_functions', 'hid_otg_keyboard_leds', 'hid_ch9329_hybrid_mouse', 'hid_ch9329_macos_drag'].includes(key))),
|
||||
fields: Object.fromEntries(Object.entries(config.value).filter(([key]) => key.startsWith('msd_') || key.startsWith('otg_network_') || key.startsWith('uac_') || ['hid_otg_functions', 'hid_otg_keyboard_leds', 'hid_ch9329_hybrid_mouse', 'hid_mouse_macos_drag'].includes(key))),
|
||||
descriptor: [otgVendorIdHex.value, otgProductIdHex.value, otgManufacturer.value, otgProduct.value, otgSerialNumber.value],
|
||||
})
|
||||
}
|
||||
@@ -1570,7 +1574,7 @@ async function loadConfig() {
|
||||
} as OtgHidFunctions,
|
||||
hid_otg_keyboard_leds: hid.otg_keyboard_leds ?? false,
|
||||
hid_ch9329_hybrid_mouse: hid.ch9329_hybrid_mouse ?? false,
|
||||
hid_ch9329_macos_drag: hid.ch9329_macos_drag ?? false,
|
||||
hid_mouse_macos_drag: hid.mouse_macos_drag ?? false,
|
||||
msd_enabled: msd.enabled || false,
|
||||
msd_dir: msd.msd_dir || '',
|
||||
msd_flash_inquiry_string: msd.flash_inquiry_string || 'One-KVM Virtual Flash',
|
||||
@@ -3225,18 +3229,19 @@ watch(isWindows, () => {
|
||||
</div>
|
||||
<Switch v-model="config.hid_ch9329_hybrid_mouse" />
|
||||
</div>
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div>
|
||||
<Label>{{ t('settings.ch9329MacosDrag') }}</Label>
|
||||
<p class="text-xs text-muted-foreground">{{ t('settings.ch9329MacosDragDesc') }}</p>
|
||||
</div>
|
||||
<Switch v-model="config.hid_ch9329_macos_drag" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- OTG Descriptor Settings -->
|
||||
<div v-if="['otg', 'ch9329'].includes(config.hid_backend)" class="flex items-center justify-between gap-4 rounded-md border border-border/60 p-3">
|
||||
<div>
|
||||
<Label>{{ t('settings.mouseMacosDrag') }}</Label>
|
||||
<p class="text-xs text-muted-foreground">{{ t('settings.mouseMacosDragDesc') }}</p>
|
||||
<p v-if="config.hid_backend === 'otg' && config.hid_mouse_macos_drag && (!effectiveOtgFunctions.mouse_relative || !effectiveOtgFunctions.mouse_absolute)" class="text-xs text-warning">{{ t('settings.mouseMacosDragRequiresBoth') }}</p>
|
||||
</div>
|
||||
<Switch v-model="config.hid_mouse_macos_drag" />
|
||||
</div>
|
||||
<template v-if="config.hid_backend === 'otg'">
|
||||
<Separator class="my-4" />
|
||||
<div class="space-y-4">
|
||||
|
||||
Reference in New Issue
Block a user