USB Host Shield 2.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
hidboot.h
Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
3 This software may be distributed and modified under the terms of the GNU
4 General Public License version 2 (GPL2) as published by the Free Software
5 Foundation and appearing in the file GPL2.TXT included in the packaging of
6 this file. Please note that GPL2 Section 2[b] requires that all works based
7 on this software must also be made publicly available under the terms of
8 the GPL2 ("Copyleft").
9 
10 Contact information
11 -------------------
12 
13 Circuits At Home, LTD
14 Web : http://www.circuitsathome.com
15 e-mail : support@circuitsathome.com
16  */
17 #if !defined(__HIDBOOT_H__)
18 #define __HIDBOOT_H__
19 
20 #include "hid.h"
21 
22 #define UHS_HID_BOOT_KEY_ZERO 0x27
23 #define UHS_HID_BOOT_KEY_ENTER 0x28
24 #define UHS_HID_BOOT_KEY_SPACE 0x2c
25 #define UHS_HID_BOOT_KEY_CAPS_LOCK 0x39
26 #define UHS_HID_BOOT_KEY_SCROLL_LOCK 0x47
27 #define UHS_HID_BOOT_KEY_NUM_LOCK 0x53
28 #define UHS_HID_BOOT_KEY_ZERO2 0x62
29 #define UHS_HID_BOOT_KEY_PERIOD 0x63
30 
31 // Don't worry, GCC will optimize the result to a final value.
32 #define bitsEndpoints(p) ((((p) & HID_PROTOCOL_KEYBOARD)? 2 : 0) | (((p) & HID_PROTOCOL_MOUSE)? 1 : 0))
33 #define totalEndpoints(p) ((bitsEndpoints(p) == 3) ? 3 : 2)
34 #define epMUL(p) ((((p) & HID_PROTOCOL_KEYBOARD)? 1 : 0) + (((p) & HID_PROTOCOL_MOUSE)? 1 : 0))
35 
36 // Already defined in hid.h
37 // #define HID_MAX_HID_CLASS_DESCRIPTORS 5
38 
39 struct MOUSEINFO {
40 
41  struct {
42  uint8_t bmLeftButton : 1;
43  uint8_t bmRightButton : 1;
44  uint8_t bmMiddleButton : 1;
45  uint8_t bmDummy : 5;
46  };
47  int8_t dX;
48  int8_t dY;
49 };
50 
52 
53  union {
55  uint8_t bInfo[sizeof (MOUSEINFO)];
56  } prevState;
57 
58 public:
59  virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
60 
61 protected:
62 
63  virtual void OnMouseMove(MOUSEINFO *mi) {
64  };
65 
66  virtual void OnLeftButtonUp(MOUSEINFO *mi) {
67  };
68 
69  virtual void OnLeftButtonDown(MOUSEINFO *mi) {
70  };
71 
72  virtual void OnRightButtonUp(MOUSEINFO *mi) {
73  };
74 
75  virtual void OnRightButtonDown(MOUSEINFO *mi) {
76  };
77 
78  virtual void OnMiddleButtonUp(MOUSEINFO *mi) {
79  };
80 
81  virtual void OnMiddleButtonDown(MOUSEINFO *mi) {
82  };
83 };
84 
85 struct MODIFIERKEYS {
86  uint8_t bmLeftCtrl : 1;
87  uint8_t bmLeftShift : 1;
88  uint8_t bmLeftAlt : 1;
89  uint8_t bmLeftGUI : 1;
90  uint8_t bmRightCtrl : 1;
91  uint8_t bmRightShift : 1;
92  uint8_t bmRightAlt : 1;
93  uint8_t bmRightGUI : 1;
94 };
95 
96 struct KBDINFO {
97 
98  struct {
99  uint8_t bmLeftCtrl : 1;
100  uint8_t bmLeftShift : 1;
101  uint8_t bmLeftAlt : 1;
102  uint8_t bmLeftGUI : 1;
103  uint8_t bmRightCtrl : 1;
104  uint8_t bmRightShift : 1;
105  uint8_t bmRightAlt : 1;
106  uint8_t bmRightGUI : 1;
107  };
108  uint8_t bReserved;
109  uint8_t Keys[6];
110 };
111 
112 struct KBDLEDS {
113  uint8_t bmNumLock : 1;
114  uint8_t bmCapsLock : 1;
115  uint8_t bmScrollLock : 1;
116  uint8_t bmCompose : 1;
117  uint8_t bmKana : 1;
118  uint8_t bmReserved : 3;
119 };
120 
122  static const uint8_t numKeys[10];
123  static const uint8_t symKeysUp[12];
124  static const uint8_t symKeysLo[12];
125  static const uint8_t padKeys[5];
126 
127 protected:
128 
129  union {
131  uint8_t bInfo[sizeof (KBDINFO)];
132  } prevState;
133 
134  union {
136  uint8_t bLeds;
137  } kbdLockingKeys;
138 
139  uint8_t OemToAscii(uint8_t mod, uint8_t key);
140 
141 public:
142 
144  kbdLockingKeys.bLeds = 0;
145  };
146 
147  virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
148 
149 protected:
150  virtual uint8_t HandleLockingKeys(HID* hid, uint8_t key);
151 
152  virtual void OnControlKeysChanged(uint8_t before, uint8_t after) {
153  };
154 
155  virtual void OnKeyDown(uint8_t mod, uint8_t key) {
156  };
157 
158  virtual void OnKeyUp(uint8_t mod, uint8_t key) {
159  };
160 
161  virtual const uint8_t *getNumKeys() {
162  return numKeys;
163  };
164 
165  virtual const uint8_t *getSymKeysUp() {
166  return symKeysUp;
167  };
168 
169  virtual const uint8_t *getSymKeysLo() {
170  return symKeysLo;
171  };
172 
173  virtual const uint8_t *getPadKeys() {
174  return padKeys;
175  };
176 };
177 
178 template <const uint8_t BOOT_PROTOCOL>
179 class HIDBoot : public HID //public USBDeviceConfig, public UsbConfigXtracter
180 {
181  EpInfo epInfo[totalEndpoints(BOOT_PROTOCOL)];
182  HIDReportParser *pRptParser[epMUL(BOOT_PROTOCOL)];
183 
184  uint8_t bConfNum; // configuration number
185  uint8_t bIfaceNum; // Interface Number
186  uint8_t bNumIface; // number of interfaces in the configuration
187  uint8_t bNumEP; // total number of EP in the configuration
188  uint32_t qNextPollTime; // next poll time
189  bool bPollEnable; // poll enable flag
190  uint8_t bInterval; // largest interval
191 
192  void Initialize();
193 
194  virtual HIDReportParser* GetReportParser(uint8_t id) {
195  return pRptParser[id];
196  };
197 
198 public:
199  HIDBoot(USB *p);
200 
201  virtual bool SetReportParser(uint8_t id, HIDReportParser *prs) {
202  pRptParser[id] = prs;
203  return true;
204  };
205 
206  // USBDeviceConfig implementation
207  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
208  virtual uint8_t Release();
209  virtual uint8_t Poll();
210 
211  virtual uint8_t GetAddress() {
212  return bAddress;
213  };
214 
215  // UsbConfigXtracter implementation
216  virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
217 };
218 
219 template <const uint8_t BOOT_PROTOCOL>
221 HID(p),
222 qNextPollTime(0),
223 bPollEnable(false) {
224  Initialize();
225 
226  for(int i = 0; i < epMUL(BOOT_PROTOCOL); i++) {
227  pRptParser[i] = NULL;
228  }
229  if(pUsb)
230  pUsb->RegisterDeviceClass(this);
231 }
232 
233 template <const uint8_t BOOT_PROTOCOL>
235  for(int i = 0; i < totalEndpoints(BOOT_PROTOCOL); i++) {
236  epInfo[i].epAddr = 0;
237  epInfo[i].maxPktSize = (i) ? 0 : 8;
238  epInfo[i].epAttribs = 0;
239  epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER;
240  }
241  bNumEP = 1;
242  bNumIface = 0;
243  bConfNum = 0;
244 }
245 
246 template <const uint8_t BOOT_PROTOCOL>
247 uint8_t HIDBoot<BOOT_PROTOCOL>::Init(uint8_t parent, uint8_t port, bool lowspeed) {
248  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
249 
250  uint8_t buf[constBufSize];
251  uint8_t rcode;
252  UsbDevice *p = NULL;
253  EpInfo *oldep_ptr = NULL;
254  uint8_t len = 0;
255  //uint16_t cd_len = 0;
256 
257  uint8_t num_of_conf; // number of configurations
258  //uint8_t num_of_intf; // number of interfaces
259 
260  AddressPool &addrPool = pUsb->GetAddressPool();
261 
262  USBTRACE("BM Init\r\n");
263  //USBTRACE2("totalEndpoints:", (uint8_t) (totalEndpoints(BOOT_PROTOCOL)));
264  //USBTRACE2("epMUL:", epMUL(BOOT_PROTOCOL));
265 
266  if(bAddress)
268 
269  bInterval = 0;
270  // Get pointer to pseudo device with address 0 assigned
271  p = addrPool.GetUsbDevicePtr(0);
272 
273  if(!p)
275 
276  if(!p->epinfo) {
277  USBTRACE("epinfo\r\n");
279  }
280 
281  // Save old pointer to EP_RECORD of address 0
282  oldep_ptr = p->epinfo;
283 
284  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
285  p->epinfo = epInfo;
286 
287  p->lowspeed = lowspeed;
288 
289  // Get device descriptor
290  rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*)buf);
291 
292  if(!rcode)
293  len = (buf[0] > constBufSize) ? constBufSize : buf[0];
294 
295  if(rcode) {
296  // Restore p->epinfo
297  p->epinfo = oldep_ptr;
298 
299  goto FailGetDevDescr;
300  }
301 
302  // Restore p->epinfo
303  p->epinfo = oldep_ptr;
304 
305  // Allocate new address according to device class
306  bAddress = addrPool.AllocAddress(parent, false, port);
307 
308  if(!bAddress)
310 
311  // Extract Max Packet Size from the device descriptor
312  epInfo[0].maxPktSize = (uint8_t)((USB_DEVICE_DESCRIPTOR*)buf)->bMaxPacketSize0;
313 
314  // Assign new address to the device
315  rcode = pUsb->setAddr(0, 0, bAddress);
316 
317  if(rcode) {
318  p->lowspeed = false;
319  addrPool.FreeAddress(bAddress);
320  bAddress = 0;
321  USBTRACE2("setAddr:", rcode);
322  return rcode;
323  }
324  //delay(2); //per USB 2.0 sect.9.2.6.3
325 
326  USBTRACE2("Addr:", bAddress);
327 
328  p->lowspeed = false;
329 
330  p = addrPool.GetUsbDevicePtr(bAddress);
331 
332  if(!p)
334 
335  p->lowspeed = lowspeed;
336 
337  if(len)
338  rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*)buf);
339 
340  if(rcode)
341  goto FailGetDevDescr;
342 
343  num_of_conf = ((USB_DEVICE_DESCRIPTOR*)buf)->bNumConfigurations;
344 
345  USBTRACE2("NC:", num_of_conf);
346 
347  // GCC will optimize unused stuff away.
349  USBTRACE("HID_PROTOCOL_KEYBOARD AND MOUSE\r\n");
354  CP_MASK_COMPARE_ALL > confDescrParser(this);
355  confDescrParser.SetOR(); // Use the OR variant.
356  for(uint8_t i = 0; i < num_of_conf; i++) {
357  pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
358  if(bNumEP == (uint8_t)(totalEndpoints(BOOT_PROTOCOL)))
359  break;
360  }
361  } else {
362  // GCC will optimize unused stuff away.
363  if(BOOT_PROTOCOL & HID_PROTOCOL_KEYBOARD) {
364  USBTRACE("HID_PROTOCOL_KEYBOARD\r\n");
365  for(uint8_t i = 0; i < num_of_conf; i++) {
370  CP_MASK_COMPARE_ALL> confDescrParserA(this);
371 
372  pUsb->getConfDescr(bAddress, 0, i, &confDescrParserA);
373  if(bNumEP == (uint8_t)(totalEndpoints(BOOT_PROTOCOL)))
374  break;
375  }
376  }
377 
378  // GCC will optimize unused stuff away.
379  if(BOOT_PROTOCOL & HID_PROTOCOL_MOUSE) {
380  USBTRACE("HID_PROTOCOL_MOUSE\r\n");
381  for(uint8_t i = 0; i < num_of_conf; i++) {
386  CP_MASK_COMPARE_ALL> confDescrParserB(this);
387 
388  pUsb->getConfDescr(bAddress, 0, i, &confDescrParserB);
389  if(bNumEP == ((uint8_t)(totalEndpoints(BOOT_PROTOCOL))))
390  break;
391 
392  }
393  }
394  }
395  USBTRACE2("bNumEP:", bNumEP);
396 
397  if(bNumEP != (uint8_t)(totalEndpoints(BOOT_PROTOCOL))) {
399  goto Fail;
400  }
401 
402  // Assign epInfo to epinfo pointer
403  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
404  //USBTRACE2("setEpInfoEntry returned ", rcode);
405  USBTRACE2("Cnf:", bConfNum);
406 
407  delay(1000);
408 
409  // Set Configuration Value
410  rcode = pUsb->setConf(bAddress, 0, bConfNum);
411 
412  if(rcode)
413  goto FailSetConfDescr;
414 
415  delay(1000);
416 
417  USBTRACE2("bIfaceNum:", bIfaceNum);
418  USBTRACE2("bNumIface:", bNumIface);
419 
420  // Yes, mouse wants SetProtocol and SetIdle too!
421  for(uint8_t i = 0; i < epMUL(BOOT_PROTOCOL); i++) {
422  USBTRACE2("\r\nInterface:", i);
423  rcode = SetProtocol(i, HID_BOOT_PROTOCOL);
424  if(rcode) goto FailSetProtocol;
425  USBTRACE2("PROTOCOL SET HID_BOOT rcode:", rcode);
426  rcode = SetIdle(i, 0, 0);
427  USBTRACE2("SET_IDLE rcode:", rcode);
428  // if(rcode) goto FailSetIdle; This can fail.
429  // Get the RPIPE and just throw it away.
431  rcode = GetReportDescr(i, &sink);
432  USBTRACE2("RPIPE rcode:", rcode);
433  }
434 
435  // Get RPIPE and throw it away.
436 
437  if(BOOT_PROTOCOL & HID_PROTOCOL_KEYBOARD) {
438  // Wake keyboard interface by twinkling up to 5 LEDs that are in the spec.
439  // kana, compose, scroll, caps, num
440  rcode = 0x20; // Reuse rcode.
441  while(rcode) {
442  rcode >>= 1;
443  // Ignore any error returned, we don't care if LED is not supported
444  SetReport(0, 0, 2, 0, 1, &rcode); // Eventually becomes zero (All off)
445  delay(25);
446  }
447  }
448  USBTRACE("BM configured\r\n");
449 
450  bPollEnable = true;
451  return 0;
452 
453 FailGetDevDescr:
454 #ifdef DEBUG_USB_HOST
456  goto Fail;
457 #endif
458 
459  //FailSetDevTblEntry:
460  //#ifdef DEBUG_USB_HOST
461  // NotifyFailSetDevTblEntry();
462  // goto Fail;
463  //#endif
464 
465  //FailGetConfDescr:
466  //#ifdef DEBUG_USB_HOST
467  // NotifyFailGetConfDescr();
468  // goto Fail;
469  //#endif
470 
471 FailSetConfDescr:
472 #ifdef DEBUG_USB_HOST
474  goto Fail;
475 #endif
476 
477 FailSetProtocol:
478 #ifdef DEBUG_USB_HOST
479  USBTRACE("SetProto:");
480  goto Fail;
481 #endif
482 
483  //FailSetIdle:
484  //#ifdef DEBUG_USB_HOST
485  // USBTRACE("SetIdle:");
486  //#endif
487 
488 Fail:
489 #ifdef DEBUG_USB_HOST
490  NotifyFail(rcode);
491 #endif
492  Release();
493 
494  return rcode;
495 }
496 
497 template <const uint8_t BOOT_PROTOCOL>
498 void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
499 
500  // If the first configuration satisfies, the others are not considered.
501  //if(bNumEP > 1 && conf != bConfNum)
502  if(bNumEP == totalEndpoints(BOOT_PROTOCOL))
503  return;
504 
505  bConfNum = conf;
506  bIfaceNum = iface;
507 
508  if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80) {
509  if(pep->bInterval > bInterval) bInterval = pep->bInterval;
510 
511  // Fill in the endpoint info structure
512  epInfo[bNumEP].epAddr = (pep->bEndpointAddress & 0x0F);
513  epInfo[bNumEP].maxPktSize = (uint8_t)pep->wMaxPacketSize;
514  epInfo[bNumEP].epAttribs = 0;
515  epInfo[bNumEP].bmNakPower = USB_NAK_NOWAIT;
516  bNumEP++;
517 
518  }
519 }
520 
521 template <const uint8_t BOOT_PROTOCOL>
523  pUsb->GetAddressPool().FreeAddress(bAddress);
524 
525  bConfNum = 0;
526  bIfaceNum = 0;
527  bNumEP = 1;
528  bAddress = 0;
529  qNextPollTime = 0;
530  bPollEnable = false;
531 
532  return 0;
533 }
534 
535 template <const uint8_t BOOT_PROTOCOL>
537  uint8_t rcode = 0;
538 
539  if(bPollEnable && qNextPollTime <= millis()) {
540 
541  // To-do: optimize manually, using the for loop only if needed.
542  for(int i = 0; i < epMUL(BOOT_PROTOCOL); i++) {
543  const uint16_t const_buff_len = 16;
544  uint8_t buf[const_buff_len];
545 
546  USBTRACE3("(hidboot.h) i=", i, 0x81);
547  USBTRACE3("(hidboot.h) epInfo[epInterruptInIndex + i].epAddr=", epInfo[epInterruptInIndex + i].epAddr, 0x81);
548  USBTRACE3("(hidboot.h) epInfo[epInterruptInIndex + i].maxPktSize=", epInfo[epInterruptInIndex + i].maxPktSize, 0x81);
549  uint16_t read = (uint16_t)epInfo[epInterruptInIndex + i].maxPktSize;
550 
551  rcode = pUsb->inTransfer(bAddress, epInfo[epInterruptInIndex + i].epAddr, &read, buf);
552  // SOME buggy dongles report extra keys (like sleep) using a 2 byte packet on the wrong endpoint.
553  // Since keyboard and mice must report at least 3 bytes, we ignore the extra data.
554  if(!rcode && read > 2) {
555  if(pRptParser[i])
556  pRptParser[i]->Parse((HID*)this, 0, (uint8_t)read, buf);
557 #ifdef DEBUG_USB_HOST
558  // We really don't care about errors and anomalies unless we are debugging.
559  } else {
560  if(rcode != hrNAK) {
561  USBTRACE3("(hidboot.h) Poll:", rcode, 0x81);
562  }
563  if(!rcode && read) {
564  USBTRACE3("(hidboot.h) Strange read count: ", read, 0x80);
565  USBTRACE3("(hidboot.h) Interface:", i, 0x80);
566  }
567  }
568 
569  if(!rcode && read && (UsbDEBUGlvl > 0x7f)) {
570  for(uint8_t i = 0; i < read; i++) {
571  PrintHex<uint8_t > (buf[i], 0x80);
572  USBTRACE1(" ", 0x80);
573  }
574  if(read)
575  USBTRACE1("\r\n", 0x80);
576 #endif
577  }
578 
579  }
580  qNextPollTime = millis() + bInterval;
581  }
582  return rcode;
583 }
584 
585 #endif // __HIDBOOTMOUSE_H__
#define CP_MASK_COMPARE_ALL
uint8_t bmLeftShift
Definition: hidboot.h:87
EpInfo * epinfo
Definition: address.h:76
uint8_t bmKana
Definition: hidboot.h:117
uint8_t bmRightButton
Definition: hidboot.h:43
bool lowspeed
Definition: address.h:79
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:67
virtual const uint8_t * getSymKeysLo()
Definition: hidboot.h:169
virtual void OnRightButtonDown(MOUSEINFO *mi)
Definition: hidboot.h:75
virtual void OnKeyDown(uint8_t mod, uint8_t key)
Definition: hidboot.h:155
virtual uint8_t Poll()
Definition: hidboot.h:536
uint8_t bmLeftCtrl
Definition: hidboot.h:99
uint8_t bmRightShift
Definition: hidboot.h:104
#define NotifyFail(...)
Definition: message.h:55
virtual void OnMiddleButtonUp(MOUSEINFO *mi)
Definition: hidboot.h:78
virtual uint8_t HandleLockingKeys(HID *hid, uint8_t key)
Definition: hidboot.cpp:160
MOUSEINFO mouseInfo
Definition: hidboot.h:54
virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: hidboot.cpp:19
virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: hidboot.h:498
uint8_t bmCapsLock
Definition: hidboot.h:114
uint8_t bmNumLock
Definition: hidboot.h:113
union KeyboardReportParser::@14 kbdLockingKeys
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
uint8_t bAddress
Definition: hid.h:146
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: hidboot.h:247
union KeyboardReportParser::@13 prevState
virtual bool SetReportParser(uint8_t id, HIDReportParser *prs)
Definition: hidboot.h:201
virtual void OnKeyUp(uint8_t mod, uint8_t key)
Definition: hidboot.h:158
int UsbDEBUGlvl
Definition: message.cpp:22
uint8_t bmLeftGUI
Definition: hidboot.h:102
#define USB_CLASS_HID
Definition: UsbCore.h:43
virtual void FreeAddress(uint8_t addr)=0
#define HID_PROTOCOL_KEYBOARD
Definition: hid.h:93
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: hidboot.cpp:127
uint8_t bmReserved
Definition: hidboot.h:118
virtual const uint8_t * getSymKeysUp()
Definition: hidboot.h:165
#define HID_BOOT_PROTOCOL
Definition: hid.h:82
#define USBTRACE2(s, r)
Definition: macros.h:67
uint8_t bmMiddleButton
Definition: hidboot.h:44
virtual void OnLeftButtonUp(MOUSEINFO *mi)
Definition: hidboot.h:66
uint8_t bmDummy
Definition: hidboot.h:45
uint8_t bmLeftAlt
Definition: hidboot.h:88
virtual uint8_t GetAddress()
Definition: hidboot.h:211
HIDBoot(USB *p)
Definition: hidboot.h:220
#define USB_NAK_MAX_POWER
Definition: address.h:27
#define HID_BOOT_INTF_SUBCLASS
Definition: hid.h:89
uint8_t bInfo[sizeof(KBDINFO)]
Definition: hidboot.h:131
uint8_t bmRightCtrl
Definition: hidboot.h:103
uint8_t bInfo[sizeof(MOUSEINFO)]
Definition: hidboot.h:55
#define epMUL(p)
Definition: hidboot.h:34
Definition: address.h:32
virtual void OnMouseMove(MOUSEINFO *mi)
Definition: hidboot.h:63
#define hrNAK
Definition: max3421e.h:216
virtual void OnRightButtonUp(MOUSEINFO *mi)
Definition: hidboot.h:72
uint8_t bmLeftGUI
Definition: hidboot.h:89
uint16_t wMaxPacketSize
Definition: usb_ch9.h:146
Definition: hid.h:143
virtual void OnMiddleButtonDown(MOUSEINFO *mi)
Definition: hidboot.h:81
uint8_t bmRightCtrl
Definition: hidboot.h:90
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
uint8_t bEndpointAddress
Definition: usb_ch9.h:144
uint8_t bmRightGUI
Definition: hidboot.h:93
uint8_t bmScrollLock
Definition: hidboot.h:115
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:69
#define totalEndpoints(p)
Definition: hidboot.h:33
uint8_t bmLeftShift
Definition: hidboot.h:100
#define USBTRACE1(s, l)
Definition: macros.h:66
uint8_t bmRightShift
Definition: hidboot.h:91
#define USB_NAK_NOWAIT
Definition: address.h:29
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:66
int8_t dX
Definition: hidboot.h:47
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:61
virtual void OnControlKeysChanged(uint8_t before, uint8_t after)
Definition: hidboot.h:152
USB * pUsb
Definition: hid.h:145
virtual uint8_t Release()
Definition: hidboot.h:522
uint8_t bmRightGUI
Definition: hidboot.h:106
virtual void OnLeftButtonDown(MOUSEINFO *mi)
Definition: hidboot.h:69
virtual const uint8_t * getNumKeys()
Definition: hidboot.h:161
#define HID_PROTOCOL_MOUSE
Definition: hid.h:94
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:64
uint8_t bmLeftCtrl
Definition: hidboot.h:86
virtual const uint8_t * getPadKeys()
Definition: hidboot.h:173
uint8_t bmRightAlt
Definition: hidboot.h:92
int8_t dY
Definition: hidboot.h:48
Definition: UsbCore.h:176
uint8_t bmRightAlt
Definition: hidboot.h:105
uint8_t Keys[6]
Definition: hidboot.h:109
#define USBTRACE3(s, r, l)
Definition: macros.h:68
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:196
static const uint8_t totalEndpoints
Definition: hid.h:154
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
uint8_t bmCompose
Definition: hidboot.h:116
uint8_t bmLeftButton
Definition: hidboot.h:42
uint8_t bmLeftAlt
Definition: hidboot.h:101
uint8_t bReserved
Definition: hidboot.h:108
#define USBTRACE(s)
Definition: macros.h:65
uint8_t OemToAscii(uint8_t mod, uint8_t key)
Definition: hidboot.cpp:186