Hello,
I've been working with USB host APIs in order to interface with adb on a connected device, and through trial and error, I've been mostly successful. I've been able to transfer data through the file sync service, but there are a few small details I've yet to pinpoint. I've successfully transferred a small file but I now need to transfer something larger (approximately 660kb). The issue I'm having is the setting the size in the following four bytes after defining the message when sending a message that requires multiple chunks. I'm able to initiate the send sequence and transfer data up to approximately 64kb (65544 bytes including the DATA message), and it appears to give me a FAIL message with the reason "invalid data message". I've grepped through the source and found that this message corresponds to one of three different messages, two of which give reasons, and one doesn't.
The ADB_TRACE variable and strace in bash has shown the structure of the message that adb push uses, and I've determined the structure of the message i need to send, however the service doesn't seem to accept it. I've compiled adb for linux-x86 and tried to find the answer with some debug statements, but nothing that's working.
All that being said, I believe my question is: How do I structure a data message that has to be split into several messages? I've applied some trial and error to the messages and it is the 4 bytes after the ID_DATA message that control that size, however I've tried specifying the length in hex as I do the previous messages, but it still chokes out at the same point. If I set that size to an arbitrarily high number, it will spit the first write back at me and tell me that the data message is over sized.
In the source, a companion document (named SYNC.TXT) is mentioned in the services document (SERVICES.TXT) that seems to outline the nuances of the file sync service, but I can't find it in any of the sources/branch history. I'm not sure if this document has the answer, but it would be nice to see it.
Thank You,
Nicholas