haimgel / display-switch

Turn a $30 USB switch into a full-featured multi-monitor KVM switch
https://haim.dev/posts/2020-07-28-dual-monitor-kvm/
MIT License
2.82k stars 110 forks source link

Build fails on System76 Pop!_OS 22.04 #102

Closed wmchristie closed 8 months ago

wmchristie commented 2 years ago

First, excellent program. Thank you! It works like a dream on my Windows 10 machine, which has allowed me to work around the issues.

I was able to complete the build by changing

pub trait UsbCallback {

to

pub trait UsbCallback: Send {

And by updating the rusb dependency to version ^0.9.1 from ^0.7.1.

The build failed with

error[E0277]: `(dyn UsbCallback + 'static)` cannot be sent between threads safely
  --> src/platform/pnp_detect_libusb.rs:16:21
   |
16 | impl<T: UsbContext> rusb::Hotplug<T> for PnPDetectLibusb {
   |                     ^^^^^^^^^^^^^^^^ `(dyn UsbCallback + 'static)` cannot be sent between threads safely
   | 
  ::: /home/UID/.local/.cargo/registry/src/github.com-1ecc6299db9ec823/rusb-0.9.1/src/hotplug.rs:28:35
   |
28 | pub trait Hotplug<T: UsbContext>: Send {
   |                                   ---- required by this bound in `Hotplug`
   |
   = help: the trait `Send` is not implemented for `(dyn UsbCallback + 'static)`
   = note: required because of the requirements on the impl of `Send` for `Unique<(dyn UsbCallback + 'static)>`
   = note: required because it appears within the type `Box<(dyn UsbCallback + 'static)>`
note: required because it appears within the type `PnPDetectLibusb`
  --> src/platform/pnp_detect_libusb.rs:12:12
   |
12 | pub struct PnPDetectLibusb {
   |            ^^^^