Tethered shooting with libgphoto2

Jon Chelton <[email protected]> Fri, 7 Nov 2025 22:21:25 +0000
Newsgroups gmane.comp.multimedia.gphoto.user
Message-ID <SA3PR05MB10345F50B45CB6964C4409242F6C3A@SA3PR05MB10345.namprd05.prod.outlook.com>
--===============1718648822501546168==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_SA3PR05MB10345F50B45CB6964C4409242F6C3ASA3PR05MB10345na_"

--_000_SA3PR05MB10345F50B45CB6964C4409242F6C3ASA3PR05MB10345na_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

I am working on a node module for tethered shooting with libgphoto2,   its =
working for the most part, but in my event loop this code


CameraEventType evtype;
void* evtdata =3D nullptr;
int rc;
{
  std::unique_lock<std::mutex> lk(st->gpMutex);
  rc =3D gp_camera_wait_for_event(st->camera, st->scanIntervalMs, &evtype, =
&evtdata, g_ctx);
}
if (rc !=3D GP_OK) {
  if (st->debug) dbg_printf("wait_for_event error rc=3D%d", rc);
  emit_error(st, rc, "gp_camera_wait_for_event failed");
  st->running =3D false;
  if (evtdata) free(evtdata);
  break;
}

sometimes returns with GP_ERROR_IO after successfully transferring several =
photos (compared to GP_ERROR when i just disconnect the cable).    There is=
 nothing interesting in dmesg when the error occurs.

Would would cause (GP_ERROR_IO).   For reference it is a Canon R50 connecte=
d to a raspberry pi over a 12=92 USB-C to USB-A cable.

Is this error recoverable and can I continue the event loop or how to recov=
er from it?

Thanks,
Jon

--_000_SA3PR05MB10345F50B45CB6964C4409242F6C3ASA3PR05MB10345na_
Content-Type: text/html; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
252">
</head>
<body>
<div dir=3D"ltr">
<div dir=3D"ltr" style=3D"font-family: Aptos, Arial, Helvetica, sans-serif;=
 font-size: 12pt; color: rgb(0, 0, 0);">
I am working on a node module for tethered shooting with libgphoto2, &nbsp;=
 its working for the most part, but in my event loop this code</div>
<div dir=3D"ltr" style=3D"font-family: Aptos, Arial, Helvetica, sans-serif;=
 font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"background-color: rgb(255, 255, 255);">
<pre><div style=3D"text-align: left; text-indent: 0px; font-family: &quot;J=
etBrains Mono&quot;, monospace; font-size: 9.8pt;"><span style=3D"color: rg=
b(0, 0, 0);">CameraEventType evtype;<br></span><span style=3D"color: rgb(0,=
 0, 128);"><b>void</b></span><span style=3D"color: rgb(0, 0, 0);">* evtdata=
 =3D nullptr;<br></span><span style=3D"color: rgb(0, 0, 128);"><b>int </b><=
/span><span style=3D"color: rgb(0, 0, 0);">rc;<br>{<br> &nbsp;std::unique_l=
ock&lt;std::mutex&gt; lk(st</span><span style=3D"color: rgb(0, 102, 102);">=
<b>-&gt;</b></span><span style=3D"color: rgb(0, 0, 0);">gpMutex);<br> &nbsp=
;rc =3D gp_camera_wait_for_event(st</span><span style=3D"color: rgb(0, 102,=
 102);"><b>-&gt;</b></span><span style=3D"color: rgb(0, 0, 0);">camera, st<=
/span><span style=3D"color: rgb(0, 102, 102);"><b>-&gt;</b></span><span sty=
le=3D"color: rgb(0, 0, 0);">scanIntervalMs, &amp;evtype, &amp;evtdata, g_ct=
x);<br>}<br></span><span style=3D"color: rgb(0, 0, 128);"><b>if </b></span>=
<span style=3D"color: rgb(0, 0, 0);">(rc !=3D GP_OK) {<br> &nbsp;</span><sp=
an style=3D"color: rgb(0, 0, 128);"><b>if </b></span><span style=3D"color: =
rgb(0, 0, 0);">(st</span><span style=3D"color: rgb(0, 102, 102);"><b>-&gt;<=
/b></span><span style=3D"color: rgb(0, 0, 0);">debug) dbg_printf(</span><sp=
an style=3D"color: rgb(0, 128, 0);"><b>&quot;wait_for_event error rc=3D%d&q=
uot;</b></span><span style=3D"color: rgb(0, 0, 0);">, rc);<br> &nbsp;emit_e=
rror(st, rc, </span><span style=3D"color: rgb(0, 128, 0);"><b>&quot;gp_came=
ra_wait_for_event failed&quot;</b></span><span style=3D"color: rgb(0, 0, 0)=
;">);<br> &nbsp;st</span><span style=3D"color: rgb(0, 102, 102);"><b>-&gt;<=
/b></span><span style=3D"color: rgb(0, 0, 0);">running =3D </span><span sty=
le=3D"color: rgb(0, 0, 128);"><b>false</b></span><span style=3D"color: rgb(=
0, 0, 0);">;<br> &nbsp;</span><span style=3D"color: rgb(0, 0, 128);"><b>if =
</b></span><span style=3D"color: rgb(0, 0, 0);">(evtdata) free(evtdata);<br=
> &nbsp;</span><span style=3D"color: rgb(0, 0, 128);"><b>break</b></span><s=
pan style=3D"color: rgb(0, 0, 0);">;<br>}</span></div></pre>
</div>
<div dir=3D"ltr" style=3D"font-family: Aptos, Arial, Helvetica, sans-serif;=
 font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div dir=3D"ltr"><span style=3D"font-family: Aptos, Arial, Helvetica, sans-=
serif; font-size: 12pt; color: rgb(0, 0, 0);">sometimes returns with
</span><span style=3D"font-family: -webkit-standard; font-size: 16px;">GP_E=
RROR_IO after
</span><span style=3D"font-family: -webkit-standard;">successfully</span><s=
pan style=3D"font-family: -webkit-standard; font-size: 16px;">&nbsp;transfe=
rring&nbsp;several photos (compared to
</span><span style=3D"font-family: -webkit-standard; font-size: 16px; color=
: rgb(0, 0, 0);">GP_ERROR when i just disconnect the cable). &nbsp; &nbsp;T=
here is nothing interesting in dmesg when the error occurs.&nbsp;</span></d=
iv>
<div dir=3D"ltr" style=3D"font-family: -webkit-standard; font-size: 16px; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div dir=3D"ltr" style=3D"font-family: -webkit-standard;">Would would cause=
 (GP_ERROR_IO). &nbsp; For reference it is a Canon R50 connected to a raspb=
erry pi over a 12=92 USB-C to USB-A cable. &nbsp; &nbsp;</div>
<div dir=3D"ltr" style=3D"font-family: -webkit-standard;"><br>
</div>
<div dir=3D"ltr" style=3D"font-family: -webkit-standard; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
Is this error recoverable and can I continue the event loop or how to recov=
er from it?</div>
<div dir=3D"ltr" style=3D"font-family: -webkit-standard; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div dir=3D"ltr" style=3D"font-family: -webkit-standard; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
Thanks,</div>
<div dir=3D"ltr" style=3D"font-family: -webkit-standard; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
Jon</div>
</div>
</body>
</html>

--_000_SA3PR05MB10345F50B45CB6964C4409242F6C3ASA3PR05MB10345na_--


--===============1718648822501546168==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============1718648822501546168==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Gphoto-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gphoto-user

--===============1718648822501546168==--