-
-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SoundSwitch not refreshing devices on unplug replug #1323
Comments
Can you try with the nightly version of SoundSwitch ? (you'll have to stop SoundSwitch and replace all its files by the one of the zip then restart it). |
did not work, and now it happened on personal laptop. It looks like once it cannot find a device, it refuses to find it again. So the USB PnP is a small usb soundcard with Speakers and Mic. when I unplug and re-plug the usb, from the logs a refresh is happening, but only the speakers re-appears, the mic is not re-appearing unless I restart SoundSwitch and keeping it plugged.
|
I tried it again after restarting, and again the mic is not registering in the list. I think what is happening is that while it is refreshing because of device change, and since the sound card has 2 devices (speaker and mic), the second device change refresh is not triggering, and the mic goes unregistered. Does that make sense? EDIT: Confirmed my theory by forcing another refresh by disabling enabling any other audio device. Mic got picked up. So looks like a concurrent refresh issue. |
I've released a new nightly, can you try it and tell me if it's better this time ? And yes, I think the iteration of devices get locked out when the new device get connected, so I've implemeted a better way to interrupt old refresh and let the new refresh take over. |
Still not working:
Didn't you change the refresh logic in a previous commit and you're not relying on cancelling refresh anymore? In the code it is validating the "Refreshing" boolean and stopping the subsequent refresh. Thanks. |
I was relying on rescheduling the task to cancel the current one, not working as expected. So I've again rework the cancellation to be sure the old refresh get cancelled, and only the latest refresh can run. Can you test again with the newest nightly (just got pushed now) |
I think it worked, but throwing an exception. Should this be handled?
|
Also for some reason when I tried the same version on work laptop, it didn't throw an exception but the app crashed. Not sure why the difference between the 2 laptops. |
Shoot so the way to cancel the stuck job isn't working if the application crashed ... Can you also send the log of the laptop ? Also it's weird in the current log I don't see anything about actually finishing refreshing, just the previous refresh cancelled ... something is fishy. I have another nightly coming with better logs. https://github.com/Belphemur/SoundSwitch/actions/runs/7202375939 |
Unfortunately I cannot login to github on my work laptop. Basically the log stops at cancellation received then Refresh of device interrupted. after that nothing, just the app crashing giving the error on the screen. I removed the nightly now from work laptop. Trying to replicate a crash on personal laptop and I can't. It is the first time I use a nightly on work laptop so not sure if it is directly related to this or not. The only difference between both laptops is that I don't have admin access on the work laptop. ADDIT: forgot to mention that the exception on personal laptop is between cancelation received and Refresh interrupted as you see above. On work laptop, there is nothing between those lines. Probably the crash itself. |
New nightly is out: https://soundswitch.aaflalo.me/nightly This should give better logs and fix the possible crashes. |
ok so update on the situation. The personal laptop seems perfect:
however the work laptop is not reaching "Refreshed all devices" which is funny because now if i start the program with the USB connected, it never refreshes the list and the device stays there :) I took a pic of logs: Is it possible it is timing out silently? Maybe work laptop takes much more time to recognize USB? I don't know, I don't understand why it doesn't finish the refresh |
Yeah it keeps getting cancelled because it takes more than 3 seconds to enumerate the devices on the work laptop ... interesting. I've increased the timeout to 10 secs and added log for every device that is found (only as verbose, so only Nightly and Debug would log that). New nightly available: https://soundswitch.aaflalo.me/nightly |
Ok good news. It was successful. Since it is a controlled laptop probably that is why the numbers are all over the place. I am guessing OS scans any usb that gets plugged in etc... I did some testing to get some numbers. It is surprising that it is taking this amount of time with only 4 speakers and 4 mics. Company controlled laptops, what are you gonna do, right? Anyway, success!! Thank you very much Belphemur for an awesome software. And lol at the logs, so many now. ADDIT: Just saw on my personal laptop that the time it takes to refresh increased to 5-7 seconds. Does logging affect the refresh time? |
Yes logging is expected to increase the refresh time. Seeing your test I'll increase the ttl to 20secs then. |
just tried this morning, I missed the 10 seconds mark on multiple occasions on work laptop. 20 seconds might do the trick. I have no idea what the laptop is doing for so long ... Thanks. |
Can you share the logs you got ? I'm curious if it's a specific device or all of them take time, the latest nightly logs the time for each device to be processed. |
I took a log from startup which didn't have the USB switched in. took 12 seconds. Then another log when I switched in the USB, the weird thing about that, plantronics refreshed after cancelling? not sure. (redacted some foreground events) Sorry couldn't get the full Log as it is hard, I am taking camera pic |
Wow just the plantronic device took 8seconds to refresh ... that's crazy. I wonder what could be causing such issue, I'll rethink the code to see if it relates to the IconPath or something else. |
Okay latest nightly should have some performance improvement. I stop loading volume info unless requested. |
You're seeing it twice because 1 refresh was ongoing when the second event came in to trigger a new refresh. New refresh job tell old refresh job to stop. Old refresh job had already loaded the plantronic device hence the log. The TaskID is helping to see that they are different job running concurrently. I think I'm also going to increase the debouce ttl to wait longer like 300ms to try to avoid the double refresh issues. |
ok looking good, still getting 9-12 seconds. And when I tried to stress test it by spamming the hotkeys as soon as I plugged in, I reached 19 seconds lol. A couple of questions: |
|
not sure if related to the changes you did with the volume, but now hovering over the icon shows [0%] for both speaker and mic. Not important for me but probably for others. |
Since not loading the volume info at refresh time didn't seem to have a big impact and basically broke having the volume all together I put it back. I think at this point we can consider that the issue is somewhat fixed, even if I have no idea why refreshing the device could take this long. |
I do agree we should close this. I just want to also mention that this morning, I went above the 20 seconds, but I think I switched in the speakers while things were loading. I also realized that Refreshing is taking place twice for speaker and twice for mic so 4 times, every time I switch it in, because it is changing Default device and Communication device. So for now I have set default communication device as the always connected plantronics and got lower times. I guess that's as good as it gets with a company controlled laptop. Thanks a lot! |
I've also increased the ttl to 30s to help with that and removed most logging, so I hope it will be better. Thank you again for helping me test this! |
## [6.8.0](v6.7.2...v6.8.0) (2023-12-19) ### Enhancements * **.NET:** Move to .NET 8.0 ([43f0d60](43f0d60)) * **device::cache:** Improve the performance and speed of caching devices ([594b49c](594b49c)) * **device::cache:** Increase the TTL for refreshing device list ([6ab8028](6ab8028)) * **device::cache:** keep only one cache alive for all devices ([9b3a126](9b3a126)) * **device::cache:** rework the logic behind refreshing devices when changes are detected in the system. ([3c12b3f](3c12b3f)) ### Languages * **Bulgarian:** Translated Settings using Weblate ([b2cf464](b2cf464)) * **Bulgarian:** Translated Tray Icon using Weblate ([fffe534](fffe534)) * **Chinese (Traditional):** Translated Settings using Weblate ([4582119](4582119)) * **French:** Translated Settings using Weblate ([4496335](4496335)) * **French:** Translated Tray Icon using Weblate ([76905a4](76905a4)) * **French:** Translated Update Download using Weblate ([67c281b](67c281b)) * **German:** Translated Settings using Weblate ([061583c](061583c)) * **German:** Translated Tray Icon using Weblate ([3da0c83](3da0c83)) * **Korean:** Translated Tray Icon using Weblate ([4ca2b15](4ca2b15)) * **Polish:** Translated Settings using Weblate ([43f8fa2](43f8fa2)) * **Polish:** Translated Tray Icon using Weblate ([3b05aeb](3b05aeb)) * **Polish:** Translated Update Download using Weblate ([6cd0022](6cd0022)) * **Serbian:** Translated Tray Icon using Weblate ([d17e650](d17e650)) * **Slovenian:** Translated Tray Icon using Weblate ([b8c4269](b8c4269)) * **Swedish:** Translated About using Weblate ([2b0a112](2b0a112)) * **Swedish:** Translated About using Weblate ([943befb](943befb)) * **Swedish:** Translated Settings using Weblate ([9a182a1](9a182a1)) * **Swedish:** Translated Settings using Weblate ([49d3fcc](49d3fcc)) * **Swedish:** Translated Settings using Weblate ([f2eb255](f2eb255)) * **Swedish:** Translated Settings using Weblate ([d9e285f](d9e285f)) * **Swedish:** Translated Settings using Weblate ([3454648](3454648)) * **Swedish:** Translated Tray Icon using Weblate ([e939073](e939073)) * **Swedish:** Translated Tray Icon using Weblate ([fe21446](fe21446)) * **Swedish:** Translated Update Download using Weblate ([c95fe6e](c95fe6e)) * **Swedish:** Translated Update Download using Weblate ([1b65fa4](1b65fa4)) ### Bug Fixes * **Device::Cache:** Devices not being refreshed ([a113175](a113175)), closes [#1323](#1323) * **profile:** possible issue with profile where the the state couldn't be restored after the profile ended. ([a648e4e](a648e4e)) ### Features * **volume:** Add an option to keep volume level across audio devices ([ca293b5](ca293b5)), closes [#1328](#1328)
🎉 This issue has been resolved in version 6.8.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
What happened?
Hello, I am using a USB hub to switch USB sound card between my personal and work laptops. whenever I switch to the personal laptop, there are no issues, but when I switch to my work laptop the device is not refreshed in SoundSwitch but refreshes normally in Windows. I have to restart SoundSwitch every time to get the device listed and be able to use my Hotkey.
I am not admin user on work laptop but admin on personal, not sure if relevant. In both cases I installed SoundSwitch for current user only. For some reason I am not getting [WINAPI] logs on my work laptop, is there a way to enable it, or is it because I am not admin? Thanks.
Step to reproduce
Using the USB Hub switch to switch soundcard between 2 computers.
Version
6.7.2.0
What version of Windows are you seeing the problem on?
Windows 10
Relevant log output
The text was updated successfully, but these errors were encountered: