I was getting repeatable timeout errors from Sony RX100M3 during file transfers over PTP/IP. I tracked it down to a file I modified on the SD card. It appears as timeout error triggers when the file size conflicts in a "smaller than" scenario with metadata. Possibly add a condition for "under size" error and suggest in the size errors that it could be a modified file on the SD card?
The function is `ptp_ptpip_getdata` (https://github.com/gphoto/libgphoto2/blob/29cb9da4206a15cfaa07194f7fc17a4417fc1bc8/camlibs/ptp2/ptpip.c#L307) And the logs (below) indicate it is processing a PTPIP_CMD_RESPONSE (07) packet in the while loop which I would have expected to bail after the PTPIP_END_DATA_PACKET(0c), but it will sit waiting until it receives enough data to match the size indicated by the PTP metadata (which is wrong in this case). The `curread` or`toread` comparison causes the while loop to hang triggering the 'PTP Timeout'. From some extra debug logs I added. When it processes the "ret type 7" error in the debug logs, it shows values: curread of 77860 and toread of 1048576. Even after a manual "database check", it still reports the wrong size value. Looks like the database may be out of sync with the filesystem. ➜ disk ls -l ./DCIM/100MSDCF/DSC09806.JPG -rwxr-xr-x. 1 achasen achasen 77860 Apr 27 2023 ./DCIM/100MSDCF/DSC09806.JPG Note to self, never write to the SD card. 0.000106 main (2): ALWAYS INCLUDE THE FOLLOWING LINES WHEN SENDING DEBUG MESSAGES TO THE MAILING LIST: 0.000130 main (2): gphoto2 2.5.28.1 0.000135 main (2): gphoto2 has been compiled with the following options: 0.000137 main (2): + gcc (C compiler used) 0.000139 main (2): + popt (mandatory, for handling command-line parameters) 0.000141 main (2): + exif (for displaying EXIF information) 0.000143 main (2): + no cdk (for accessing configuration options) 0.000144 main (2): + no aa (for displaying live previews) 0.000146 main (2): + jpeg (for displaying live previews in JPEG format) 0.000148 main (2): + no readline (for easy navigation in the shell) 0.000152 main (2): libgphoto2 2.5.31.1 0.000155 main (2): libgphoto2 has been compiled with the following options: 0.000157 main (2): + standard camlib set SKIPPING SOME (ax203 canon digigr8 dimagev directory jl2005a jl2005c kodak_dc240 mars pentax ptp2 ricoh_g3 sierra sonix sq905 st2205 topfield tp6801 SKIPPING docupen lumix) 0.000159 main (2): + gcc (C compiler used) 0.000161 main (2): + no ltdl (for portable loading of camlibs) 0.000163 main (2): + EXIF (for special handling of EXIF files) 0.000167 main (2): libgphoto2_port 0.12.2 0.000169 main (2): libgphoto2_port has been compiled with the following options: 0.000171 main (2): + iolibs: disk ptpip serial usb1 usbdiskdirect usbscsi 0.000172 main (2): + gcc (C compiler used) 0.000174 main (2): + no ltdl (for portable loading of iolibs) 0.000176 main (2): + EXIF (for vusb) 0.000178 main (2): + USB (libusb1, for USB cameras) 0.000191 main (2): + serial (for serial cameras) 0.000193 main (2): + no resmgr (serial port access and locking) 0.000195 main (2): + no ttylock (serial port locking) 0.000197 main (2): + no lockdev (serial port locking) 0.000199 main (2): CAMLIBS env var not set, using compile-time default instead 0.000201 main (2): IOLIBS env var not set, using compile-time default instead 0.000203 main (2): invoked with following arguments: 0.000205 main (2): --port 0.000207 main (2): ptpip:192.168.5.113 0.000209 main (2): --reverse 0.000210 main (2): --debug 0.000212 main (2): --debug-logfile=gphoto2-debug2.out 0.000215 main (2): -P 0.000218 main (2): --skip-existing ... 58.719268 lookup_folder_file (2): Lookup folder /store_00010001/2023-04-27 file DSC09806.JPG 58.719271 lookup_folder (2): Lookup folder '/store_00010001/2023-04-27'... 58.719275 gp_filesystem_get_file_impl (2): Downloading 'DSC09806.JPG' from folder '/store_00010001/2023-04-27'... 58.719280 ptp (2): (storage=0x00010001, handle=0x00000000) 58.719290 ptp (2): (storage=0x00010001, handle=0x01e40000) 58.719294 get_file_func (2): Getting file 'DSC09806.JPG'. 58.719299 ptp_ptpip_sendreq (2): Sending PTP_OC 0x101b (Get partial object) (0x1e40009,0x0,0x100000) request... 58.719361 ptp_ptpip_sendreq (3): ptpip/oprequest data: (hexdump of 30 bytes) 0000 1e 00 00 00 06 00 00 00-01 00 00 00 1b 10 fd 02 ................ 0010 00 00 09 00 e4 01 00 00-00 00 00 00 10 00 .............. 58.719376 ptp_ptpip_getdata (2): Reading PTP_OC 0x101b (Get partial object) data... 58.782656 ptp_ptpip_generic_read (3): ptpip/generic_read header: (hexdump of 8 bytes) 0000 14 00 00 00 09 00 00 00- ........ ... 58.916231 ptp_ptpip_generic_read (3): ptpip/generic_read header: (hexdump of 8 bytes) 0000 0c 00 00 00 0c 00 00 00- ........ 58.916237 ptp_ptpip_generic_read (3): ptpip/generic_read data: (hexdump of 4 bytes) 0000 fd 02 00 00 - .... 58.916295 ptp_ptpip_generic_read (3): ptpip/generic_read header: (hexdump of 8 bytes) 0000 12 00 00 00 07 00 00 00- ........ 58.916306 ptp_ptpip_generic_read (3): ptpip/generic_read data: (hexdump of 10 bytes) 0000 01 20 fd 02 00 00 24 30-01 00 . ....$0.. 58.916310 ptp_ptpip_getdata [ptpip.c:372](0): ret type 7 61.418068 get_file_func [library.c:8885](0): 'ptp_getpartialobject (params, oid, offset, xsize, &ximage, &xlen)' failed: 'PTP Timeout' (0x02fa) 61.418089 gp_context_error (0): PTP Timeout 61.418105 gp_filesystem_get_file (2): Download of 'DSC09806.JPG' from '/store_00010001/2023-04-27' (type 1) failed. Reason: 'Timeout reading from or writing to the port' 61.418111 gp_camera_file_get [gphoto2-camera.c:1677](0): 'gp_filesystem_get_file (camera->fs, folder, file, type, camera_file, context)' failed: -10 61.418457 gp_camera_free (2): Freeing camera... ... 61.501480 ptp_ptpip_getresp (2): Reading PTP_OC 0x1003 (Close session) response... 61.510127 ptp_ptpip_generic_read (3): ptpip/generic_read header: (hexdump of 8 bytes) 0000 0e 00 00 00 07 00 00 00- ........ 61.562567 ptp_ptpip_generic_read (3): ptpip/generic_read data: (hexdump of 6 bytes) 0000 01 20 ff 02 00 00 - . .... 61.562585 ptp_ptpip_getresp (2): PTPIP_CMD_RESPONSE (result=0x2001, tid=0x000002ff) 61.562641 ptp_ptpip_disconnect (2): ptpip disconnected! 61.562647 gp_port_close (2): Closing port... 61.562742 gp_filesystem_reset (2): resetting filesystem _______________________________________________ Gphoto-devel mailing list Gphoto-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gphoto-devel