Open mark-spurgeon opened 5 years ago
Which camera are you using? Which version of libgphoto2?
I used the Nikon d7100 (which works just fine with the gphoto2 cli) and I just ran the test from the github repo, so latest version used I suppose?
Hello, I have the same problem with nikon D7100. Library can find the camera. However function camera.getConfig(function (er, settings) {}) - segmentation fault. camera.setConfigValue('f-number', "f/9", function (er) {} ) - works, but with shutterspeed - doesnt work. camera.takePicture({download: true}, function (er, data) {} ) - works
@the-duck libgphoto2
is a separate library that this project is wrapping. You probably installed it as dependency of this project, or by installing the gphoto2
command.
@MichaelKirov please also specify the exact call you used to set shutterspeed
so others may try and reproduce the error.
Could this be related? -- at least on Canon, shutterspeed
is set as an index instead of a fractional value; maybe you want to take a look at the output of gphoto2 --list-config
to see what options are really available.
Hi, I've noticed a similar issue when trying to getConfig
while working with a FujiFilm X-T2.
I'll be honest though, that I'm not sure if this issue is entirely related, so please let me know if this should be bumped to another thread.
Whenever plugging the camera in and running some of the simple examples noted, I will receive this seg fault when running getConfig
.
Found Fuji Fujifilm X-T2
ptp_usb_getresp [usb.c:514] PTP_OC 0x1002 receiving resp failed: PTP Session Already Opened (0x201e)
camera_init [library.c:8308] 'ptp_opensession (params, sessionid)' failed: PTP Session Already Opened (0x201e)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8703] 'ptp_generic_getdevicepropdesc(params,cursub->propid,&dpd)' failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8708] Type of property 'ISO Speed' expected: 0x0004 got: 0x0005
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8703] 'ptp_generic_getdevicepropdesc(params,cursub->propid,&dpd)' failed: PTP Device Prop Not Supported (0x200a)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8703] 'ptp_generic_getdevicepropdesc(params,cursub->propid,&dpd)' failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8708] Type of property 'Sharpness' expected: 0x0002 got: 0x0003
_get_config [config.c:8708] Type of property 'Capture Delay' expected: 0x0006 got: 0x0004
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8703] 'ptp_generic_getdevicepropdesc(params,cursub->propid,&dpd)' failed: PTP Device Prop Not Supported (0x200a)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8703] 'ptp_generic_getdevicepropdesc(params,cursub->propid,&dpd)' failed: PTP Device Prop Not Supported (0x200a)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
...
Segmentation fault: 11
I will also notice another log if I try to take two pictures in a row; however, no segmentation fault occurs so what's pasted below may be an unrelated issue.
Found Fuji Fujifilm X-T2
ptp_usb_getresp [usb.c:514] PTP_OC 0x1002 receiving resp failed: PTP Session Already Opened (0x201e)
camera_init [library.c:8314] 'ptp_opensession (params, sessionid)' failed: PTP Session Already Opened (0x201e)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1016 receiving resp failed: PTP Device Busy (0x2019)
camera_prepare_capture [config.c:485] 'ptp_setdevicepropvalue (params, 0xd207, &propval, PTP_DTC_UINT16)' failed: PTP Device Busy (0x2019)
(node:3308) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
To note is that the Fuji X-T2 has a "PC Connection" mode which needs to be on "USB Auto" or "USB Fixed" to work with gphoto2 in general. It appears to be a sort of tethered mode which may require something more akin to the --capture-tethered
feature of gphoto2 but that's a guess brought on by the fact that I haven't been able to save images to card yet.
Like I said before, it seems this mode works with gphoto2 since capturing images and getting configuration settings behave as expected, but it's yielding strange errors like the ones above when trying to use node-gphoto2.
This is certainly a bug, it shouldn't segfault even if libgphoto2 returns an error.
Im having the same issue with a Nikon D5300 and latest build of this repo. Everything works fine except the getConfig Method. If i turn off the camera and start it it will grab the config settings once without the problem but a second time will throw a segfault. After restarting the camera again It will work for one time.
Im getting:
ptp_usb_getresp [usb.c:465] PTP_OC 0x90c8 receiving resp failed: PTP Device Busy (0x2019)
ptp_usb_getresp [usb.c:465] PTP_OC 0x90c8 receiving resp failed: PTP Device Busy (0x2019)
ptp_usb_getresp [usb.c:465] PTP_OC 0x90c8 receiving resp failed: PTP Device Busy (0x2019)
ptp_usb_getresp [usb.c:465] PTP_OC 0x90c8 receiving resp failed: PTP Device Busy (0x2019)
(node:2036) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
_get_config [config.c:7471] Type of property 'Lens Name' expected: 0x0002 got: 0x0004
_get_config [config.c:7471] Type of property 'ISO Auto Hi Limit' expected: 0x0001 got: 0x0002
_get_config [config.c:7471] Type of property 'Active D-Lighting' expected: 0x0001 got: 0x0002
_get_config [config.c:7471] Type of property 'High ISO Noise Reduction' expected: 0x0001 got: 0x0002
_get_config [config.c:7471] Type of property 'Live View AF Mode' expected: 0x0001 got: 0x0002
_get_config [config.c:7471] Type of property 'Flash Exposure Compensation' expected: 0x0002 got: 0x0001
Segmentation fault
Hi all,
Apologies for the late response, I went on vacation immediately after posting this.
With the advice from my friend, @rezonant, I've added segfault-handler to help return a stack trace.
Error plus stack trace:
Found Fuji Fujifilm X-T2
Getting camera config for Fuji Fujifilm X-T2
ptp_usb_getresp [usb.c:514] PTP_OC 0x1002 receiving resp failed: PTP Session Already Opened (0x201e)
camera_init [library.c:8308] 'ptp_opensession (params, sessionid)' failed: PTP Session Already Opened (0x201e)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1016 receiving resp failed: PTP Device Busy (0x2019)
camera_prepare_capture [config.c:485] 'ptp_setdevicepropvalue (params, 0xd207, &propval, PTP_DTC_UINT16)' failed: PTP Device Busy (0x2019)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8703] 'ptp_generic_getdevicepropdesc(params,cursub->propid,&dpd)' failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8708] Type of property 'ISO Speed' expected: 0x0004 got: 0x0005
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8703] 'ptp_generic_getdevicepropdesc(params,cursub->propid,&dpd)' failed: PTP Device Prop Not Supported (0x200a)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8703] 'ptp_generic_getdevicepropdesc(params,cursub->propid,&dpd)' failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8708] Type of property 'Sharpness' expected: 0x0002 got: 0x0003
_get_config [config.c:8708] Type of property 'Capture Delay' expected: 0x0006 got: 0x0004
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8703] 'ptp_generic_getdevicepropdesc(params,cursub->propid,&dpd)' failed: PTP Device Prop Not Supported (0x200a)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
_get_config [config.c:8703] 'ptp_generic_getdevicepropdesc(params,cursub->propid,&dpd)' failed: PTP Device Prop Not Supported (0x200a)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
ptp_usb_getresp [usb.c:514] PTP_OC 0x1014 receiving resp failed: PTP Device Prop Not Supported (0x200a)
...
PID 93873 received SIGSEGV for address: 0x0
0 segfault-handler.node 0x0000000105b88098 _ZL16segfault_handleriP9__siginfoPv + 312
1 libsystem_platform.dylib 0x00007fff73a3fb5d _sigtramp + 29
2 ??? 0x0000000103b38020 0x0 + 4357062688
3 node 0x0000000100192ad9 _ZN2v86String11NewFromUtf8EPNS_7IsolateEPKcNS_13NewStringTypeEi + 151
4 gphoto2.node 0x0000000103bda785 _ZN8GPCamera14getWidgetValueEP10_GPContextP13_CameraWidget + 1387
5 gphoto2.node 0x0000000103bda0b4 _ZN8GPCamera23convertSettingsToObjectEbP10_GPContextRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE8TreeNodeNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEE + 804
6 gphoto2.node 0x0000000103bd9fbe _ZN8GPCamera23convertSettingsToObjectEbP10_GPContextRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE8TreeNodeNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEE + 558
7 gphoto2.node 0x0000000103bd9fbe _ZN8GPCamera23convertSettingsToObjectEbP10_GPContextRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE8TreeNodeNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEE + 558
8 gphoto2.node 0x0000000103bd9445 _ZN8GPCamera17Async_GetConfigCbEP9uv_work_si + 113
9 node 0x000000010074ea14 uv__work_done + 176
10 node 0x0000000100751e5f uv__async_io + 277
11 node 0x0000000100761ae9 uv__io_poll + 1694
12 node 0x00000001007522f3 uv_run + 320
13 node 0x0000000100041f06 _ZN4node5StartEPN2v87IsolateEPNS_11IsolateDataERKNSt3__16vectorINS5_12basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEENSA_ISC_EEEESG_ + 946
14 node 0x0000000100041026 _ZN4node5StartEP9uv_loop_sRKNSt3__16vectorINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS7_IS9_EEEESD_ + 329
15 node 0x0000000100040ce1 _ZN4node5StartEiPPc + 681
16 libdyld.dylib 0x00007fff738543d5 start + 1
17 ??? 0x0000000000000002 0x0 + 2
Segmentation fault: 11
Steps taken to getting this error:
console.info('Getting camera config for', camera.model);
// get configuration tree
camera.getConfig((err, settings) => {
if (err) {
console.error(err);
} else {
console.log(settings);
}
});
About PC Shoot Mode:
My best understanding of this mode and why I'm using it is – if it's on, I can take a picture but hit a segfault while getting the configuration. If it's off, I can get the configuration but then cannot take a picture because the "option is not supported."
More reading into the manual and as stated before, this mode is a tethered mode and works well for saving pictures to computer but it seems the FujiFilm does not save photos to the card if using this mode and only works when turned on even if your camera is connected via USB.
Most likely, I will not be able to utilize all the intended functionality of gphoto2 since my camera doesn't allow for saving to the card directly; however, as @Sija indicated, I've still run into a bug here so I wanted to bring it to your attention. My hope is that the information provided and the segfault trace can help you track down the bug and prevent the segfault from occurring at the very least even if I won't be able to take pictures and get the configuration at the same time.
For those with other cameras receiving similar issues, I recommend adding the same package to your script and posting your results to help the devs out.
Attached is also a log created by segfault-handler.
Best,
I am having a similar crash with a Nikon D600:
gphoto2 2.5.20 gcc, popt(m), exif, cdk, aa, jpeg, readline
libgphoto2 2.5.23 all camlibs, gcc, ltdl, EXIF
libgphoto2_port 0.12.0 iolibs: disk ptpip serial usb1 usbdiskdirect usbscsi, gcc, ltdl, USB, serial without locking
ptp_usb_getresp [usb.c:514] PTP_OC 0x1002 receiving resp failed: PTP Session Already Opened (0x201e)
camera_init [library.c:8474] 'ptp_opensession (params, sessionid)' failed: PTP Session Already Opened (0x201e)
gp_widget_set_value [gphoto2-widget.c:386] Invalid parameters: 'widget && value' is NULL/FALSE.
gp_widget_set_value [gphoto2-widget.c:386] Invalid parameters: 'widget && value' is NULL/FALSE.
_get_config [config.c:8701] Type of property 'ISO Auto Hi Limit' expected: 0x0001 got: 0x0002
_get_config [config.c:8701] Type of property 'Active D-Lighting' expected: 0x0001 got: 0x0002
_get_config [config.c:8701] Type of property 'High ISO Noise Reduction' expected: 0x0001 got: 0x0002
_get_config [config.c:8701] Type of property 'HDR Mode' expected: 0x0002 got: 0x0001
_get_config [config.c:8701] Type of property 'Flash Exposure Compensation' expected: 0x0002 got: 0x0001
gp_widget_set_value [gphoto2-widget.c:386] Invalid parameters: 'widget && value' is NULL/FALSE.
gp_widget_set_value [gphoto2-widget.c:386] Invalid parameters: 'widget && value' is NULL/FALSE.
gp_widget_set_value [gphoto2-widget.c:386] Invalid parameters: 'widget && value' is NULL/FALSE.
gp_widget_set_value [gphoto2-widget.c:386] Invalid parameters: 'widget && value' is NULL/FALSE.
PID 26811 received SIGSEGV for address: 0x0 /home/brett/Devel/node-gphoto2/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x2e07)[0x7eff6d619e07] /lib/x86_64-linux-gnu/libpthread.so.0(+0x12730)[0x7eff70026730] /lib/x86_64-linux-gnu/libc.so.6(+0x15c181)[0x7eff6ffaf181] /usr/lib/x86_64-linux-gnu/libnode.so.64(_ZN2v86String11NewFromUtf8EPNS_7IsolateEPKcNS_13NewStringTypeEi+0xc5)[0x7eff730084c5] /home/brett/Devel/node-gphoto2/node_modules/gphoto2/build/Release/gphoto2.node(_ZN8GPCamera14getWidgetValueEP10_GPContextP13_CameraWidget+0x3c8)[0x7eff73dcd4b8] /home/brett/Devel/node-gphoto2/node_modules/gphoto2/build/Release/gphoto2.node(_ZN8GPCamera23convertSettingsToObjectEbP10_GPContextRKSt3mapINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE8TreeNodeSt4lessIS8_ESaISt4pairIKS8_S9_EEE+0x175)[0x7eff73dcde15] /home/brett/Devel/node-gphoto2/node_modules/gphoto2/build/Release/gphoto2.node(_ZN8GPCamera23convertSettingsToObjectEbP10_GPContextRKSt3mapINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE8TreeNodeSt4lessIS8_ESaISt4pairIKS8_S9_EEE+0x412)[0x7eff73dce0b2] /home/brett/Devel/node-gphoto2/node_modules/gphoto2/build/Release/gphoto2.node(_ZN8GPCamera23convertSettingsToObjectEbP10_GPContextRKSt3mapINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE8TreeNodeSt4lessIS8_ESaISt4pairIKS8_S9_EEE+0x412)[0x7eff73dce0b2] /home/brett/Devel/node-gphoto2/node_modules/gphoto2/build/Release/gphoto2.node(_ZN8GPCamera17Async_GetConfigCbEP9uv_work_si+0x80)[0x7eff73dcca70] /usr/lib/x86_64-linux-gnu/libuv.so.1(uv__work_done+0xad)[0x7eff7261c72d] /usr/lib/x86_64-linux-gnu/libuv.so.1(+0x109e8)[0x7eff726209e8] /usr/lib/x86_64-linux-gnu/libuv.so.1(uvio_poll+0x320)[0x7eff72630690] /usr/lib/x86_64-linux-gnu/libuv.so.1(uv_run+0x115)[0x7eff72621365] /usr/lib/x86_64-linux-gnu/libnode.so.64(_ZN4node5StartEPN2v87IsolateEPNS_11IsolateDataERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISBEESF+0x515)[0x7eff72e45a35] /usr/lib/x86_64-linux-gnu/libnode.so.64(_ZN4node5StartEiPPc+0x571)[0x7eff72e43b51] node(main+0xc4)[0x401134] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb)[0x7eff6fe7709b] node(_start+0x2a)[0x40119a] Segmentation fault
I am having troubles with segmentations / bus errors.
Installed packages:
and
The difference to the problems of the others, the error only occurs when no camera is connected. When a camera is connected, it works without problems so far.
PID 97232 received SIGSEGV for address: 0x40008
0 segfault-handler.node 0x0000000102e890ca _ZL16segfault_handleriP9__siginfoPv + 298
1 libsystem_platform.dylib 0x00007ff81e0b0dfd _sigtramp + 29
2 ??? 0x0000000000000210 0x0 + 528
3 node 0x00000001008a57a7 uv__io_poll + 1739
4 node 0x0000000100895276 uv_run + 336
5 node 0x00000001000b48cc _ZN4node16NodeMainInstance3RunEv + 458
6 node 0x000000010005b750 _ZN4node5StartEiPPc + 294
7 dyld 0x000000010cb4d51e start + 462
is produced by the following code:
const GPhoto = new gphoto2.GPhoto2();
let camera = undefined;
GPhoto.list(function (list) {
if (list.length === 0) return;
camera = list[0];
console.log('[GPhoto] Found camera: ', camera.model)
});
Same here. Nikon D7100 and camera.getConfig(function (er, settings) {}) - segmentation fault.
I am also experiencing this camera hanging after several hours of running takePicture(). But I also experienced the same hanging with DigiCamControl software, so I think this is just a buggy camera model.
Hi, I just wanted to test this library, which is a great idea by the way, and caught a segmentation fault error there