XenevaOS
Loading...
Searching...
No Matches
usbhid.h
Go to the documentation of this file.
1//
2// usbhid.h
3//
4// USPi - An USB driver for Raspberry Pi written in C
5// Copyright (C) 2014 R. Stange <rsta2@o2online.de>
6//
7// This program is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19//
20#ifndef _uspi_usbhid_h
21#define _uspi_usbhid_h
22
23#include "uspi/macros.h"
24
25// Class-specific requests
26#define GET_REPORT 0x01
27#define GET_IDLE 0x02
28#define GET_PROTOCOL 0x03
29#define SET_REPORT 0x09
30#define SET_IDLE 0x0A
31#define SET_PROTOCOL 0x0B
32
33// Class-specific descriptors
34#define DESCRIPTOR_HID 0x21
35#define DESCRIPTOR_REPORT 0x22
36
37// Protocol IDs
38#define BOOT_PROTOCOL 0x00
39#define REPORT_PROTOCOL 0x01
40
41// Report types
42#define REPORT_TYPE_INPUT 0x01
43#define REPORT_TYPE_OUTPUT 0x02
44#define REPORT_TYPE_FEATURE 0x03
45
46#pragma pack(push,1)
47typedef struct TUSBHIDDescriptor
48{
49 unsigned char bLength;
50 unsigned char bDescriptorType;
51 unsigned short bcdHID;
52 unsigned char bCountryCode;
53 unsigned char bNumDescriptors;
54 unsigned char bReportDescriptorType;
57#pragma pack(pop)
58//PACKED TUSBHIDDescriptor;
59
60// Modifiers (boot protocol)
61#define LCTRL (1 << 0)
62#define LSHIFT (1 << 1)
63#define ALT (1 << 2)
64#define LWIN (1 << 3)
65#define RCTRL (1 << 4)
66#define RSHIFT (1 << 5)
67#define ALTGR (1 << 6)
68#define RWIN (1 << 7)
69
70// LEDs (boot protocol)
71#define LED_NUM_LOCK (1 << 0)
72#define LED_CAPS_LOCK (1 << 1)
73#define LED_SCROLL_LOCK (1 << 2)
74
75// Mouse buttons (boot protocol)
76#define USBHID_BUTTON1 (1 << 0)
77#define USBHID_BUTTON2 (1 << 1)
78#define USBHID_BUTTON3 (1 << 2)
79
80#endif
Definition usbhid.h:48
unsigned char bNumDescriptors
Definition usbhid.h:53
unsigned short bcdHID
Definition usbhid.h:51
unsigned char bDescriptorType
Definition usbhid.h:50
unsigned char bLength
Definition usbhid.h:49
unsigned short wReportDescriptorLength
Definition usbhid.h:55
unsigned char bReportDescriptorType
Definition usbhid.h:54
unsigned char bCountryCode
Definition usbhid.h:52