linux/drivers/hid/hid-roccat-pyra.h
<<
>>
Prefs
   1#ifndef __HID_ROCCAT_PYRA_H
   2#define __HID_ROCCAT_PYRA_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 pyra_b {
  18        uint8_t command; /* PYRA_COMMAND_B */
  19        uint8_t size; /* always 3 */
  20        uint8_t unknown; /* 1 */
  21} __attribute__ ((__packed__));
  22
  23enum pyra_control_requests {
  24        PYRA_CONTROL_REQUEST_PROFILE_SETTINGS = 0x10,
  25        PYRA_CONTROL_REQUEST_PROFILE_BUTTONS = 0x20
  26};
  27
  28struct pyra_settings {
  29        uint8_t command; /* PYRA_COMMAND_SETTINGS */
  30        uint8_t size; /* always 3 */
  31        uint8_t startup_profile; /* Range 0-4! */
  32} __attribute__ ((__packed__));
  33
  34struct pyra_profile_settings {
  35        uint8_t command; /* PYRA_COMMAND_PROFILE_SETTINGS */
  36        uint8_t size; /* always 0xd */
  37        uint8_t number; /* Range 0-4 */
  38        uint8_t xysync;
  39        uint8_t x_sensitivity; /* 0x1-0xa */
  40        uint8_t y_sensitivity;
  41        uint8_t x_cpi; /* unused */
  42        uint8_t y_cpi; /* this value is for x and y */
  43        uint8_t lightswitch; /* 0 = off, 1 = on */
  44        uint8_t light_effect;
  45        uint8_t handedness;
  46        uint16_t checksum; /* byte sum */
  47} __attribute__ ((__packed__));
  48
  49struct pyra_profile_buttons {
  50        uint8_t command; /* PYRA_COMMAND_PROFILE_BUTTONS */
  51        uint8_t size; /* always 0x13 */
  52        uint8_t number; /* Range 0-4 */
  53        uint8_t buttons[14];
  54        uint16_t checksum; /* byte sum */
  55} __attribute__ ((__packed__));
  56
  57struct pyra_info {
  58        uint8_t command; /* PYRA_COMMAND_INFO */
  59        uint8_t size; /* always 6 */
  60        uint8_t firmware_version;
  61        uint8_t unknown1; /* always 0 */
  62        uint8_t unknown2; /* always 1 */
  63        uint8_t unknown3; /* always 0 */
  64} __attribute__ ((__packed__));
  65
  66enum pyra_commands {
  67        PYRA_COMMAND_SETTINGS = 0x5,
  68        PYRA_COMMAND_PROFILE_SETTINGS = 0x6,
  69        PYRA_COMMAND_PROFILE_BUTTONS = 0x7,
  70        PYRA_COMMAND_INFO = 0x9,
  71        PYRA_COMMAND_B = 0xb
  72};
  73
  74enum pyra_mouse_report_numbers {
  75        PYRA_MOUSE_REPORT_NUMBER_HID = 1,
  76        PYRA_MOUSE_REPORT_NUMBER_AUDIO = 2,
  77        PYRA_MOUSE_REPORT_NUMBER_BUTTON = 3,
  78};
  79
  80struct pyra_mouse_event_button {
  81        uint8_t report_number; /* always 3 */
  82        uint8_t unknown; /* always 0 */
  83        uint8_t type;
  84        uint8_t data1;
  85        uint8_t data2;
  86} __attribute__ ((__packed__));
  87
  88struct pyra_mouse_event_audio {
  89        uint8_t report_number; /* always 2 */
  90        uint8_t type;
  91        uint8_t unused; /* always 0 */
  92} __attribute__ ((__packed__));
  93
  94/* hid audio controls */
  95enum pyra_mouse_event_audio_types {
  96        PYRA_MOUSE_EVENT_AUDIO_TYPE_MUTE = 0xe2,
  97        PYRA_MOUSE_EVENT_AUDIO_TYPE_VOLUME_UP = 0xe9,
  98        PYRA_MOUSE_EVENT_AUDIO_TYPE_VOLUME_DOWN = 0xea,
  99};
 100
 101enum pyra_mouse_event_button_types {
 102        /*
 103         * Mouse sends tilt events on report_number 1 and 3
 104         * Tilt events are sent repeatedly with 0.94s between first and second
 105         * event and 0.22s on subsequent
 106         */
 107        PYRA_MOUSE_EVENT_BUTTON_TYPE_TILT = 0x10,
 108
 109        /*
 110         * These are sent sequentially
 111         * data1 contains new profile number in range 1-5
 112         */
 113        PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_1 = 0x20,
 114        PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2 = 0x30,
 115
 116        /*
 117         * data1 = button_number (rmp index)
 118         * data2 = pressed/released
 119         */
 120        PYRA_MOUSE_EVENT_BUTTON_TYPE_MACRO = 0x40,
 121        PYRA_MOUSE_EVENT_BUTTON_TYPE_SHORTCUT = 0x50,
 122
 123        /*
 124         * data1 = button_number (rmp index)
 125         */
 126        PYRA_MOUSE_EVENT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
 127
 128        /* data1 = new cpi */
 129        PYRA_MOUSE_EVENT_BUTTON_TYPE_CPI = 0xb0,
 130
 131        /* data1 and data2 = new sensitivity */
 132        PYRA_MOUSE_EVENT_BUTTON_TYPE_SENSITIVITY = 0xc0,
 133
 134        PYRA_MOUSE_EVENT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
 135};
 136
 137enum {
 138        PYRA_MOUSE_EVENT_BUTTON_PRESS = 0,
 139        PYRA_MOUSE_EVENT_BUTTON_RELEASE = 1,
 140};
 141
 142struct pyra_roccat_report {
 143        uint8_t type;
 144        uint8_t value;
 145        uint8_t key;
 146} __attribute__ ((__packed__));
 147
 148struct pyra_device {
 149        int actual_profile;
 150        int actual_cpi;
 151        int firmware_version;
 152        int roccat_claimed;
 153        int chrdev_minor;
 154        struct mutex pyra_lock;
 155        struct pyra_settings settings;
 156        struct pyra_profile_settings profile_settings[5];
 157        struct pyra_profile_buttons profile_buttons[5];
 158};
 159
 160#endif
 161
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.