modify USB communications

* use different data types for commands and responses
* use variable length responses
* maintain client/flasher compatibility with old format (e.g. when using old bootloader)
* maintain bootloader compatibility with old format (e.g. when using old or RRG flasher.exe)
* fix length of version string in appmain.c
This commit is contained in:
pwpiwi 2020-01-12 17:29:07 +01:00
parent 867e10a5fd
commit b8ed9975e5
11 changed files with 133 additions and 64 deletions

View file

@ -25,6 +25,7 @@ typedef BYTE uint8_t;
#define USB_CMD_DATA_SIZE 512
// the packets sent from client to PM3
typedef struct {
uint64_t cmd;
uint64_t arg[3];
@ -34,6 +35,16 @@ typedef struct {
} d;
} PACKED UsbCommand;
// the packets sent from PM3 to client (a smaller version of UsbCommand)
typedef struct {
uint16_t cmd;
uint16_t datalen;
uint32_t arg[3];
union {
uint8_t asBytes[USB_CMD_DATA_SIZE];
uint32_t asDwords[USB_CMD_DATA_SIZE/4];
} d;
} PACKED UsbResponse;
// A struct used to send sample-configs over USB
typedef struct {
@ -226,6 +237,7 @@ typedef struct {
#define CMD_HF_SNIFFER 0x0800
#define CMD_HF_PLOT 0x0801
#define CMD_VARIABLE_SIZE_FLAG 0x8000
#define CMD_UNKNOWN 0xFFFF