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 "modules/system/usb/UsbDevice.h"
24 #include "pedigree/kernel/compiler.h"
25 #include "pedigree/kernel/processor/types.h"
26 #include "pedigree/kernel/utilities/String.h"
27 #include "pedigree/kernel/utilities/new"
28 
29 class HidReport;
30 
32 {
33  public:
35  virtual ~UsbHumanInterfaceDevice();
36 
37  virtual void initialiseDriver();
38 
39  virtual void getName(String &str)
40  {
41  str = "USB Human Interface Device";
42  }
43 
44  private:
46  {
47  inline HidDescriptor(UnknownDescriptor *pDes)
48  {
49  Descriptor *pDescriptor =
50  static_cast<Descriptor *>(pDes->pDescriptor);
51  nDescriptorLength = pDescriptor->nDescriptorLength;
52  delete pDescriptor;
53  }
54 
55  struct Descriptor
56  {
57  uint8_t nLength;
58  uint8_t nType;
59  uint16_t nBcdHidRelease;
60  uint8_t nCountryCode;
61  uint8_t nDescriptors;
62  uint8_t nDescriptorType;
63  uint16_t nDescriptorLength;
64  } PACKED;
65 
66  uint16_t nDescriptorLength;
67  };
68 
69  static void callback(uintptr_t pParam, ssize_t ret);
70  void inputHandler();
71 
74 
77 
82 };
83 
84 #endif
virtual void initialiseDriver()
Implemented by the driver class, initialises driver-specific stuff.
Definition: String.h:49
Endpoint * m_pInEndpoint
The endpoint used to receive input reports from the device.
uint8_t * m_pOldInReportBuffer
Old input report buffer.
uint8_t * m_pInReportBuffer
Input report buffer.
HidReport * m_pReport
The report instance used for input parsing.