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.83k stars 110 forks source link

Log file created, but is empty. #67

Closed ChinmayTyagi closed 1 year ago

ChinmayTyagi commented 2 years ago

Hello, This looks like a great tool to switch between my work computer and PC, while saving some money. However, I'm having some trouble with setup.

I am on windows on both systems, with 2 monitors and a USB switch as my "USB device". Given a 2-monitor setup and USB hub as my device, I have created the following config file (all the way at bottom). When I run the display_switch.ex (copied to AppData/roaming), a log file is created. However, this file is empty. Since I have no feedback, it's hard to know exactly where I am messing up.

Any advice? Thanks so much!

display-switch.ini:

usb_device = "1A40:0101"

[monitor1] monitor_id = "GSM7706" on_usb_connect = "Hdmi1"

[monitor2] monitor_id = "LEN61E6" on_usb_connect = "DisplayPort1"

youngmit commented 2 years ago

I am in nearly the exact situation. Two monitors, Windows. When running the exe, it quits immediately, no standard out, no contents in the log file.

zeezez commented 2 years ago

Hi, I am encountering the same issues as you both (two screens, windows).

I had thought I didn't build the executable properly -- but after reinstalling Rust and rebuilding from source several times I'm not sure what's going on.

Running the exe does indeed create the display-switch directory and display-watch.log in %APPDATA% but as noted it is empty. Nothing comes up otherwise.

I was really looking forward to using this utility so I wonder if someone could help us resolve this. Thanks!

haimgel commented 2 years ago

When you run the app from the command line, does it print anything prior to terminating? I suspect it's crashing on startup, and it should print the stack trace when it does that. Please share whatever it says...

haimgel commented 2 years ago

Actually, on Windows the app wasn't printing anything on the console ever. This is being fixed in the upcoming release, so the suggestion above would be valid when 1.1 is released.

jordevorstenbosch commented 2 years ago

Actually, on Windows the app wasn't printing anything on the console ever. This is being fixed in the upcoming release, so the suggestion above would be valid when 1.1 is released.

It still doesn't put anything in the logfile on windows it seems.

Trough console I get the following though:

PS C:\Users\micro\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup> .\display_switch.exe
PS C:\Users\micro\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup> Error: failed to load configuration

Caused by:
    ParseIntError { kind: InvalidDigit }

My ini file in %appdata%/display-switch/display-switch.ini:

usb_device = "A8F8:1830"

[monitor1]
monitor_id = "LG"
on_usb_connect = "Hdmi"
on_usb_disconnect = "DisplayPort1"

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

It works fine when I correct the .ini file. The log is however empty.

Edit:

For clarification, it does output to the log file when it actually succeeds in running.

haimgel commented 2 years ago

I think the "invalid digit" message is misleading, but the root cause is that on_usb_connect = "Hdmi" line is invalid. It needs to be Hdmi1 or Hdmi2 etc. The first thing the app does is parsing the config file, if that failed, it does not go further, this is the reason the log file is empty IMO.