Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modified file on the mtp responder side, but the PC can not refresh at the same time.(maybe I solved this problem by change the code) #51

Closed
woshizhy opened this issue Dec 25, 2020 · 4 comments

Comments

@woshizhy
Copy link
Contributor

woshizhy commented Dec 25, 2020

for example:
1)create a file on mtp responder:
echo hello1 > hello.txt

2)watch the file on PC,it's good to find the hello.txt and it's content is : hello1.

3)append some content to the hello.txt file on mtp responder:
echo hello2 >> hello.txt

4)watch the file on PC,but the content is keep to : hello1.

5)append some content to the hello.txt file on mtp responder:
echo hello3 >> hello.txt

6)watch the file on PC,and the content is change to : hello. hello2.

....

can you verification this problem please?

Thank you, good life to you.


Hello
maybe I sovled this problem by change the source code(just add one line):

the file: src/mtp_properties.c

and the function:
int build_objectproplist_dataset(mtp_ctx * ctx, void * buffer, int maxsize,fs_entry * entry, uint32_t handle,uint32_t format_id, uint32_t prop_code, uint32_t prop_group_code, uint32_t depth)
{
...

if(path)
{
	ret = stat64(path, &entrystat);
}

if(ret)
{
	if(path)
		free(path);
	return 0;
}

++ /* update the file size infomation */
++ entry->size = entrystat.st_size;

...
}

Are you agree?

Thanks, wish you a happy life.

@woshizhy woshizhy changed the title modified file on the mtp responder side, but the PC can not refresh at the same time. modified file on the mtp responder side, but the PC can not refresh at the same time.(maybe I solved this problem by change the code) Dec 26, 2020
@jfdelnero
Copy link
Member

jfdelnero commented Dec 27, 2020

Hello,

Thanks for the patch, this appears fine.

Have you successfully tried it ? If so, please make a pull-request.

Thanks !

(Just for record, which client operating system have you tried ?)

@woshizhy
Copy link
Contributor Author

Hello.

First, thank you for your reply.

The client operating system I have : win7, win10, and my android-10 phone.

And I passed the verification on win7 and win10, but the android-10 phone is not successfully.

@woshizhy
Copy link
Contributor Author

Hello.

And I tried the following experiments:
using another android phone as the MTP responder to connect my android-10 phone,
and whether it's creating a new file or modifying a file on the MTP responder, my android-10 do not update.
(Note: if using your uMTP-Responder for the experiment, when I created a new file or modify a file at mtp responder side, it always take the initiative to report related events to the MTP Initiator. And I know that situation by open the debug log.)

So, I believe that the android os system support for MTP Initiator is not perfect, and it's not about your MTP responder.

Do you agree?

Thanks, wish you a happy life.

@jfdelnero
Copy link
Member

Yes i agree. I know that some MTP Initiators have some issues with the events coming from the device.

Thanks for the PR/patch and tests, this is now in the sources !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants