node.js exec on raspberry pi用gphoto2制作图片

时间:2014-12-25 10:46:37

标签: node.js raspberry-pi

制作一张照片后,相机卡住了。我只是尝试使用exec命令,因为它似乎是最简单的方法。我使用canon eos 400d,raspberry pi模型B和node.js版本0.10.28。谢谢你的帮助!

var Camera = function(){
}

Camera.prototype = {
  sys: require('sys'),
  exec: require('child_process').exec
}

Camera.prototype.takePicture = function(imageCount, nextImagePosition, callback){
  this.exec("gphoto2 --capture-image-and-download --filename '%Y%m%d%H%M%S.jpg' ",     
  function(error, stdout, stderr){
    console.log('stdout: ' + stdout);
    console.log('stderr: ' + stderr);
    if (error !== null) {
      console.log('exec error: ' + error);
    }
  });
};

1 个答案:

答案 0 :(得分:1)

如果有人遇到同样的问题,解决方案是使用以下脚本更新gphoto2:https://github.com/gonzalo/gphoto2-updater