Skip to content

Commit

Permalink
Remove error checks which caused problems with scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
salbahra committed Sep 1, 2015
1 parent 743bb65 commit 1abc173
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions desktop-app/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ angular.module( "os-updater.controllers", [] ).controller( "HomeCtrl", function(

// Execute the AVRDUDE command and parse the reply
exec( command, { timeout: 3000 }, function( err, stdout, stderr ) {
if ( err ) {
callback();
return;
}

stdout = stdout || stderr;

var matches = stdout.match( filter ),
Expand Down Expand Up @@ -137,10 +132,6 @@ angular.module( "os-updater.controllers", [] ).controller( "HomeCtrl", function(
// The first command will list all Call-Up serial ports
ports: function( callback ) {
exec( "ls /dev/cu.*", { timeout: 1000 }, function( err, stdout ) {
if ( err ) {
callback( err );
return;
}

// Return the list delimited by line return
callback( null, stdout.split( "\n" ) );
Expand All @@ -150,33 +141,20 @@ angular.module( "os-updater.controllers", [] ).controller( "HomeCtrl", function(
// The second command requests the USB informatin from system_profiler (command in bash script)
devices: function( callback ) {
exec( "avr/serial.osx.sh", { timeout: 1000 }, function( err, stdout ) {
if ( err ) {
callback( err );
return;
}

// Return the list delimited by line return
callback( null, stdout.split( "\n" ) );
} );
}
}, function( err, data ) {
if ( err ) {
cleanUp();
return;
}

parseDevices( data.devices, data.ports );
} );
} else if ( platform === "linux" ) {

// Handle serial port scan for Linux platform by running shell script
// which parses the /sys/bus/usb/devices path for connected devices
exec( "./avr/serial.linux.sh", { timeout: 1000 }, function( err, stdout ) {
if ( err ) {
cleanUp();
} else {
parseDevices( stdout.split( "\n" ), null );
}
parseDevices( stdout.split( "\n" ), null );
} );
} else if ( platform === "win" ) {
var wmic = spawn( "wmic", [] ),
Expand Down Expand Up @@ -234,11 +212,6 @@ angular.module( "os-updater.controllers", [] ).controller( "HomeCtrl", function(

// Execute the AVRDUDE update process and process the result
exec( command, function( err, stdout, stderr ) {
if ( err ) {
callback( err );
return;
}

stdout = stdout || stderr;

// At the end of the AVRDUDE command, the flash memory is verified and if successful a message indicating so is displayed
Expand All @@ -260,7 +233,7 @@ angular.module( "os-updater.controllers", [] ).controller( "HomeCtrl", function(
}, function( err, results ) {

// Process results once the download and update process has completed. If the status was successful indicate so to the user.
if ( !err && results.status ) {
if ( results.status ) {
$scope.button.text = "OpenSprinkler " + type + " is rebooting...";
$scope.$apply();

Expand Down

0 comments on commit 1abc173

Please sign in to comment.