From: Andrea V. <and...@un...> - 2018-05-25 09:45:31
|
Il giorno gio, 24/05/2018 alle 20.05 -0700, Philip Langdale ha scritto: > > 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. Hi Phil, thanks for your clarification. I have managed to have the evidence that the code runs in some part, adding to the code itself some printf instructions which output some debug lines to the terminal output. What I have discovered so far (not much, I suppose), when the script (mtp-filetree) accesses the failing directory: - the directory name (and a number on the left, are we interested in it?) is displayed; - sendreq_func is called; - getdata_func is called; - php_usb_getdata is called; - the following directory is displayed. Comparing it to two test directories I created: - Directory with 2 files inside: - the directory name (and a number on the left) is displayed; - the following happen 5 times: - sendreq_func is called; - getdata_func is called; - php_usb_getdata is called; - each file in the directory is displayed (along with a number on the left); - the following directory is displayed. - Directory with 5 files inside: - the directory name (and a number on the left) is displayed; - the following happen 11 times: - sendreq_func is called; - getdata_func is called; - php_usb_getdata is called; - each file in the directory is displayed (along with a number on the left); - the following directory is displayed. Sorry if I give you useless or partial information, but please remember I am not an expert so I may need to be step-by-step guided a little bit. Please where do I need to spot some more? thank you, Bye Andrea |