Cabbage Logo
Back to Cabbage Site

SSH and Raspberry Pi

I’ve just noticed that Cabbage has a “save to RPi” feature using SSH. I managed to get it to pick up the pi (3B+) after a while of debugging.
This is fairly nontrivial to set up, and there’s no documentation I could find on the subject.
At first, Cabbage would just hang whenever I attempted to use the feature. I figured out that this is because my computer didn’t have an RSA / ssh key associated with the pi, which forced it to require a password. Cabbage was unable to handle that condition, and as it requires user input at some nonexistant terminal, it crashes. To fix that, I had to fire up powershell and generate and append the necessary keys to my .ssh folder.
Now, it lets me see some of the files on my pi, but the browser is almost nonfunctional. It has refresh issues and an unfriendly naming scheme for folders that seems like some sort of verbose, ugly ls command.

As far as I can tell, the system doesn’t actually save a file when you hit return. Thus far I’ve tried:
name
name.csd
path/name
path/name.csd

Unfortunately, it seems like my files don’t actually save. Any help? I could manually move them with SSH copy or something, but I’d love to use the built in system.

Suggestions?

I shouldn’t have really included this in the main build until it was fully tested. That’s my mistaken. I don’t actually have a RPi at the moment, but I’d be happy to help you get this going, even if it involves some over and back?

BTW, I’m not sure what I can do about the browser, I agree, it is rather ugly and not very user friendly. Perhaps I should retire this feature altogether?

I don’t think necessary to remove it, but just opening an SSH’d terminal / powershell and some form of command line file explorer would be a better alternative until you / the dev team have time to look into it.
In my opinion, it’s an incredibly useful feature to have, and just makes it that much smoother, to the point that I’d use Cabbage over another IDE just for that feature. I’m planning on doing development with the pi compute module for embedded systems, so having SSH access built in is wonderful.

As well, I’m totally down to let you use me and by extension my raspberry pi to test it out. If it’s more developed in a different branch, should I go build from source?

If Cabbage had an ‘launch in terminal’ type command, would that be Ok? I mean, one could specify the starting command to the terminal when it’s launched, so you can SSH straight away? Something like that might work, but you’d still need to push and pull the files yourself?

Maybe, or you could make a custom .bat script (and whatever the equivalent there is for linux and osx) that takes a user filename and path and does all the commands under the hood.
You could probably do a quick test to see if ssh is installed and active, or just force a link to the RPi help docs on setting up ssh if the user doesn’t have it enabled.
You also might want to have some sort of async promise timeout on the ssh, so that it doesn’t hang the program. I could probably write a version of a shell script in a bit.

I’d be happy to use something like this if you had it any way user friendly and easy to use :wink:

1 Like

I don’t have a rPi, but this thread interests me!

Eventually, if and when I get a hold of one, the idea of having a self contained rpi machine powered by cabbage is fascinating. Plus I’m pretty handy with bash/sh scripting if needed too, so maybe at some point I’ll be able to lend a hand.

Well, it took me a hot minute, but here’s some code! I’m pretty new to batch files, so any recommendations are good. It accepts file path as a flag using “-p /file/path” so that Cabbage can invoke it and just give it the currently active csd file

:: This batch file serves to enable file copy of SSH using SCP for the Cabbage IDE


cls
:: Disallow standard command feedback
@echo off

::forces all variables to local
setlocal
:: clear vars
echo --------------------------------------------------------
echo -------- CabbagePi File copy over SSH using SCP --------
echo --------------------------------------------------------
echo.
echo This util is for a headless / remote pi, 
echo but will work with any ssh-able computer.
echo SSH MUST BE ACTIVE ON TARGET. To get started with pi, see
echo https://www.raspberrypi.org/documentation/remote-access/ssh
echo.
echo You will need:
echo - Source file path
echo - Destination file path (ex: pi/csound/project becomes csound/project)
echo - Target's SSH username [ user@ip ]
echo - Target's Password
echo.
pause
echo.
echo Checking for SSH install and setup...
echo.
::check that ssh is installed, handle error
ssh -V localhost && (
	echo.
	echo SSH Install found!
	:: goes to the fork where SSH check has passed
	goto :sshPass
) || (
	echo.
	echo SSH is not installed. Please follow the guide on the official RPi Website
	echo "https://www.raspberrypi.org/documentation/remote-access/ssh/windows10.md"
	pause
)

:sshPass

::checks for file as command flag
if [%~1]==[-p] goto :filledPath
set /p file=Source file path: 
goto :pathPass

:: if the command flag is present, use the second arg as path
:filledPath
set file = %~2

:pathPass

:: asks for username
set /p user=SSH username (user@ip): 

:: asks for remote path
set /p dest=Destination path: 

::copy the file
scp %file% %user%:%dest%
pause

I’ll try to incorporate this when I get a chance. Please feel free to bump the issue if you see no movement on it!

Ok, sounds good! I’ve got the script now for my own uses anyway, so it’s not a big deal. But it’ll be cool to see where this goes.