From 7604eabe231417752ae989bd32c7b329f9f5b1a8 Mon Sep 17 00:00:00 2001 From: vhaudiquet Date: Sat, 23 Sep 2023 17:12:25 +0200 Subject: [PATCH] driver: g-wolves htx refactor --- drivers/g-wolves/htx/htx.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/g-wolves/htx/htx.c b/drivers/g-wolves/htx/htx.c index 76c612b..9d15cd3 100644 --- a/drivers/g-wolves/htx/htx.c +++ b/drivers/g-wolves/htx/htx.c @@ -75,7 +75,7 @@ struct HTX_REPORT_UNKNOWN_0 uint8_t value0; uint8_t value1; - uint8_t zeros[64 - sizeof(htx_report_header_t) - 2]; + uint8_t zeros[REPORT_MAX_SIZE - sizeof(htx_report_header_t) - 2]; } __attribute__((packed)); struct HTX_REPORT_UNKNOWN_1 @@ -85,7 +85,7 @@ struct HTX_REPORT_UNKNOWN_1 uint8_t value0; uint8_t value1; - uint8_t zeros[64 - sizeof(htx_report_header_t) - 2]; + uint8_t zeros[REPORT_MAX_SIZE - sizeof(htx_report_header_t) - 2]; } __attribute__((packed)); struct HTX_REPORT_CLICK_DEBOUNCE_SETTINGS @@ -98,7 +98,7 @@ struct HTX_REPORT_CLICK_DEBOUNCE_SETTINGS uint8_t auto_high; // 0x23 for manual, 0x3C for auto uint8_t auto_low; // 0x14 for manual, 0x28 for auto - uint8_t zeros[64 - 8]; + uint8_t zeros[REPORT_MAX_SIZE - 8]; } __attribute__((packed)); struct HTX_REPORT_LIFT_OFF @@ -108,7 +108,7 @@ struct HTX_REPORT_LIFT_OFF // 1 = Low, 2 = High uint8_t lift_off; - uint8_t zeros[64 - sizeof(htx_report_header_t) - 1]; + uint8_t zeros[REPORT_MAX_SIZE - sizeof(htx_report_header_t) - 1]; } __attribute__((packed)); struct HTX_REPORT_ANGLE_SNAP @@ -118,7 +118,7 @@ struct HTX_REPORT_ANGLE_SNAP // 0 = disabled, 1 = enabled uint8_t angle_snap; - uint8_t zeros[64 - sizeof(htx_report_header_t) - 1]; + uint8_t zeros[REPORT_MAX_SIZE - sizeof(htx_report_header_t) - 1]; } __attribute__((packed)); struct HTX_REPORT_MOTION_SYNC @@ -127,7 +127,7 @@ struct HTX_REPORT_MOTION_SYNC uint8_t motion_sync; - uint8_t zeros[64 - sizeof(htx_report_header_t) - 1]; + uint8_t zeros[REPORT_MAX_SIZE - sizeof(htx_report_header_t) - 1]; } __attribute__((packed)); struct HTX_REPORT_UNKNOWN_6 @@ -141,7 +141,7 @@ struct HTX_REPORT_UNKNOWN_6 uint8_t value4; uint8_t value5; - uint8_t zeros[64 - sizeof(htx_report_header_t) - 5]; + uint8_t zeros[REPORT_MAX_SIZE - sizeof(htx_report_header_t) - 5]; } __attribute__((packed)); struct HTX_REPORT_BATTERY @@ -150,6 +150,8 @@ struct HTX_REPORT_BATTERY uint8_t battery_status; // 0 : not charging, 1 : charging uint8_t battery_level; // in % + + uint8_t zeros[REPORT_MAX_SIZE - sizeof(htx_report_header_t) - 2]; } __attribute__((packed)); static int htx_send_command(libusb_device_handle* hand, uint8_t command, uint8_t size, void* report)