driver: g-wolves added static asserts for struct

master
vhaudiquet 1 year ago
parent 3e7db63e74
commit 0db4e4ee08
  1. 12
      drivers/g-wolves/g-wolves.h

@ -71,6 +71,7 @@ struct REPORT_DPI_SETTINGS
dpi_level_t levels[5]; dpi_level_t levels[5];
uint8_t zeros[23]; uint8_t zeros[23];
} __attribute__((packed)); } __attribute__((packed));
_Static_assert(sizeof(struct REPORT_DPI_SETTINGS) == REPORT_MAX_SIZE, "Report DPI_SETTINGS not of right size");
struct REPORT_UNKNOWN_0 struct REPORT_UNKNOWN_0
{ {
@ -81,6 +82,7 @@ struct REPORT_UNKNOWN_0
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 2]; uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 2];
} __attribute__((packed)); } __attribute__((packed));
_Static_assert(sizeof(struct REPORT_UNKNOWN_0) == REPORT_MAX_SIZE, "Report UNKNOWN_0 not of right size");
struct REPORT_UNKNOWN_1 struct REPORT_UNKNOWN_1
{ {
@ -91,6 +93,7 @@ struct REPORT_UNKNOWN_1
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 2]; uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 2];
} __attribute__((packed)); } __attribute__((packed));
_Static_assert(sizeof(struct REPORT_UNKNOWN_1) == REPORT_MAX_SIZE, "Report UNKNOWN_1 not of right size");
struct REPORT_CLICK_DEBOUNCE_SETTINGS struct REPORT_CLICK_DEBOUNCE_SETTINGS
{ {
@ -104,6 +107,7 @@ struct REPORT_CLICK_DEBOUNCE_SETTINGS
uint8_t zeros[REPORT_MAX_SIZE - 8]; uint8_t zeros[REPORT_MAX_SIZE - 8];
} __attribute__((packed)); } __attribute__((packed));
_Static_assert(sizeof(struct REPORT_CLICK_DEBOUNCE_SETTINGS) == REPORT_MAX_SIZE, "Report CLICK_DEBOUNCE_SETTINGS not of right size");
struct REPORT_LIFT_OFF struct REPORT_LIFT_OFF
{ {
@ -114,6 +118,7 @@ struct REPORT_LIFT_OFF
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 1]; uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 1];
} __attribute__((packed)); } __attribute__((packed));
_Static_assert(sizeof(struct REPORT_LIFT_OFF) == REPORT_MAX_SIZE, "Report LIFT_OFF not of right size");
struct REPORT_ANGLE_SNAP struct REPORT_ANGLE_SNAP
{ {
@ -124,6 +129,7 @@ struct REPORT_ANGLE_SNAP
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 1]; uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 1];
} __attribute__((packed)); } __attribute__((packed));
_Static_assert(sizeof(struct REPORT_ANGLE_SNAP) == REPORT_MAX_SIZE, "Report ANGLE_SNAP not of right size");
struct REPORT_MOTION_SYNC struct REPORT_MOTION_SYNC
{ {
@ -133,6 +139,7 @@ struct REPORT_MOTION_SYNC
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 1]; uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 1];
} __attribute__((packed)); } __attribute__((packed));
_Static_assert(sizeof(struct REPORT_MOTION_SYNC) == REPORT_MAX_SIZE, "Report MOTION_SYNC not of right size");
struct REPORT_UNKNOWN_6 struct REPORT_UNKNOWN_6
{ {
@ -145,8 +152,9 @@ struct REPORT_UNKNOWN_6
uint8_t value4; uint8_t value4;
uint8_t value5; uint8_t value5;
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 5]; uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 6];
} __attribute__((packed)); } __attribute__((packed));
_Static_assert(sizeof(struct REPORT_UNKNOWN_6) == REPORT_MAX_SIZE, "Report UNKNOWN_6 not of right size");
struct REPORT_BATTERY struct REPORT_BATTERY
{ {
@ -157,6 +165,7 @@ struct REPORT_BATTERY
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 2]; uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 2];
} __attribute__((packed)); } __attribute__((packed));
_Static_assert(sizeof(struct REPORT_BATTERY) == REPORT_MAX_SIZE, "Report BATTERY not of right size");
struct REPORT_WIRELESS struct REPORT_WIRELESS
{ {
@ -165,3 +174,4 @@ struct REPORT_WIRELESS
uint8_t mouse_connected; // 0 if disconnected, else 1 uint8_t mouse_connected; // 0 if disconnected, else 1
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 1]; uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 1];
} __attribute__((packed)); } __attribute__((packed));
_Static_assert(sizeof(struct REPORT_WIRELESS) == REPORT_MAX_SIZE, "Report WIRELESS not of right size");

Loading…
Cancel
Save