hanwen / go-mtpfs

Mount MTP devices over FUSE
Other
683 stars 85 forks source link

Progress callback for SendObject and GetObject #153

Open ganeshrvel opened 4 years ago

ganeshrvel commented 4 years ago

I am trying to upload/download files using MTP but I couldn't find any callbacks for receiving the progress.

Is there a way to get the progress information for SendObject and GetObject?

hanwen commented 4 years ago

not currently.

ganeshrvel commented 4 years ago

Could you suggest me a way to get the progress information?

What files or functions should I work on to get the file transfer progress?

hanwen commented 4 years ago

are you using FUSE or just the MTP part ? what kind of progress do you want (console, graphics)? Should it be timed (every 100ms) or by throughput (say every 100kb)?

The easiest is probably to insert somehting in bulkRead/bulkWrite (mtp.go). That doesnt cover the request/response metadata, though.

ganeshrvel commented 4 years ago

are you using FUSE or just the MTP part I am using mtp package for building a application library. Not using FUSE whatsoever

what kind of progress do you want (console, graphics) it's not a console program, so just progress values should do fine.

Should it be timed (every 100ms) or by throughput (say every 100kb) timed

The easiest is probably to insert somehting in bulkRead/bulkWrite (mtp.go). That doesnt cover the request/response metadata, though. So I suppose I will have to split the object into chunks and send them.

I have a question in that case: how do I get the timed progress? I don't see any callback functions for the same.

Thanks

hanwen commented 4 years ago

the MTP library already does the chunking. You just have to add a callback there. If you want timed output, add a GetCount() uint64 function and call that on a timer while the transaction is running.

ganeshrvel commented 4 years ago

Got it. Thanks!