Path: blob/master/drivers/hid/hid-roccat-koneplus.h
15109 views
#ifndef __HID_ROCCAT_KONEPLUS_H1#define __HID_ROCCAT_KONEPLUS_H23/*4* Copyright (c) 2010 Stefan Achatz <[email protected]>5*/67/*8* This program is free software; you can redistribute it and/or modify it9* under the terms of the GNU General Public License as published by the Free10* Software Foundation; either version 2 of the License, or (at your option)11* any later version.12*/1314#include <linux/types.h>1516/*17* case 1: writes request 80 and reads value 118*19*/20struct koneplus_control {21uint8_t command; /* KONEPLUS_COMMAND_CONTROL */22/*23* value is profile number in range 0-4 for requesting settings and buttons24* 1 if status ok for requesting status25*/26uint8_t value;27uint8_t request;28} __attribute__ ((__packed__));2930enum koneplus_control_requests {31KONEPLUS_CONTROL_REQUEST_STATUS = 0x00,32KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80,33KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90,34};3536enum koneplus_control_values {37KONEPLUS_CONTROL_REQUEST_STATUS_OVERLOAD = 0,38KONEPLUS_CONTROL_REQUEST_STATUS_OK = 1,39KONEPLUS_CONTROL_REQUEST_STATUS_WAIT = 3,40};4142struct koneplus_actual_profile {43uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */44uint8_t size; /* always 3 */45uint8_t actual_profile; /* Range 0-4! */46} __attribute__ ((__packed__));4748struct koneplus_profile_settings {49uint8_t command; /* KONEPLUS_COMMAND_PROFILE_SETTINGS */50uint8_t size; /* always 43 */51uint8_t number; /* range 0-4 */52uint8_t advanced_sensitivity;53uint8_t sensitivity_x;54uint8_t sensitivity_y;55uint8_t cpi_levels_enabled;56uint8_t cpi_levels_x[5];57uint8_t cpi_startup_level; /* range 0-4 */58uint8_t cpi_levels_y[5]; /* range 1-60 means 100-6000 cpi */59uint8_t unknown1;60uint8_t polling_rate;61uint8_t lights_enabled;62uint8_t light_effect_mode;63uint8_t color_flow_effect;64uint8_t light_effect_type;65uint8_t light_effect_speed;66uint8_t lights[16];67uint16_t checksum;68} __attribute__ ((__packed__));6970struct koneplus_profile_buttons {71uint8_t command; /* KONEPLUS_COMMAND_PROFILE_BUTTONS */72uint8_t size; /* always 77 */73uint8_t number; /* range 0-4 */74uint8_t data[72];75uint16_t checksum;76} __attribute__ ((__packed__));7778struct koneplus_macro {79uint8_t command; /* KONEPLUS_COMMAND_MACRO */80uint16_t size; /* always 0x822 little endian */81uint8_t profile; /* range 0-4 */82uint8_t button; /* range 0-23 */83uint8_t data[2075];84uint16_t checksum;85} __attribute__ ((__packed__));8687struct koneplus_info {88uint8_t command; /* KONEPLUS_COMMAND_INFO */89uint8_t size; /* always 6 */90uint8_t firmware_version;91uint8_t unknown[3];92} __attribute__ ((__packed__));9394struct koneplus_e {95uint8_t command; /* KONEPLUS_COMMAND_E */96uint8_t size; /* always 3 */97uint8_t unknown; /* TODO 1; 0 before firmware update */98} __attribute__ ((__packed__));99100struct koneplus_sensor {101uint8_t command; /* KONEPLUS_COMMAND_SENSOR */102uint8_t size; /* always 6 */103uint8_t data[4];104} __attribute__ ((__packed__));105106struct koneplus_firmware_write {107uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE */108uint8_t unknown[1025];109} __attribute__ ((__packed__));110111struct koneplus_firmware_write_control {112uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL */113/*114* value is 1 on success115* 3 means "not finished yet"116*/117uint8_t value;118uint8_t unknown; /* always 0x75 */119} __attribute__ ((__packed__));120121struct koneplus_tcu {122uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */123uint8_t data[2];124} __attribute__ ((__packed__));125126struct koneplus_tcu_image {127uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */128uint8_t data[1024];129uint16_t checksum;130} __attribute__ ((__packed__));131132enum koneplus_commands {133KONEPLUS_COMMAND_CONTROL = 0x4,134KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5,135KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6,136KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7,137KONEPLUS_COMMAND_MACRO = 0x8,138KONEPLUS_COMMAND_INFO = 0x9,139KONEPLUS_COMMAND_E = 0xe,140KONEPLUS_COMMAND_SENSOR = 0xf,141KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b,142KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,143};144145enum koneplus_usb_commands {146KONEPLUS_USB_COMMAND_CONTROL = 0x304,147KONEPLUS_USB_COMMAND_ACTUAL_PROFILE = 0x305,148KONEPLUS_USB_COMMAND_PROFILE_SETTINGS = 0x306,149KONEPLUS_USB_COMMAND_PROFILE_BUTTONS = 0x307,150KONEPLUS_USB_COMMAND_MACRO = 0x308,151KONEPLUS_USB_COMMAND_INFO = 0x309,152KONEPLUS_USB_COMMAND_TCU = 0x30c,153KONEPLUS_USB_COMMAND_E = 0x30e,154KONEPLUS_USB_COMMAND_SENSOR = 0x30f,155KONEPLUS_USB_COMMAND_FIRMWARE_WRITE = 0x31b,156KONEPLUS_USB_COMMAND_FIRMWARE_WRITE_CONTROL = 0x31c,157};158159enum koneplus_mouse_report_numbers {160KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1,161KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,162KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,163};164165struct koneplus_mouse_report_button {166uint8_t report_number; /* always KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON */167uint8_t zero1;168uint8_t type;169uint8_t data1;170uint8_t data2;171uint8_t zero2;172uint8_t unknown[2];173} __attribute__ ((__packed__));174175enum koneplus_mouse_report_button_types {176/* data1 = new profile range 1-5 */177KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE = 0x20,178179/* data1 = button number range 1-24; data2 = action */180KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,181182/* data1 = button number range 1-24; data2 = action */183KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,184185/* data1 = setting number range 1-5 */186KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,187188/* data1 and data2 = range 0x1-0xb */189KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,190191/* data1 = 22 = next track...192* data2 = action193*/194KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,195};196197enum koneplus_mouse_report_button_action {198KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,199KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,200};201202struct koneplus_roccat_report {203uint8_t type;204uint8_t data1;205uint8_t data2;206uint8_t profile;207} __attribute__ ((__packed__));208209struct koneplus_device {210int actual_profile;211212int roccat_claimed;213int chrdev_minor;214215struct mutex koneplus_lock;216217struct koneplus_info info;218struct koneplus_profile_settings profile_settings[5];219struct koneplus_profile_buttons profile_buttons[5];220};221222#endif223224225