On Sat, Jan 25, 2014 at 2:53 PM, <[email protected]> wrote:
> Hello,
> I am trying to get a program to run at boot up by placing it in the Cloud9
> auto run folder but it does not work properly.
> My nodes version is 0.10.24
>
Guess you aren't using the Angstrom image. Do you know if
bonescript/autorun.js is actually running? Angstrom has it started with
systemd. The systemd service to run it is in the systemd directory of the
BoneScript repository.
Also, what version of BoneScript are you running? There was a bug in older
versions of BoneScript's autorun where the lack of handling STDIO caused
programs to end immediately after starting.
Test version with:
node -pe "require('bonescript').getPlatform().bonescript"
> My Kernel version is : Linux beaglebone 3.8.13 #1 SMP Tue Jun 18 02:11:09
> EDT 2013 armv7l GNU/Linux
>
> The program runs in the cloud9 environment and from the command line
> /var/lib/cloud9/autorun node controlautorun
>
> I could create a service that is called at boot time but I really would
> like to find the problem with the auto run system.
>
> The program communicates serially with another device so I can
> see immediately if the serial data is being sent.
>
> The first thing I did was to send the console log to a file. It is not
> written-to when the controlautorun is started by autorun. I believe
> controlautorun is started and stopped before opening the serial port here
> is a log from journalctl:
>
> Jan 25 13:34:41 beaglebone bonescript-autorun[134]: info: change:
> controlautorun.js
>
> Jan 25 13:34:41 beaglebone bonescript-autorun[134]: info: start:
> controlautorun.js
>
> Jan 25 13:34:41 beaglebone bonescript-autorun[134]: info: change:
> controlautorun.js
>
> Jan 25 13:34:41 beaglebone bonescript-autorun[134]: info: stop:
> controlautorun.js
>
> Jan 25 13:34:42 beaglebone bonescript-autorun[134]: info: start:
> controlautorun.js
>
Guess that says you are running bonescript/autorun.js fine. Makes me think
you are just running the old version.
>
> also from PS the process id seems to change which is consistent with
> starting and stopping:
>
>
> root@beaglebone:~# ps -aux | grep controlautorun
>
> Warning: bad ps syntax, perhaps a bogus '-'? See
> http://procps.sf.net/faq.html
>
> root 3393 0.0 0.1 1956 576 pts/0 S+ 14:07 0:00 grep
> controlautorun
>
> root@beaglebone:~# ps -auxwww | grep controlautorun
>
> Warning: bad ps syntax, perhaps a bogus '-'? See
> http://procps.sf.net/faq.html
>
> root 3395 0.0 0.1 1956 576 pts/0 S+ 14:09 0:00 grep
> controlautorun
>
>
> Here is the first few lines of controlautorun.js:
>
>
> var app = require('http').createServer(handler);
>
> var io = require('/usr/local/lib/node_modules/
> socket.io/lib/socket.io').listen(app);
>
> var fs = require('fs');
>
> var bb = require('bonescript');
>
> var SerialPort = require("serialport").SerialPort;
>
> var serialPort = new SerialPort("/dev/ttyO1",{baudrate:115200}
>
> , false);
>
>
> // logging ===
>
> var fs = require('fs');
>
> var util = require('util');
>
> var log_file = fs.createWriteStream(__dirname + '/debug.log', {flags :
> 'a'});
>
> var log_stdout = process.stdout;
>
>
> console.log = function(d) { //
>
> log_file.write(util.format(d) + '\n');
>
> log_stdout.write(util.format(d) + '\n');
>
> };
>
> // =============
>
>
> app.listen(82);
>
> var companyName = 'Luminosys';
>
> var productName = 'RGY800';
>
> var productModelNo ='AB03';
>
> var productID= '100A';
>
> var macAddress = '11:23:45:C7:88:D3';
>
> var IPAddress = '192.168.7.52';
>
> var masterPsw = ' ';
>
> var user1 = ' ';
>
> var user2 = ' ';
>
> var user1Psw= ' ';
>
> var user2Psw= ' ';
>
> var accessPointName = ' ';
>
> var accessPointPsw = ' ';
>
> var state = 'on';
>
> var serialTxDataLenght = '24';
>
> var txDataHeader = 03;
>
> var colorA=3; // 0=off, 1= yellow, 2=green, 3= red, 4= flashing red 5=
> flashing green
>
> var redTime=8;
>
> var greenTime=4;
>
> var yellowTime=3;
>
> var clearTime= redTime-greenTime-yellowTime;
>
> var redCountA=8;
>
> var greenCountA=0;
>
> var yellowCountA=0;
>
> var TotalCycleTime;
>
> var FlashingRed=1;
>
> var SolarPresence;
>
> var ADCValues;
>
> var solarPowerPercent;
>
> var batChargePercent;
>
> var solarCurrentPercent;
>
> var daylight;
>
> var temperature;
>
> var tA; //
>
> var lightTimeDivide=0;
>
> var timerA=5;
>
> var timerB=4;
>
> var phaseA=3;
>
> var phaseB=3;
>
> var syncB=0;
>
> var lightTimeDivide=0;
>
> var flashingRed=0;
>
> var batVolt;
>
> var colorB=0;
>
> var redCountB=8;
>
> var greenCountB=0;
>
> var yellowCountB=0;
>
> var txABuffer = new Buffer(18);
>
> var txASerialBusy=0;
>
> var aSideWatchdog=100; // tbd
>
> //****** serial port init**************
>
> serialPort.open(function(){
>
> console.log('------------Serial 1 open------------');
>
> // serialPort.write("test usart1 ", function(err, results){
>
> // if (err) console.log('error: ' + err);
>
> // console.log('Bytes written ' + results);
>
> // });
>
> });
>
>
> serialPort.on('data', function (data){
>
> if (data[0] === 0x15 ){
>
> console.log('============Received NAK ===========');
>
> }
>
> if (data[0] === 0x06 && data[data.length-1]===0x03){
>
> console.log('Good Msg');
>
> var msgSwitch=1;
>
>
>
> var jj=1;
>
> var ii=1;
>
> for (jj=ii; jj< data.length-1;jj++){
>
> if (data[jj] ===0x20){
>
> batVolt = data.toString('utf8',ii,jj);
>
> console.log('Battery Voltage = '+ batVolt);
>
> jj++;
>
> ii=jj;
>
> break;
>
> }
>
> }
>
> for (jj=ii; jj< data.length-1;jj++){
>
> if (data[jj] ===0x20){
>
> solarPowerPercent = data.toString('utf8',ii,jj);
>
> console.log('Solar Power = '+ solarPowerPercent+ ' %');
>
> jj++;
>
> ii=jj;
>
> break;
>
> }
>
> }
>
> for (jj=ii; jj< data.length-1;jj++){
>
> if (data[jj] ===0x20){
>
> daylight = data.toString('utf8',ii,jj);
>
> console.log('Daylight = '+ daylight);
>
> jj++;
>
> ii=jj;
>
> break;
>
> }
>
> }
>
> for (jj=ii; jj< data.length-1;jj++){
>
> if (data[jj] ===0x20){
>
> temperature = data.toString('utf8',ii,jj);
>
> console.log('Temperature = '+ temperature + ' C');
>
> jj++;
>
> ii=jj;
>
> break;
>
> }
>
> }
>
> for (jj=ii; jj< data.length-1;jj++){
>
> if (data[jj] ===0x20){
>
> batChargePercent = data.toString('utf8',ii,jj);
>
> console.log('Battery Level = '+ batChargePercent+ '
> %');
>
> jj++;
>
> ii=jj;
>
> break;
>
> }
>
> }
>
> //console.log(data.length +' data received: ' + data);
>
> aSideWatchdog=100; //
>
> } else {
>
> console.log('Bad Msg');
>
> console.log(data.length +' data received: ' + data);
>
>
>
> }
>
>
>
> });
>
>
>
> // ===== end open serial port ============
>
>
>
> Any ideal on how to troubleshoot this problem will be greatly appreciated.
>
Check out the questions above. If you know it works from the command-line,
it should work under autorun with BoneScript 0.2.4.
>
> Thanks in advance
>
>
> Claude Arpin
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.