1
0
Fork 0

HID: roccat: don't use #pragma pack

Replace #pragma pack ocurences with __atribute__((__packed__));

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
hifive-unleashed-5.1
Jiri Kosina 2010-12-09 14:29:34 +01:00
parent 47dbdbffe1
commit 4d04310189
3 changed files with 30 additions and 54 deletions

View File

@ -14,17 +14,11 @@
#include <linux/types.h>
/*
* Binary data structures used for hardware communication must have no padding.
*/
#pragma pack(push)
#pragma pack(1)
struct kone_keystroke {
uint8_t key;
uint8_t action;
uint16_t period; /* in milliseconds */
};
} __attribute__ ((__packed__));
enum kone_keystroke_buttons {
kone_keystroke_button_1 = 0xf0, /* left mouse button */
@ -47,7 +41,7 @@ struct kone_button_info {
uint8_t macro_name[16]; /* can be max 15 chars long */
uint8_t count;
struct kone_keystroke keystrokes[20];
};
} __attribute__ ((__packed__));
enum kone_button_info_types {
/* valid button types until firmware 1.32 */
@ -98,7 +92,7 @@ struct kone_light_info {
uint8_t red; /* range 0x00-0xff */
uint8_t green; /* range 0x00-0xff */
uint8_t blue; /* range 0x00-0xff */
};
} __attribute__ ((__packed__));
struct kone_profile {
uint16_t size; /* always 975 */
@ -133,7 +127,7 @@ struct kone_profile {
struct kone_button_info button_infos[8];
uint16_t checksum; /* \brief holds checksum of struct */
};
} __attribute__ ((__packed__));
enum kone_polling_rates {
kone_polling_rate_125 = 1,
@ -150,7 +144,7 @@ struct kone_settings {
uint8_t calibration_data[4];
uint8_t unknown3[2];
uint16_t checksum;
};
} __attribute__ ((__packed__));
/*
* 12 byte mouse event read by interrupt_read
@ -166,7 +160,7 @@ struct kone_mouse_event {
uint8_t event;
uint8_t value; /* press = 0, release = 1 */
uint8_t macro_key; /* 0 to 8 */
};
} __attribute__ ((__packed__));
enum kone_mouse_events {
/* osd events are thought to be display on screen */
@ -194,9 +188,7 @@ struct kone_roccat_report {
uint8_t event;
uint8_t value; /* holds dpi or profile value */
uint8_t key; /* macro key on overlong macro execution */
};
#pragma pack(pop)
} __attribute__ ((__packed__));
struct kone_device {
/*

View File

@ -14,12 +14,6 @@
#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
*
@ -32,7 +26,7 @@ struct koneplus_control {
*/
uint8_t value;
uint8_t request;
};
} __attribute__ ((__packed__));
enum koneplus_control_requests {
KONEPLUS_CONTROL_REQUEST_STATUS = 0x00,
@ -50,7 +44,7 @@ struct koneplus_startup_profile {
uint8_t command; /* KONEPLUS_COMMAND_STARTUP_PROFILE */
uint8_t size; /* always 3 */
uint8_t startup_profile; /* Range 0-4! */
};
} __attribute__ ((__packed__));
struct koneplus_profile_settings {
uint8_t command; /* KONEPLUS_COMMAND_PROFILE_SETTINGS */
@ -72,7 +66,7 @@ struct koneplus_profile_settings {
uint8_t light_effect_speed;
uint8_t lights[16];
uint16_t checksum;
};
} __attribute__ ((__packed__));
struct koneplus_profile_buttons {
uint8_t command; /* KONEPLUS_COMMAND_PROFILE_BUTTONS */
@ -80,7 +74,7 @@ struct koneplus_profile_buttons {
uint8_t number; /* range 0-4 */
uint8_t data[72];
uint16_t checksum;
};
} __attribute__ ((__packed__));
struct koneplus_macro {
uint8_t command; /* KONEPLUS_COMMAND_MACRO */
@ -89,31 +83,31 @@ struct koneplus_macro {
uint8_t button; /* range 0-23 */
uint8_t data[2075];
uint16_t checksum;
};
} __attribute__ ((__packed__));
struct koneplus_info {
uint8_t command; /* KONEPLUS_COMMAND_INFO */
uint8_t size; /* always 6 */
uint8_t firmware_version;
uint8_t unknown[3];
};
} __attribute__ ((__packed__));
struct koneplus_e {
uint8_t command; /* KONEPLUS_COMMAND_E */
uint8_t size; /* always 3 */
uint8_t unknown; /* TODO 1; 0 before firmware update */
};
} __attribute__ ((__packed__));
struct koneplus_sensor {
uint8_t command; /* KONEPLUS_COMMAND_SENSOR */
uint8_t size; /* always 6 */
uint8_t data[4];
};
} __attribute__ ((__packed__));
struct koneplus_firmware_write {
uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE */
uint8_t unknown[1025];
};
} __attribute__ ((__packed__));
struct koneplus_firmware_write_control {
uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL */
@ -123,18 +117,18 @@ struct koneplus_firmware_write_control {
*/
uint8_t value;
uint8_t unknown; /* always 0x75 */
};
} __attribute__ ((__packed__));
struct koneplus_tcu {
uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
uint8_t data[2];
};
} __attribute__ ((__packed__));
struct koneplus_tcu_image {
uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
uint8_t data[1024];
uint16_t checksum;
};
} __attribute__ ((__packed__));
enum koneplus_commands {
KONEPLUS_COMMAND_CONTROL = 0x4,
@ -177,7 +171,7 @@ struct koneplus_mouse_report_button {
uint8_t data2;
uint8_t zero2;
uint8_t unknown[2];
};
} __attribute__ ((__packed__));
enum koneplus_mouse_report_button_types {
/* data1 = new profile range 1-5 */
@ -211,9 +205,7 @@ struct koneplus_roccat_report {
uint8_t data1;
uint8_t data2;
uint8_t profile;
};
#pragma pack(pop)
} __attribute__ ((__packed__));
struct koneplus_device {
int actual_profile;

View File

@ -14,17 +14,11 @@
#include <linux/types.h>
/*
* Binary data structures used for hardware communication must have no padding.
*/
#pragma pack(push)
#pragma pack(1)
struct pyra_b {
uint8_t command; /* PYRA_COMMAND_B */
uint8_t size; /* always 3 */
uint8_t unknown; /* 1 */
};
} __attribute__ ((__packed__));
struct pyra_control {
uint8_t command; /* PYRA_COMMAND_CONTROL */
@ -34,7 +28,7 @@ struct pyra_control {
*/
uint8_t value; /* Range 0-4 */
uint8_t request;
};
} __attribute__ ((__packed__));
enum pyra_control_requests {
PYRA_CONTROL_REQUEST_STATUS = 0x00,
@ -46,7 +40,7 @@ struct pyra_settings {
uint8_t command; /* PYRA_COMMAND_SETTINGS */
uint8_t size; /* always 3 */
uint8_t startup_profile; /* Range 0-4! */
};
} __attribute__ ((__packed__));
struct pyra_profile_settings {
uint8_t command; /* PYRA_COMMAND_PROFILE_SETTINGS */
@ -61,7 +55,7 @@ struct pyra_profile_settings {
uint8_t light_effect;
uint8_t handedness;
uint16_t checksum; /* byte sum */
};
} __attribute__ ((__packed__));
struct pyra_profile_buttons {
uint8_t command; /* PYRA_COMMAND_PROFILE_BUTTONS */
@ -69,7 +63,7 @@ struct pyra_profile_buttons {
uint8_t number; /* Range 0-4 */
uint8_t buttons[14];
uint16_t checksum; /* byte sum */
};
} __attribute__ ((__packed__));
struct pyra_info {
uint8_t command; /* PYRA_COMMAND_INFO */
@ -78,7 +72,7 @@ struct pyra_info {
uint8_t unknown1; /* always 0 */
uint8_t unknown2; /* always 1 */
uint8_t unknown3; /* always 0 */
};
} __attribute__ ((__packed__));
enum pyra_commands {
PYRA_COMMAND_CONTROL = 0x4,
@ -110,13 +104,13 @@ struct pyra_mouse_event_button {
uint8_t type;
uint8_t data1;
uint8_t data2;
};
} __attribute__ ((__packed__));
struct pyra_mouse_event_audio {
uint8_t report_number; /* always 2 */
uint8_t type;
uint8_t unused; /* always 0 */
};
} __attribute__ ((__packed__));
/* hid audio controls */
enum pyra_mouse_event_audio_types {
@ -170,9 +164,7 @@ struct pyra_roccat_report {
uint8_t type;
uint8_t value;
uint8_t key;
};
#pragma pack(pop)
} __attribute__ ((__packed__));
struct pyra_device {
int actual_profile;