usb: use bincode for conversions between message header struct and raw bytes
Changes
- Added an
ADBUsbMessageHeaderstruct without the payload and implementSerializeandDeserializeon it. - Replaced
to_bytesmethod body to usebincode::serialize - Made the
try_frommethod usebincode::deserialize. Note: We're using unwraps so far, we need to add an error variant for invalid bytes. - The
USBCommandenum variants equal their respective values.- The enum has a
#[repr(u32)]for the underlying type. - The
to_u32method has been removed in favor of theas u32since the enum is a primitive now.
- The enum has a
I rebased usb branch on this one as there were merge conflicts due to previous PR merge.
I cannot make it work, get stuck with logs:
written 24
writing payload...
written 18
written 24
writing payload...
written 0
Error: Operation timed out
Can you have a look at it please ? Thanks !
Yes, I'll look into it.
The C like enum USBCommand with its non-sequential variants was being encoded as a zero indexed enum. Fixed it with serde_repr
Hi, there are a lot of conflicts with the changes I've made and upstream usb. Would you like me to rebase and one-shot this and force-push? It would be easier for me since I'd have an lsp for sanity checks.
Yes, please !
I had a look into it and did not manage to make it work, maybe it'll work with the new version of usb branch
Okay, I have made the necessary changes and have tested them on my device. Let me know if you want me to implement the adb pull command. I have a local branch with that already implemented!
Thanks for the rebase ! I'll check it tomorrow :)
You can of course create a new PR with pull support, I'd like to merge the usb branch in master as soon as possible and this is a feature I'm yet missing