|
162 | 162 | <TransitionGroup name="devices" tag="x-box" class="flex-col gap-2 mt-4"> |
163 | 163 | <x-card |
164 | 164 | class="flex justify-between items-center px-2 py-0 m-0 bg-white/5" |
165 | | - v-for="device, k of usbManager.ptDevices.value" |
| 165 | + v-for="device of usbManager.ptDevices.value" |
166 | 166 | :key="`${device.vendorId}-${device.productId}`" |
167 | 167 | :class="{ 'bg-white/[calc(0.05*0.75)] [&_*:not(div):not(span)]:opacity-75': !usbManager.isPTDeviceConnected(device) }" |
168 | 168 | > |
|
200 | 200 | </TransitionGroup> |
201 | 201 | <x-button |
202 | 202 | v-if="availableDevices.length > 0" |
203 | | - class="mt-4 !bg-gradient-to-tl from-blue-400/20 shadow-md shadow-blue-950/20 to-transparent hover:from-blue-400/30 transition" |
| 203 | + class="!bg-gradient-to-tl from-blue-400/20 shadow-md shadow-blue-950/20 to-transparent hover:from-blue-400/30 transition" |
| 204 | + :class="{ 'mt-4': usbManager.ptDevices.value.length }" |
204 | 205 | @click="refreshAvailableDevices()" |
205 | 206 | > |
206 | 207 | <x-icon href="#add"></x-icon> |
|
355 | 356 | </template> |
356 | 357 |
|
357 | 358 | <script setup lang="ts"> |
358 | | -import { computed, getCurrentInstance, nextTick, onMounted, ref, watch } from 'vue'; |
359 | | -import { Winboat } from '../lib/winboat'; |
360 | | -import type { ComposeConfig, USBDevice } from '../../types'; |
| 359 | +import { computed, onMounted, ref } from 'vue'; |
| 360 | +import { ContainerStatus, Winboat } from '../lib/winboat'; |
| 361 | +import type { ComposeConfig } from '../../types'; |
361 | 362 | import { getSpecs } from '../lib/specs'; |
362 | 363 | import { Icon } from '@iconify/vue'; |
363 | 364 | import { WinboatConfig } from '../lib/config'; |
364 | 365 | import { USBManager, type PTSerializableDeviceInfo } from '../lib/usbmanager'; |
365 | | -import { type Device, type Interface } from "usb"; |
| 366 | +import { type Device } from "usb"; |
366 | 367 | import { |
367 | 368 | RDP_PORT, |
368 | 369 | PORT_MAX, |
369 | | - USB_CLASS_IMAGING, |
370 | | - USB_INTERFACE_MTP, |
371 | 370 | USB_VID_BLACKLIST |
372 | 371 | } from '../lib/constants'; |
373 | 372 | const { app }: typeof import('@electron/remote') = require('@electron/remote'); |
@@ -605,9 +604,18 @@ async function toggleExperimentalFeatures() { |
605 | 604 | rerenderExperimental.value++; |
606 | 605 | $emit("rerender"); |
607 | 606 |
|
608 | | - // Remove all passthrough USB devices since USB is still experimental |
609 | | - if (wbConfig.config.experimentalFeatures) { |
| 607 | + // Remove all passthrough USB devices if we're disabling experimental features |
| 608 | + // since USB passthrough is an experimental feature |
| 609 | + if (!wbConfig.config.experimentalFeatures) { |
610 | 610 | await usbManager.removeAllPassthroughDevicesAndConfig(); |
| 611 | + // Create the QMP interval if experimental features are enabled |
| 612 | + // This would get created by default since we're changing the compose and re-deploying, |
| 613 | + // but a scenario could also occur where the user is re-enabling experimental features |
| 614 | + // after the compose changes, which then would cause a bug |
| 615 | + // TODO: Remove after USB passthrough is no longer experimental |
| 616 | + } else if (winboat.containerStatus.value == ContainerStatus.Running && !winboat.hasQMPInterval) { |
| 617 | + console.log("Creating QMP interval because experimental features were turned on"); |
| 618 | + winboat.createQMPInterval(); |
611 | 619 | } |
612 | 620 | } |
613 | 621 |
|
|
0 commit comments