deej icon indicating copy to clipboard operation
deej copied to clipboard

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

Open ryanaukes opened this issue 3 years ago • 4 comments

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!

ryanaukes avatar Jun 26 '21 22:06 ryanaukes

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.

omriharel avatar Jun 26 '21 23:06 omriharel

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.

ThreepE0 avatar Nov 12 '21 16:11 ThreepE0

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: https://github.com/omriharel/deej/compare/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 } 

wildxmxtt avatar Feb 06 '24 19:02 wildxmxtt

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.

N0P1NG avatar Mar 25 '24 20:03 N0P1NG