shell script ubuntu 12.04 & open() problem on processing 2.0
in
Processing with Other Languages
•
25 days ago
I was wondering if anyone had a solution for launching shell scripts from processing.
In particular I would do a firmware update in my processing application using a bash script like this:
#!/bin/bash
avrdude -v -p m328p -P /dev/ttyUSB0 -b 38400 -c arduino -e -U flash:w:$1
exit
where $1 is a filename parameter that I pass using selectInput("Select a .hex file to upload:", "hexFileSelected");
......
void hexFileSelected(File selection) {
if (selection == null) {
println("Window was closed or the user hit cancel.");
} else {
println("User selected " + selection.getAbsolutePath());
myPort.write("RESET"+'\n'); //mette il uC in modalità programmazione per l'autoreset in attesa del firmware
delay(300); //ritardo dopo il reset del uC per caricare il firmware nuovo
String [] openArg = {"./Upload_firmware.sh ", selection.getAbsolutePath()};
open(openArg);
}
My script file is in chmod u+x and I also edited propeties of the file to be launched as an application.
...and I have changed the .properites file like this:
launcher=bash
In processing source file I write "RESET\n" on serial port to reset a uC on my electronic board that receive this string and active a WDT that reset itself.
This work well but after the open() method isn't working and doesn't upload a firmware file.
If I insert a script command line on my ubuntu terminal with a right .hex file path the firware is correctly upload and everything works fine.
I don't understand where I wrong.....Can you help me to solve it?
1