Commit 4d043101 authored by Jiri Kosina's avatar Jiri Kosina

HID: roccat: don't use #pragma pack

Replace #pragma pack ocurences with __atribute__((__packed__));
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 47dbdbff
...@@ -14,17 +14,11 @@ ...@@ -14,17 +14,11 @@
#include <linux/types.h> #include <linux/types.h>
/*
* Binary data structures used for hardware communication must have no padding.
*/
#pragma pack(push)
#pragma pack(1)
struct kone_keystroke { struct kone_keystroke {
uint8_t key; uint8_t key;
uint8_t action; uint8_t action;
uint16_t period; /* in milliseconds */ uint16_t period; /* in milliseconds */
}; } __attribute__ ((__packed__));
enum kone_keystroke_buttons { enum kone_keystroke_buttons {
kone_keystroke_button_1 = 0xf0, /* left mouse button */ kone_keystroke_button_1 = 0xf0, /* left mouse button */
...@@ -47,7 +41,7 @@ struct kone_button_info { ...@@ -47,7 +41,7 @@ struct kone_button_info {
uint8_t macro_name[16]; /* can be max 15 chars long */ uint8_t macro_name[16]; /* can be max 15 chars long */
uint8_t count; uint8_t count;
struct kone_keystroke keystrokes[20]; struct kone_keystroke keystrokes[20];
}; } __attribute__ ((__packed__));
enum kone_button_info_types { enum kone_button_info_types {
/* valid button types until firmware 1.32 */ /* valid button types until firmware 1.32 */
...@@ -98,7 +92,7 @@ struct kone_light_info { ...@@ -98,7 +92,7 @@ struct kone_light_info {
uint8_t red; /* range 0x00-0xff */ uint8_t red; /* range 0x00-0xff */
uint8_t green; /* range 0x00-0xff */ uint8_t green; /* range 0x00-0xff */
uint8_t blue; /* range 0x00-0xff */ uint8_t blue; /* range 0x00-0xff */
}; } __attribute__ ((__packed__));
struct kone_profile { struct kone_profile {
uint16_t size; /* always 975 */ uint16_t size; /* always 975 */
...@@ -133,7 +127,7 @@ struct kone_profile { ...@@ -133,7 +127,7 @@ struct kone_profile {
struct kone_button_info button_infos[8]; struct kone_button_info button_infos[8];
uint16_t checksum; /* \brief holds checksum of struct */ uint16_t checksum; /* \brief holds checksum of struct */
}; } __attribute__ ((__packed__));
enum kone_polling_rates { enum kone_polling_rates {
kone_polling_rate_125 = 1, kone_polling_rate_125 = 1,
...@@ -150,7 +144,7 @@ struct kone_settings { ...@@ -150,7 +144,7 @@ struct kone_settings {
uint8_t calibration_data[4]; uint8_t calibration_data[4];
uint8_t unknown3[2]; uint8_t unknown3[2];
uint16_t checksum; uint16_t checksum;
}; } __attribute__ ((__packed__));
/* /*
* 12 byte mouse event read by interrupt_read * 12 byte mouse event read by interrupt_read
...@@ -166,7 +160,7 @@ struct kone_mouse_event { ...@@ -166,7 +160,7 @@ struct kone_mouse_event {
uint8_t event; uint8_t event;
uint8_t value; /* press = 0, release = 1 */ uint8_t value; /* press = 0, release = 1 */
uint8_t macro_key; /* 0 to 8 */ uint8_t macro_key; /* 0 to 8 */
}; } __attribute__ ((__packed__));
enum kone_mouse_events { enum kone_mouse_events {
/* osd events are thought to be display on screen */ /* osd events are thought to be display on screen */
...@@ -194,9 +188,7 @@ struct kone_roccat_report { ...@@ -194,9 +188,7 @@ struct kone_roccat_report {
uint8_t event; uint8_t event;
uint8_t value; /* holds dpi or profile value */ uint8_t value; /* holds dpi or profile value */
uint8_t key; /* macro key on overlong macro execution */ uint8_t key; /* macro key on overlong macro execution */
}; } __attribute__ ((__packed__));
#pragma pack(pop)
struct kone_device { struct kone_device {
/* /*
......
...@@ -14,12 +14,6 @@ ...@@ -14,12 +14,6 @@
#include <linux/types.h> #include <linux/types.h>
/*
* Binary data structures used for hardware communication must have no padding.
*/
#pragma pack(push)
#pragma pack(1)
/* /*
* case 1: writes request 80 and reads value 1 * case 1: writes request 80 and reads value 1
* *
...@@ -32,7 +26,7 @@ struct koneplus_control { ...@@ -32,7 +26,7 @@ struct koneplus_control {
*/ */
uint8_t value; uint8_t value;
uint8_t request; uint8_t request;
}; } __attribute__ ((__packed__));
enum koneplus_control_requests { enum koneplus_control_requests {
KONEPLUS_CONTROL_REQUEST_STATUS = 0x00, KONEPLUS_CONTROL_REQUEST_STATUS = 0x00,
...@@ -50,7 +44,7 @@ struct koneplus_startup_profile { ...@@ -50,7 +44,7 @@ struct koneplus_startup_profile {
uint8_t command; /* KONEPLUS_COMMAND_STARTUP_PROFILE */ uint8_t command; /* KONEPLUS_COMMAND_STARTUP_PROFILE */
uint8_t size; /* always 3 */ uint8_t size; /* always 3 */
uint8_t startup_profile; /* Range 0-4! */ uint8_t startup_profile; /* Range 0-4! */
}; } __attribute__ ((__packed__));
struct koneplus_profile_settings { struct koneplus_profile_settings {
uint8_t command; /* KONEPLUS_COMMAND_PROFILE_SETTINGS */ uint8_t command; /* KONEPLUS_COMMAND_PROFILE_SETTINGS */
...@@ -72,7 +66,7 @@ struct koneplus_profile_settings { ...@@ -72,7 +66,7 @@ struct koneplus_profile_settings {
uint8_t light_effect_speed; uint8_t light_effect_speed;
uint8_t lights[16]; uint8_t lights[16];
uint16_t checksum; uint16_t checksum;
}; } __attribute__ ((__packed__));
struct koneplus_profile_buttons { struct koneplus_profile_buttons {
uint8_t command; /* KONEPLUS_COMMAND_PROFILE_BUTTONS */ uint8_t command; /* KONEPLUS_COMMAND_PROFILE_BUTTONS */
...@@ -80,7 +74,7 @@ struct koneplus_profile_buttons { ...@@ -80,7 +74,7 @@ struct koneplus_profile_buttons {
uint8_t number; /* range 0-4 */ uint8_t number; /* range 0-4 */
uint8_t data[72]; uint8_t data[72];
uint16_t checksum; uint16_t checksum;
}; } __attribute__ ((__packed__));
struct koneplus_macro { struct koneplus_macro {
uint8_t command; /* KONEPLUS_COMMAND_MACRO */ uint8_t command; /* KONEPLUS_COMMAND_MACRO */
...@@ -89,31 +83,31 @@ struct koneplus_macro { ...@@ -89,31 +83,31 @@ struct koneplus_macro {
uint8_t button; /* range 0-23 */ uint8_t button; /* range 0-23 */
uint8_t data[2075]; uint8_t data[2075];
uint16_t checksum; uint16_t checksum;
}; } __attribute__ ((__packed__));
struct koneplus_info { struct koneplus_info {
uint8_t command; /* KONEPLUS_COMMAND_INFO */ uint8_t command; /* KONEPLUS_COMMAND_INFO */
uint8_t size; /* always 6 */ uint8_t size; /* always 6 */
uint8_t firmware_version; uint8_t firmware_version;
uint8_t unknown[3]; uint8_t unknown[3];
}; } __attribute__ ((__packed__));
struct koneplus_e { struct koneplus_e {
uint8_t command; /* KONEPLUS_COMMAND_E */ uint8_t command; /* KONEPLUS_COMMAND_E */
uint8_t size; /* always 3 */ uint8_t size; /* always 3 */
uint8_t unknown; /* TODO 1; 0 before firmware update */ uint8_t unknown; /* TODO 1; 0 before firmware update */
}; } __attribute__ ((__packed__));
struct koneplus_sensor { struct koneplus_sensor {
uint8_t command; /* KONEPLUS_COMMAND_SENSOR */ uint8_t command; /* KONEPLUS_COMMAND_SENSOR */
uint8_t size; /* always 6 */ uint8_t size; /* always 6 */
uint8_t data[4]; uint8_t data[4];
}; } __attribute__ ((__packed__));
struct koneplus_firmware_write { struct koneplus_firmware_write {
uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE */ uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE */
uint8_t unknown[1025]; uint8_t unknown[1025];
}; } __attribute__ ((__packed__));
struct koneplus_firmware_write_control { struct koneplus_firmware_write_control {
uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL */ uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL */
...@@ -123,18 +117,18 @@ struct koneplus_firmware_write_control { ...@@ -123,18 +117,18 @@ struct koneplus_firmware_write_control {
*/ */
uint8_t value; uint8_t value;
uint8_t unknown; /* always 0x75 */ uint8_t unknown; /* always 0x75 */
}; } __attribute__ ((__packed__));
struct koneplus_tcu { struct koneplus_tcu {
uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */ uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
uint8_t data[2]; uint8_t data[2];
}; } __attribute__ ((__packed__));
struct koneplus_tcu_image { struct koneplus_tcu_image {
uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */ uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
uint8_t data[1024]; uint8_t data[1024];
uint16_t checksum; uint16_t checksum;
}; } __attribute__ ((__packed__));
enum koneplus_commands { enum koneplus_commands {
KONEPLUS_COMMAND_CONTROL = 0x4, KONEPLUS_COMMAND_CONTROL = 0x4,
...@@ -177,7 +171,7 @@ struct koneplus_mouse_report_button { ...@@ -177,7 +171,7 @@ struct koneplus_mouse_report_button {
uint8_t data2; uint8_t data2;
uint8_t zero2; uint8_t zero2;
uint8_t unknown[2]; uint8_t unknown[2];
}; } __attribute__ ((__packed__));
enum koneplus_mouse_report_button_types { enum koneplus_mouse_report_button_types {
/* data1 = new profile range 1-5 */ /* data1 = new profile range 1-5 */
...@@ -211,9 +205,7 @@ struct koneplus_roccat_report { ...@@ -211,9 +205,7 @@ struct koneplus_roccat_report {
uint8_t data1; uint8_t data1;
uint8_t data2; uint8_t data2;
uint8_t profile; uint8_t profile;
}; } __attribute__ ((__packed__));
#pragma pack(pop)
struct koneplus_device { struct koneplus_device {
int actual_profile; int actual_profile;
......
...@@ -14,17 +14,11 @@ ...@@ -14,17 +14,11 @@
#include <linux/types.h> #include <linux/types.h>
/*
* Binary data structures used for hardware communication must have no padding.
*/
#pragma pack(push)
#pragma pack(1)
struct pyra_b { struct pyra_b {
uint8_t command; /* PYRA_COMMAND_B */ uint8_t command; /* PYRA_COMMAND_B */
uint8_t size; /* always 3 */ uint8_t size; /* always 3 */
uint8_t unknown; /* 1 */ uint8_t unknown; /* 1 */
}; } __attribute__ ((__packed__));
struct pyra_control { struct pyra_control {
uint8_t command; /* PYRA_COMMAND_CONTROL */ uint8_t command; /* PYRA_COMMAND_CONTROL */
...@@ -34,7 +28,7 @@ struct pyra_control { ...@@ -34,7 +28,7 @@ struct pyra_control {
*/ */
uint8_t value; /* Range 0-4 */ uint8_t value; /* Range 0-4 */
uint8_t request; uint8_t request;
}; } __attribute__ ((__packed__));
enum pyra_control_requests { enum pyra_control_requests {
PYRA_CONTROL_REQUEST_STATUS = 0x00, PYRA_CONTROL_REQUEST_STATUS = 0x00,
...@@ -46,7 +40,7 @@ struct pyra_settings { ...@@ -46,7 +40,7 @@ struct pyra_settings {
uint8_t command; /* PYRA_COMMAND_SETTINGS */ uint8_t command; /* PYRA_COMMAND_SETTINGS */
uint8_t size; /* always 3 */ uint8_t size; /* always 3 */
uint8_t startup_profile; /* Range 0-4! */ uint8_t startup_profile; /* Range 0-4! */
}; } __attribute__ ((__packed__));
struct pyra_profile_settings { struct pyra_profile_settings {
uint8_t command; /* PYRA_COMMAND_PROFILE_SETTINGS */ uint8_t command; /* PYRA_COMMAND_PROFILE_SETTINGS */
...@@ -61,7 +55,7 @@ struct pyra_profile_settings { ...@@ -61,7 +55,7 @@ struct pyra_profile_settings {
uint8_t light_effect; uint8_t light_effect;
uint8_t handedness; uint8_t handedness;
uint16_t checksum; /* byte sum */ uint16_t checksum; /* byte sum */
}; } __attribute__ ((__packed__));
struct pyra_profile_buttons { struct pyra_profile_buttons {
uint8_t command; /* PYRA_COMMAND_PROFILE_BUTTONS */ uint8_t command; /* PYRA_COMMAND_PROFILE_BUTTONS */
...@@ -69,7 +63,7 @@ struct pyra_profile_buttons { ...@@ -69,7 +63,7 @@ struct pyra_profile_buttons {
uint8_t number; /* Range 0-4 */ uint8_t number; /* Range 0-4 */
uint8_t buttons[14]; uint8_t buttons[14];
uint16_t checksum; /* byte sum */ uint16_t checksum; /* byte sum */
}; } __attribute__ ((__packed__));
struct pyra_info { struct pyra_info {
uint8_t command; /* PYRA_COMMAND_INFO */ uint8_t command; /* PYRA_COMMAND_INFO */
...@@ -78,7 +72,7 @@ struct pyra_info { ...@@ -78,7 +72,7 @@ struct pyra_info {
uint8_t unknown1; /* always 0 */ uint8_t unknown1; /* always 0 */
uint8_t unknown2; /* always 1 */ uint8_t unknown2; /* always 1 */
uint8_t unknown3; /* always 0 */ uint8_t unknown3; /* always 0 */
}; } __attribute__ ((__packed__));
enum pyra_commands { enum pyra_commands {
PYRA_COMMAND_CONTROL = 0x4, PYRA_COMMAND_CONTROL = 0x4,
...@@ -110,13 +104,13 @@ struct pyra_mouse_event_button { ...@@ -110,13 +104,13 @@ struct pyra_mouse_event_button {
uint8_t type; uint8_t type;
uint8_t data1; uint8_t data1;
uint8_t data2; uint8_t data2;
}; } __attribute__ ((__packed__));
struct pyra_mouse_event_audio { struct pyra_mouse_event_audio {
uint8_t report_number; /* always 2 */ uint8_t report_number; /* always 2 */
uint8_t type; uint8_t type;
uint8_t unused; /* always 0 */ uint8_t unused; /* always 0 */
}; } __attribute__ ((__packed__));
/* hid audio controls */ /* hid audio controls */
enum pyra_mouse_event_audio_types { enum pyra_mouse_event_audio_types {
...@@ -170,9 +164,7 @@ struct pyra_roccat_report { ...@@ -170,9 +164,7 @@ struct pyra_roccat_report {
uint8_t type; uint8_t type;
uint8_t value; uint8_t value;
uint8_t key; uint8_t key;
}; } __attribute__ ((__packed__));
#pragma pack(pop)
struct pyra_device { struct pyra_device {
int actual_profile; int actual_profile;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment