Macro-Deck-App / Macro-Deck

Macro Deck transforms your phone, tablet, or any device equipped with a modern internet browser into an efficient remote macro pad. With this tool, you can execute single or multi-step actions seamlessly with just a single tap.
https://macro-deck.app
Apache License 2.0
970 stars 73 forks source link

Macro Deck crashes when an ADB shell command fails #539

Open lmore377 opened 5 months ago

lmore377 commented 5 months ago

Describe the bug Macro Deck completely crashes when an ADB shell command (in this case am) fails for some reason.

To Reproduce Steps to reproduce the behavior:

  1. Connect a device that has ADB but not common Android shell commands (in this case, a Spotify Car Thing)
  2. Launch Macro Deck
  3. Macro Deck will launch for a second then immediately crash, leaving behind the below logfile

Expected behavior Ideally in a scenario like this, Macro Deck would just do the adb reverse command to open the web client/websocket connection and leave everything else up to the user.

Additional context The Spotify Car Thing has been rooted and it turns out the frontend is just a webapp running on top of chromium. The webapp can be replaced with almost anything, making it ideal for Macro Deck. So far this is one of the issues keeping them from working together.

Log file

7:53:47 PM [Macro Deck] [Info] >> Checking paths...
7:53:47 PM [Macro Deck] [Info] >> Checking paths done
7:53:47 PM [Macro Deck] [Info] >> Set log level to 0
7:53:47 PM [Macro Deck] [Info] >> Macro Deck 2.14.1
7:53:47 PM [Macro Deck] [Info] >> Path: C:\Program Files\Macro Deck\Macro Deck 2.exe
7:53:47 PM [Macro Deck] [Info] >> Start parameters: --port 0 --force-update False --test-channel False --export-default-strings False --portable False --show False --disable-file-logging False --log-level 0 --debug-console False --ignore-pid-check 0
7:53:47 PM [Macro Deck] [Info] >> Loading language files...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Bulgaria.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Chinese.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Dutch.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.English.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Filipino.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Finnish.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.French.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.German.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Hungarian.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Italian.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Japanese.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Korean.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Polish.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Portuguese.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Russian.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Spanish.json...
7:53:47 PM [Macro Deck] [Info] >> LanguageManager: Loading $SuchByte.MacroDeck.Resources.Languages.Turkish.json...
7:53:47 PM [Macro Deck] [Info] >> Set language to English
7:53:47 PM [Macro Deck] [Info] >> VariableManager: Initialize variables database...
7:53:47 PM [Macro Deck] [Info] >> VariableManager: 5 variables found
7:53:47 PM [Macro Deck] [Info] >> PluginManager: Loading plugins...
7:53:48 PM [Macro Deck] [Info] >> IconManager: Loading icon packs...
7:53:48 PM [Macro Deck] [Info] >> IconManager: Loaded 0 icon packs
7:53:48 PM [Macro Deck] [Info] >> ProfileManager: Loading profiles...
7:53:48 PM [Macro Deck] [Info] >> Loaded 1 profiles
7:53:48 PM [Macro Deck] [Info] >> Found network interfaces:
Ethernet - 169.254.160.156
Tailscale - x.x.x.x
Wi-Fi - 10.1.58.22
Bluetooth Network Connection - 169.254.182.255
Loopback Pseudo-Interface 1 - 127.0.0.1

7:53:48 PM [Macro Deck] [Info] >> MacroDeckPipeServer: Initializing pipe server
7:53:48 PM [Macro Deck] [Info] >> AdbServerHelper: Starting ADB server using C:\Program Files\Macro Deck\Android Debug Bridge\adb.exe
7:53:48 PM [Macro Deck] [Info] >> AdbServerHelper: Unable to start ADB server
7:53:48 PM [Macro Deck] [Info] >> AdbServerHelper:  connected
7:53:49 PM [Macro Deck] [Error] >> MacroDeck: CurrentDomainOnUnhandledException: AdvancedSharpAdbClient.Exceptions.ShellCommandUnresponsiveException: The shell command has become unresponsive
 ---> System.IO.FileNotFoundException: The remote execution returned: '/bin/sh: am: not found'
   at AdvancedSharpAdbClient.Receivers.ConsoleOutputReceiver.ThrowOnError(String line)
   at AdvancedSharpAdbClient.Receivers.MultiLineReceiver.ThrowOnErrorAsync(String line, CancellationToken cancellationToken)
   at AdvancedSharpAdbClient.Receivers.MultiLineReceiver.AddOutputAsync(String line, CancellationToken cancellationToken)
   at AdvancedSharpAdbClient.AdbClient.ExecuteServerCommandAsync(String target, String command, IAdbSocket socket, IShellOutputReceiver receiver, Encoding encoding, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at AdvancedSharpAdbClient.AdbClient.ExecuteServerCommandAsync(String target, String command, IAdbSocket socket, IShellOutputReceiver receiver, Encoding encoding, CancellationToken cancellationToken)
   at AdvancedSharpAdbClient.AdbClient.ExecuteRemoteCommandAsync(String command, DeviceData device, IShellOutputReceiver receiver, Encoding encoding, CancellationToken cancellationToken)
   at SuchByte.MacroDeck.Server.AdbServerHelper.StartMacroDeckClient(AdbClient adbDeviceClient, DeviceData device) in D:\a\Macro-Deck\Macro-Deck\MacroDeck\Server\AdbServerHelper.cs:line 166
   at SuchByte.MacroDeck.Server.AdbServerHelper.<>c.<<Monitor_DeviceConnected>b__9_0>d.MoveNext() in D:\a\Macro-Deck\Macro-Deck\MacroDeck\Server\AdbServerHelper.cs:line 110
--- End of stack trace from previous location ---
   at SuchByte.MacroDeck.Server.AdbServerHelper.RunForDevice(String serial, Func`3 action) in D:\a\Macro-Deck\Macro-Deck\MacroDeck\Server\AdbServerHelper.cs:line 60
   at SuchByte.MacroDeck.Server.AdbServerHelper.Monitor_DeviceConnected(Object sender, DeviceDataEventArgs e) in D:\a\Macro-Deck\Macro-Deck\MacroDeck\Server\AdbServerHelper.cs:line 108
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
brandonkthomas commented 3 months ago

bump - i can repro on v2.14.1 with my Car Thing as well. identical call stack.

lmore377 commented 3 months ago

Just a note, I think the Unable to start ADB server error is just because I had ADB running already. I don't think it's relevant to this issue.

brandonkthomas commented 3 months ago

I thought the same thing at first, but I killed adb.exe + related processes then restarted Macro Deck and still got that error.