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.85k stars 112 forks source link

Possible issue with more than 2 HDMI ports on monitor #35

Closed sharma closed 3 years ago

sharma commented 3 years ago

I've got 2 monitors, and my secondary monitor is successfully switching back and forth on USB switch presses. However, my primary monitor won't switch between computers regardless of whichever Hdmi[1/2] or DisplayPort [1/2] settings I enable in the config.

My completely uneducated guess is that my issue is because my monitor has 3 HDMI ports and 1 DisplayPort and I'm forced to use the HDMI 3 port on the monitor because it's the only port that supports HDMI 2.0 and allows me to use my 1440p monitor at 144Hz. The DisplayPort is connected to the other computer.

Here's my config:

usb_device = "1A40:0101"

[monitor1]
monitor_id = "1"
on_usb_connect = "Hdmi1"
on_usb_disconnect = "DisplayPort1"

[monitor2]
monitor_id = "2"
on_usb_connect = "DisplayPort1"
on_usb_disconnect = "Hdmi1"

And the log that is generated:

14:47:49 [INFO] Configuration loaded ("C:\\Users\\ankit\\AppData\\Roaming\\display-switch\\display-switch.ini"): Configuration { usb_device: "1a40:0101", input_sources: InputSources { on_usb_connect: None, on_usb_disconnect: None }, monitor1: Some(PerMonitorConfiguration { monitor_id: "1", input_sources: InputSources { on_usb_connect: Some(Hdmi1(0x11)), on_usb_disconnect: Some(DisplayPort1(0xf)) } }), monitor2: Some(PerMonitorConfiguration { monitor_id: "2", input_sources: InputSources { on_usb_connect: Some(DisplayPort1(0xf)), on_usb_disconnect: Some(Hdmi1(0x11)) } }), monitor3: None, monitor4: None, monitor5: None, monitor6: None }
14:47:49 [INFO] Display 'Generic PnP Monitor' is currently set to Hdmi1(0x11)
14:47:50 [INFO] Display 'Generic PnP Monitor' is currently set to DisplayPort1(0xf)
14:47:50 [ERROR] Failed to get current input for display 'GP104-A/2147881090:SVideo': Ddc(InvalidChecksum)
14:47:50 [INFO] Display 'GP104-A/2147881089:Lvds' is currently set to DisplayPort1(0xf)
14:47:54 [DEBUG] (1) display_switch::app: Detected device change. Removed device: "05e3:0610"
14:47:54 [DEBUG] (1) display_switch::app: Detected device change. Removed device: "04d9:a293"
14:47:54 [DEBUG] (1) display_switch::app: Detected device change. Removed device: "046d:c53f"
14:47:54 [DEBUG] (1) display_switch::app: Detected device change. Removed device: "0d8c:0014"
14:47:54 [DEBUG] (1) display_switch::app: Detected device change. Removed device: "1a40:0101"
14:47:54 [INFO] Monitored device is ("1a40:0101") is disconnected
14:47:54 [INFO] Display 'Generic PnP Monitor' is not configured to switch on USB disconnect
14:47:54 [INFO] Display 'Generic PnP Monitor' is not configured to switch on USB disconnect
14:47:54 [DEBUG] (1) display_switch::display_control: Setting display 'GP104-A/2147881090:SVideo' to DisplayPort1(0xf)
14:47:54 [INFO] Display 'GP104-A/2147881090:SVideo' set to DisplayPort1(0xf)
14:47:54 [DEBUG] (1) display_switch::display_control: Setting display 'GP104-A/2147881089:Lvds' to DisplayPort1(0xf)
14:47:54 [INFO] Display 'GP104-A/2147881089:Lvds' set to DisplayPort1(0xf)
14:48:04 [DEBUG] (1) display_switch::app: Detected device change. Added device: "1a40:0101"
14:48:04 [INFO] Monitored device ("1a40:0101") is connected
14:48:04 [INFO] Display 'Generic PnP Monitor' is not configured to switch on USB connect
14:48:04 [INFO] Display 'Generic PnP Monitor' is not configured to switch on USB connect
14:48:04 [DEBUG] (1) display_switch::display_control: Setting display 'GP104-A/2147881090:SVideo' to Hdmi1(0x11)
14:48:04 [INFO] Display 'GP104-A/2147881090:SVideo' set to Hdmi1(0x11)
14:48:04 [DEBUG] (1) display_switch::display_control: Setting display 'GP104-A/2147881089:Lvds' to Hdmi1(0x11)
14:48:04 [INFO] Display 'GP104-A/2147881089:Lvds' set to Hdmi1(0x11)
14:48:07 [DEBUG] (1) display_switch::app: Detected device change. Added device: "0000:0000"
14:48:07 [DEBUG] (1) display_switch::app: Detected device change. Added device: "05e3:0610"
14:48:08 [DEBUG] (1) display_switch::app: Detected device change. Added device: "046d:c53f"
14:48:08 [DEBUG] (1) display_switch::app: Detected device change. Added device: "0d8c:0014"

I'm not sure why I'm getting the 14:47:50 [ERROR] Failed to get current input for display 'GP104-A/2147881090:SVideo': Ddc(InvalidChecksum) error either but my second uneducated guess is that it's the reason display-switch can't switch monitor state correctly on the primary monitor.

Any help would be greatly appreciated, I'd love to make display-switch my daily driver!

haimgel commented 3 years ago

Hello, The two issues are not really related: inability to get current status and not switching according to your config. There was a bug that made the app do not consider the two "generic pnp monitors" that you have to be unique, and that is the reason for not switching correctly. Please update from the latest master and try again...

Also, it's pretty weird, but the app detects 3 monitors, not two:

Your config matches the first one as monitor number #1 (because monitor_id is equal to "1" and there is "1" in "GP104"). The app should have detected it as (because of the name duplication):

I suggest you update the app, run it, see how it detects the monitors and then adjust the monitor_id fields to match whatever it needs to be. You might want to change it to #1, #2, #3 and not just numbers, to have a more explicit match.