The Pedigree Project 0.1
UsbHumanInterfaceDevice.h
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef USBHUMANINTERFACEDEVICE_H
21#define USBHUMANINTERFACEDEVICE_H
22
23#include "pedigree/kernel/compiler.h"
24#include "pedigree/kernel/processor/types.h"
25#include "pedigree/kernel/utilities/String.h"
26#include "pedigree/kernel/utilities/new"
27
28#include "modules/system/usb/UsbDevice.h"
29#include "modules/system/usb/UsbHub.h"
30
31class HidReport;
32
34 public:
37
38 virtual void initialiseDriver();
39
40 virtual void getName(String& str) {
41 str.assign("USB Human Interface Device", 27);
42 }
43
44 private:
46 inline HidDescriptor(UnknownDescriptor* pDes) {
47 Descriptor* pDescriptor = static_cast<Descriptor*>(pDes->pDescriptor);
48 nDescriptorLength = pDescriptor->nDescriptorLength;
49 }
50
51 struct Descriptor {
52 uint8_t nLength;
53 uint8_t nType;
54 uint16_t nBcdHidRelease;
55 uint8_t nCountryCode;
56 uint8_t nDescriptors;
57 uint8_t nDescriptorType;
58 uint16_t nDescriptorLength;
59 } PACKED;
60
61 uint16_t nDescriptorLength;
62 };
63
64 static void callback(uintptr_t pParam, ssize_t ret);
65 void inputHandler(size_t bytes);
66
69
72
75
80
81 bool m_ReceivedInput;
82};
83
84#endif
virtual void initialiseDriver()
Implemented by the driver class, initialises driver-specific stuff.
uint8_t * m_pInReportBuffer
Input report buffer.
HidReport * m_pReport
The report instance used for input parsing.
uint8_t * m_pOldInReportBuffer
Old input report buffer.
Endpoint * m_pInEndpoint
The endpoint used to receive input reports from the device.
UsbInterruptInHandle m_InterruptIn
Owns and synchronously cancels the recurring controller callback.