From: Philip L. <ph...@ov...> - 2018-05-25 03:06:11
|
On Wed, 23 May 2018 10:12:59 +0200 Andrea Vai <and...@un...> wrote: > Hi Phil, > thank you, it works. I tested it and: > > 1) The example does not show any error, it simply lists the "failing" > directory (*but doesn't show its content (124 files)*), delays for 60 > seconds, and then continues with the other directories and their > content. > > 2) I double-checked again in Nautilus (mount the device and open the > folder) and the error triggers. > > 3) Then, I removed one file from the test directory, and the example > script shows the tree including the directory content (123 files) > without any delay. > > 4) Then I put one additional file back in the directory, changed the > timeout in libmtp.c to 10 seconds, recompiled it, tried again with the > example script and obtained the same behavior as in 1) except from the > delay, that now was 10 seconds, as I expected, assuming that that part > of the code was ran, only the error message is not shown. > > Looking forward for more testing instructions, Hi Andrea, Well, we're getting deeper and deeper into this and it's still at all clear to me what is failing. Maybe Marcus can offer some insights. At this stage, you need to start digging into the actual request response sequence and see when the failure is occurring. So, in ptp.c we have ptp_getobjecthandles, which works by setting the command parameters and then calling ptp_transaction which in turn uses ptp_transaction_new. ptp_getobjecthandles is a GETDATA type transaction (no surprises). So what we see is there's a sendreq_func call, then a getdata_func call and then a getresp_func call. Based on the symptoms so far, I'm pretty confident that it's getdata_func that is erroring, but you should verify this with some additional logging. Now, the getdata_func is a function pointer and the actual implementation will be in libusb1_glue.c and is called ptp_usb_getdata. In this you'll see that it's repeatedly calling ptp_usb_getpacket to get one packet of data at a time. You'll also see some weird workarounds for various bugs related to receiving data on certain devices. If we ever work out what it's doing weird for your phone, we'll presumably have some new workaround in here. My guess is that you'll see ptp_usb_getpacket (which in turn calls ptp_read_func which calls USB_BULK_READ) work a few times and then block and timeout. I'll stop there to avoid too much speculation; let's see what really happens. --phil |