Gphoto2 节点### io-library 发生错误('Could not claim the USB device')
Gphoto2 node ### An error occurred in the io-library ('Could not claim the USB device')
我正在研究 RaspberryPi 3 和数码单反相机 (Canon 1300 D) 之间的连接。当我 运行 命令捕获图像时,第一次工作正常,当我再次 运行 时,我遇到以下问题:
io 库中发生错误 ('Could not claim the USB device'):无法声明接口 0(设备或资源繁忙)。确保没有其他程序 (gvfs-gphoto2-volume-monitor) 或内核模块(例如 sdc2xx、stv680、spca50x)正在使用该设备,并且您可以 read/write 访问该设备。
请给我 "How to communicate Raspberry Pi 3 with DSLR using NodeJs ?"
的解决方案
代码示例:
app.post('/onDemand', function(req, res) {
GPhoto.list(function (list) {
console.log('List:', list);
if (list.length === 0) return;
var camera = list[0];
camera.takePicture({download: true,keep: true}, function (er, data) {
fs.writeFileSync(__dirname + '/input/picture1.jpg', data);
var filePath = "./input/picture1.jpg";
var params = {
Bucket: 'marzs',
Body : fs.createReadStream(filePath),
Key : "marzs/"+Date.now()+"_"+path.basename(filePath)
};
s3.putObject(params, function (err, data) {
if (err) {
console.log('ERROR MSG: ', err);
res.status(500).send(err);
} else {
console.log('Successfully uploaded data');
res.status(200).send({ imageURL: data.Location });
}
res.status(200).send({ imageURL: data.Location });
});
});
});
});
提前致谢。
Yogesh Waghmare
我们需要在服务器上安装 libusb 并运行遵循命令。
gphoto2 --get-config=capturetarget
gphoto2 --set-config=capturetarget=1
gphoto2 --set-config shutterspeed=bulb
gphoto2 --wait-event=2s --set-config eosremoterelease=Immediate --wait-event=5s --set-config eosremoterelease=Off --wait-event-and-download=5s
之后,我们需要在流程完成后使用“process.exit();”退出流程。和 运行 通过 forever 命令
现在编码 运行ning 正确。
感谢和问候,
约格什·瓦格玛
我正在研究 RaspberryPi 3 和数码单反相机 (Canon 1300 D) 之间的连接。当我 运行 命令捕获图像时,第一次工作正常,当我再次 运行 时,我遇到以下问题:
io 库中发生错误 ('Could not claim the USB device'):无法声明接口 0(设备或资源繁忙)。确保没有其他程序 (gvfs-gphoto2-volume-monitor) 或内核模块(例如 sdc2xx、stv680、spca50x)正在使用该设备,并且您可以 read/write 访问该设备。
请给我 "How to communicate Raspberry Pi 3 with DSLR using NodeJs ?"
的解决方案代码示例:
app.post('/onDemand', function(req, res) {
GPhoto.list(function (list) {
console.log('List:', list);
if (list.length === 0) return;
var camera = list[0];
camera.takePicture({download: true,keep: true}, function (er, data) {
fs.writeFileSync(__dirname + '/input/picture1.jpg', data);
var filePath = "./input/picture1.jpg";
var params = {
Bucket: 'marzs',
Body : fs.createReadStream(filePath),
Key : "marzs/"+Date.now()+"_"+path.basename(filePath)
};
s3.putObject(params, function (err, data) {
if (err) {
console.log('ERROR MSG: ', err);
res.status(500).send(err);
} else {
console.log('Successfully uploaded data');
res.status(200).send({ imageURL: data.Location });
}
res.status(200).send({ imageURL: data.Location });
});
});
});
});
提前致谢。
Yogesh Waghmare
我们需要在服务器上安装 libusb 并运行遵循命令。
gphoto2 --get-config=capturetarget
gphoto2 --set-config=capturetarget=1
gphoto2 --set-config shutterspeed=bulb
gphoto2 --wait-event=2s --set-config eosremoterelease=Immediate --wait-event=5s --set-config eosremoterelease=Off --wait-event-and-download=5s
之后,我们需要在流程完成后使用“process.exit();”退出流程。和 运行 通过 forever 命令
现在编码 运行ning 正确。
感谢和问候, 约格什·瓦格玛