aboutsummaryrefslogtreecommitdiff
path: root/drivers/hid/hid-roccat-arvo.h
blob: d284a781c99e407a9b2abacfeaa4cf3359c45931 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#ifndef __HID_ROCCAT_ARVO_H
#define __HID_ROCCAT_ARVO_H

/*
 * Copyright (c) 2011 Stefan Achatz <erazor_de@users.sourceforge.net>
 */

/*
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 */

#include <linux/types.h>

struct arvo_mode_key { /* 2 bytes */
	uint8_t command; /* ARVO_COMMAND_MODE_KEY */
	uint8_t state;
} __packed;

struct arvo_button {
	uint8_t unknown[24];
} __packed;

struct arvo_info {
	uint8_t unknown[8];
} __packed;

struct arvo_key_mask { /* 2 bytes */
	uint8_t command; /* ARVO_COMMAND_KEY_MASK */
	uint8_t key_mask;
} __packed;

/* selected profile is persistent */
struct arvo_actual_profile { /* 2 bytes */
	uint8_t command; /* ARVO_COMMAND_ACTUAL_PROFILE */
	uint8_t actual_profile;
} __packed;

enum arvo_commands {
	ARVO_COMMAND_MODE_KEY = 0x3,
	ARVO_COMMAND_BUTTON = 0x4,
	ARVO_COMMAND_INFO = 0x5,
	ARVO_COMMAND_KEY_MASK = 0x6,
	ARVO_COMMAND_ACTUAL_PROFILE = 0x7,
};

enum arvo_usb_commands {
	ARVO_USB_COMMAND_MODE_KEY = 0x303,
	/*
	 * read/write
	 * Read uses both index bytes as profile/key indexes
	 * Write has index 0, profile/key is determined by payload
	 */
	ARVO_USB_COMMAND_BUTTON = 0x304,
	ARVO_USB_COMMAND_INFO = 0x305,
	ARVO_USB_COMMAND_KEY_MASK = 0x306,
	ARVO_USB_COMMAND_ACTUAL_PROFILE = 0x307,
};

struct arvo_special_report {
	uint8_t unknown1; /* always 0x01 */
	uint8_t event;
	uint8_t unknown2; /* always 0x70 */
} __packed;

enum arvo_special_report_events {
	ARVO_SPECIAL_REPORT_EVENT_ACTION_PRESS = 0x10,
	ARVO_SPECIAL_REPORT_EVENT_ACTION_RELEASE = 0x0,
};

enum arvo_special_report_event_masks {
	ARVO_SPECIAL_REPORT_EVENT_MASK_ACTION = 0xf0,
	ARVO_SPECIAL_REPORT_EVENT_MASK_BUTTON = 0x0f,
};

struct arvo_roccat_report {
	uint8_t profile;
	uint8_t button;
	uint8_t action;
} __packed;

enum arvo_roccat_report_action {
	ARVO_ROCCAT_REPORT_ACTION_RELEASE = 0,
	ARVO_ROCCAT_REPORT_ACTION_PRESS = 1,
};

struct arvo_device {
	int roccat_claimed;
	int chrdev_minor;

	struct mutex arvo_lock;

	int actual_profile;
};

#endif