Skip to content
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

Deej doesn't reconnect after usb gets unplugged and plugged in again #38

Open
ryanaukes opened this issue Jun 26, 2021 · 5 comments
Open

Comments

@ryanaukes
Copy link

Maybe a nice addition is to make the Deej hotswappable, so that it automatically connects after you plug in the Deej.
I don't want to keep my Deej on all the time, but also don't like it that I have to start and stop the Deej software everytime I unplug the Deej and plug in it again.
I would prefer to run the Deej software at startup and let it connect to the hardware whenever I plug it in. I hope this could be added in the future. Thanks for the great project!

@omriharel
Copy link
Owner

Hi there @ryanaukes, thank you for the kind words!

This is an understandable need, and I intend to do a connection stability pass in the near future that'll hopefully also include this. It will need to be accompanied by better signaling for deej's current connection state, which is challenging to do without a UI - but I'll come up with a solution. I'm leaving the issue open and will update here when this is released.

@ThreepE0
Copy link

Hello @omriharel, please take a look at a comment that I posted on a related but separate issue; I'm wondering if the "can't read line from serial" function might simply be broken, as editing the config while Deej.exe is running recovers from both plug/unplug as well as from loss due to sleep/wake of the computer. The config reload seems to be using similar functions, so I'd think that if the "can't read line" function were to be edited, that'd fix the main issue for both of these. Maybe I'm missing something though. I hope this helps narrow things down.

@wildxmxtt
Copy link

wildxmxtt commented Feb 6, 2024

Comment edited by @omriharel: The following suggestion is an untested workaround. Its impact on system performance, stability and security has not been measured. As such, use it at your own risk.

Original content below:

I was able to write a file called on_connect.ps1 that fixes this issue through task scheduler: (fork here: master...wildxmxtt:deej:patch-1 )

Steps to do this on WINDOWS:

  1. Place on_connection.ps1 in the same folder as deej.exe
  2. Open the on_connection.ps1 ; here you will specify your Arduino Port & path to your deej.exe
  3. Create a basic task on task scheduler

For the variables in task scheduler use the following:

  1. Program/Script: Path to powershell.exe (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe)
  2. Add arguments: -windowstyle hidden .\on_connection.ps1
  3. Start in: full path to your folder where deej.exe and on_connection.ps1 is stored (C:\Users\UserName\Documents\Deej)

Hope this helps!

Also if your com port tends to change often please change all 3 lines in on_connection.ps1 where it says:

$device = Get-WmiObject Win32_SerialPort | Where-Object { $_.DeviceID -eq $arduinoPort } 

To

$ArdunioName = "Arduino NANO Every"
$device = Get-WmiObject Win32_SerialPort | Where-Object { $_.Description -eq $ArdunioName } 

@N0P1NG
Copy link

N0P1NG commented Mar 25, 2024

What about "reconnect" button in tray? That would restart the app or a menu with port selection and reload COM button or change the comport in config and back which sort of works as slow workaround.

@sin3point14
Copy link

sin3point14 commented Aug 6, 2024

I slightly tweaked @marcuswu 's reconnection implementation to attempt reconnections every 1s and send desktop notification when deej loses/re-gains connection at: https://github.com/sin3point14/deej, as I faced the same usb unplugged and plugged problem and felt this approach is better suited

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants