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

Application crashes on switch button press #9

Closed mmarb closed 3 years ago

mmarb commented 4 years ago

The application crashes when pressing the button on my usb switch Is there any way to run in foreground, to maybe get a reason for the crash? Windows eventlog is not very helpful.

haimgel commented 4 years ago

Could you please check the logs, just in case there's anything useful there: the app should log into C:\Users\YOUR-USERNAME\AppData\Local\display-switch\display-switch.log

mmarb commented 4 years ago

I did, there is nothing unusual in there, the process just seems to die without logging a reason:

07:31:54 [INFO] Configuration loaded ("***\display-switch.ini"): Configuration { usb_device: "05e3:0610", monitor_input: DisplayPort1 } 07:31:54 [INFO] Monitor 'Monitor { handle: 0x0, description: "AOC Q32G1WG4" }' is currently set to 0xf 07:31:54 [INFO] Monitor 'Monitor { handle: 0x1, description: "HP Pavilion 32 Display" }' is currently set to 0xf 07:31:54 [INFO] Monitor 'Monitor { handle: 0x2, description: "SyncMaster 2494HM/2494HS/2494HSI(Digital)" }' is currently set to 0x3

haimgel commented 4 years ago

This is unfortunate. I'll need to add some kind of "debug mode" so it can be run in a console and we'll be able to see the Rust stack trace when it crashes.

trissylegs commented 3 years ago

Had an issue with segfaults recent. (well two first one I fixed in nvapi-rs) that didn't log anything either. (I think maybe there was a issue with SetWindowLongPtr, it hasn't happened again though). Running it with cargo run should give you the exit description with a nicer error eg:

error: process didn't exit successfully: `target\debug\display_switch.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)
mmarb commented 3 years ago

Fixed in recent build