linux/drivers/hid/hid-roccat-koneplus.h
<<
>>
Prefs
   1#ifndef __HID_ROCCAT_KONEPLUS_H
   2#define __HID_ROCCAT_KONEPLUS_H
   3
   4/*
   5 * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net>
   6 */
   7
   8/*
   9 * This program is free software; you can redistribute it and/or modify it
  10 * under the terms of the GNU General Public License as published by the Free
  11 * Software Foundation; either version 2 of the License, or (at your option)
  12 * any later version.
  13 */
  14
  15#include <linux/types.h>
  16
  17struct koneplus_talk {
  18        uint8_t command; /* KONEPLUS_COMMAND_TALK */
  19        uint8_t size; /* always 0x10 */
  20        uint8_t data[14];
  21} __packed;
  22
  23enum koneplus_control_requests {
  24        KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80,
  25        KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90,
  26};
  27
  28struct koneplus_actual_profile {
  29        uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */
  30        uint8_t size; /* always 3 */
  31        uint8_t actual_profile; /* Range 0-4! */
  32} __attribute__ ((__packed__));
  33
  34struct koneplus_profile_settings {
  35        uint8_t command; /* KONEPLUS_COMMAND_PROFILE_SETTINGS */
  36        uint8_t size; /* always 43 */
  37        uint8_t number; /* range 0-4 */
  38        uint8_t advanced_sensitivity;
  39        uint8_t sensitivity_x;
  40        uint8_t sensitivity_y;
  41        uint8_t cpi_levels_enabled;
  42        uint8_t cpi_levels_x[5];
  43        uint8_t cpi_startup_level; /* range 0-4 */
  44        uint8_t cpi_levels_y[5]; /* range 1-60 means 100-6000 cpi */
  45        uint8_t unknown1;
  46        uint8_t polling_rate;
  47        uint8_t lights_enabled;
  48        uint8_t light_effect_mode;
  49        uint8_t color_flow_effect;
  50        uint8_t light_effect_type;
  51        uint8_t light_effect_speed;
  52        uint8_t lights[16];
  53        uint16_t checksum;
  54} __attribute__ ((__packed__));
  55
  56struct koneplus_profile_buttons {
  57        uint8_t command; /* KONEPLUS_COMMAND_PROFILE_BUTTONS */
  58        uint8_t size; /* always 77 */
  59        uint8_t number; /* range 0-4 */
  60        uint8_t data[72];
  61        uint16_t checksum;
  62} __attribute__ ((__packed__));
  63
  64struct koneplus_macro {
  65        uint8_t command; /* KONEPLUS_COMMAND_MACRO */
  66        uint16_t size; /* always 0x822 little endian */
  67        uint8_t profile; /* range 0-4 */
  68        uint8_t button; /* range 0-23 */
  69        uint8_t data[2075];
  70        uint16_t checksum;
  71} __attribute__ ((__packed__));
  72
  73struct koneplus_info {
  74        uint8_t command; /* KONEPLUS_COMMAND_INFO */
  75        uint8_t size; /* always 6 */
  76        uint8_t firmware_version;
  77        uint8_t unknown[3];
  78} __attribute__ ((__packed__));
  79
  80struct koneplus_e {
  81        uint8_t command; /* KONEPLUS_COMMAND_E */
  82        uint8_t size; /* always 3 */
  83        uint8_t unknown; /* TODO 1; 0 before firmware update */
  84} __attribute__ ((__packed__));
  85
  86struct koneplus_sensor {
  87        uint8_t command;  /* KONEPLUS_COMMAND_SENSOR */
  88        uint8_t size; /* always 6 */
  89        uint8_t data[4];
  90} __attribute__ ((__packed__));
  91
  92struct koneplus_firmware_write {
  93        uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE */
  94        uint8_t unknown[1025];
  95} __attribute__ ((__packed__));
  96
  97struct koneplus_firmware_write_control {
  98        uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL */
  99        /*
 100         * value is 1 on success
 101         * 3 means "not finished yet"
 102         */
 103        uint8_t value;
 104        uint8_t unknown; /* always 0x75 */
 105} __attribute__ ((__packed__));
 106
 107struct koneplus_tcu {
 108        uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
 109        uint8_t data[2];
 110} __attribute__ ((__packed__));
 111
 112struct koneplus_tcu_image {
 113        uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
 114        uint8_t data[1024];
 115        uint16_t checksum;
 116} __attribute__ ((__packed__));
 117
 118enum koneplus_commands {
 119        KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
 120        KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
 121        KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
 122        KONEPLUS_COMMAND_MACRO = 0x8,
 123        KONEPLUS_COMMAND_INFO = 0x9,
 124        KONEPLUS_COMMAND_TCU = 0xc,
 125        KONEPLUS_COMMAND_E = 0xe,
 126        KONEPLUS_COMMAND_SENSOR = 0xf,
 127        KONEPLUS_COMMAND_TALK = 0x10,
 128        KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b,
 129        KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
 130};
 131
 132enum koneplus_mouse_report_numbers {
 133        KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1,
 134        KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
 135        KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,
 136};
 137
 138struct koneplus_mouse_report_button {
 139        uint8_t report_number; /* always KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON */
 140        uint8_t zero1;
 141        uint8_t type;
 142        uint8_t data1;
 143        uint8_t data2;
 144        uint8_t zero2;
 145        uint8_t unknown[2];
 146} __attribute__ ((__packed__));
 147
 148enum koneplus_mouse_report_button_types {
 149        /* data1 = new profile range 1-5 */
 150        KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE = 0x20,
 151
 152        /* data1 = button number range 1-24; data2 = action */
 153        KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
 154
 155        /* data1 = button number range 1-24; data2 = action */
 156        KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
 157
 158        /* data1 = setting number range 1-5 */
 159        KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
 160
 161        /* data1 and data2 = range 0x1-0xb */
 162        KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
 163
 164        /* data1 = 22 = next track...
 165         * data2 = action
 166         */
 167        KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
 168        KONEPLUS_MOUSE_REPORT_TALK = 0xff,
 169};
 170
 171enum koneplus_mouse_report_button_action {
 172        KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
 173        KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
 174};
 175
 176struct koneplus_roccat_report {
 177        uint8_t type;
 178        uint8_t data1;
 179        uint8_t data2;
 180        uint8_t profile;
 181} __attribute__ ((__packed__));
 182
 183struct koneplus_device {
 184        int actual_profile;
 185
 186        int roccat_claimed;
 187        int chrdev_minor;
 188
 189        struct mutex koneplus_lock;
 190
 191        struct koneplus_info info;
 192        struct koneplus_profile_settings profile_settings[5];
 193        struct koneplus_profile_buttons profile_buttons[5];
 194};
 195
 196#endif
 197
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.