USB BARCODE READER
Fork of USBHOST by
USBHostHID/USBHostKeyboard.cpp@7:ccd0ac9ae1c9, 2018-07-02 (annotated)
- Committer:
- shivanandgowdakr
- Date:
- Mon Jul 02 12:10:45 2018 +0000
- Revision:
- 7:ccd0ac9ae1c9
- Parent:
- 5:fc157e6bd5a5
USB BARCODE READER ;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 1 | /* mbed USBHost Library |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 2 | * Copyright (c) 2006-2013 ARM Limited |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 3 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 5 | * you may not use this file except in compliance with the License. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 6 | * You may obtain a copy of the License at |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 7 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 9 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 10 | * Unless required by applicable law or agreed to in writing, software |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 13 | * See the License for the specific language governing permissions and |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 14 | * limitations under the License. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 15 | */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 16 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 17 | #include "USBHostKeyboard.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 18 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 19 | #if USBHOST_KEYBOARD |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 20 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 21 | static uint8_t keymap[4][0x39] = { |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 22 | //{ 0, 0, 0, 0, 'a', 'b' /*0x05*/, |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 23 | // 'c', 'd', 'e', 'f', 'g' /*0x0a*/, |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 24 | // 'h', 'i', 'j', 'k', 'l'/*0x0f*/, |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 25 | // 'm', 'n', 'o', 'p', 'q'/*0x14*/, |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 26 | // 'r', 's', 't', 'u', 'v'/*0x19*/, |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 27 | // 'w', 'x', 'y', 'z', '1'/*0x1E*/, |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 28 | // '2', '3', '4', '5', '6'/*0x23*/, |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 29 | // '7', '8', '9', '0', 0x0A /*enter*/, /*0x28*/ |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 30 | // 0x1B /*escape*/, 0x08 /*backspace*/, 0x09/*tab*/, 0x20/*space*/, '-', /*0x2d*/ |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 31 | // '=', '[', ']', '\\', '#', /*0x32*/ |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 32 | // ';', '\'', 0, ',', '.', /*0x37*/ |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 33 | // '/'}, |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 34 | |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 35 | { 0, 0, 0, 0, 'A', 'B' /*0x05*/, |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 36 | 'C', 'D', 'E', 'F', 'G' /*0x0a*/, |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 37 | 'H', 'I', 'J', 'K', 'L'/*0x0f*/, |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 38 | 'M', 'N', 'O', 'P', 'Q'/*0x14*/, |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 39 | 'R', 'S', 'T', 'U', 'V'/*0x19*/, |
shivanandgowdakr | 7:ccd0ac9ae1c9 | 40 | 'W', 'X', 'Y', 'Z', '1'/*0x1E*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 41 | '2', '3', '4', '5', '6'/*0x23*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 42 | '7', '8', '9', '0', 0x0A /*enter*/, /*0x28*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 43 | 0x1B /*escape*/, 0x08 /*backspace*/, 0x09/*tab*/, 0x20/*space*/, '-', /*0x2d*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 44 | '=', '[', ']', '\\', '#', /*0x32*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 45 | ';', '\'', 0, ',', '.', /*0x37*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 46 | '/'}, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 47 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 48 | /* CTRL MODIFIER */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 49 | { 0, 0, 0, 0, 0, 0 /*0x05*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 50 | 0, 0, 0, 0, 0 /*0x0a*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 51 | 0, 0, 0, 0, 0/*0x0f*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 52 | 0, 0, 0, 0, 0/*0x14*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 53 | 0, 0, 0, 0, 0/*0x19*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 54 | 0, 0, 0, 0, 0/*0x1E*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 55 | 0, 0, 0, 0, 0/*0x23*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 56 | 0, 0, 0, 0, 0 /*enter*/, /*0x28*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 57 | 0, 0, 0, 0, 0, /*0x2d*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 58 | 0, 0, 0, 0, 0, /*0x32*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 59 | 0, 0, 0, 0, 0, /*0x37*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 60 | 0}, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 61 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 62 | /* SHIFT MODIFIER */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 63 | { 0, 0, 0, 0, 'A', 'B' /*0x05*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 64 | 'C', 'D', 'E', 'F', 'G' /*0x0a*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 65 | 'H', 'I', 'J', 'K', 'L'/*0x0f*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 66 | 'M', 'N', 'O', 'P', 'Q'/*0x14*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 67 | 'R', 'S', 'T', 'U', 'V'/*0x19*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 68 | 'W', 'X', 'Y', 'Z', '!'/*0x1E*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 69 | '@', '#', '$', '%', '^'/*0x23*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 70 | '&', '*', '(', ')', 0, /*0x28*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 71 | 0, 0, 0, 0, 0, /*0x2d*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 72 | '+', '{', '}', '|', '~', /*0x32*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 73 | ':', '"', 0, '<', '>', /*0x37*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 74 | '?'}, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 75 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 76 | /* ALT MODIFIER */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 77 | { 0, 0, 0, 0, 0, 0 /*0x05*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 78 | 0, 0, 0, 0, 0 /*0x0a*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 79 | 0, 0, 0, 0, 0/*0x0f*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 80 | 0, 0, 0, 0, 0/*0x14*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 81 | 0, 0, 0, 0, 0/*0x19*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 82 | 0, 0, 0, 0, 0/*0x1E*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 83 | 0, 0, 0, 0, 0/*0x23*/, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 84 | 0, 0, 0, 0, 0 /*enter*/, /*0x28*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 85 | 0, 0, 0, 0, 0, /*0x2d*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 86 | 0, 0, 0, 0, 0, /*0x32*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 87 | 0, 0, 0, 0, 0, /*0x37*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 88 | 0} |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 89 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 90 | }; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 91 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 92 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 93 | USBHostKeyboard::USBHostKeyboard() { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 94 | host = USBHost::getHostInst(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 95 | init(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 96 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 97 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 98 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 99 | void USBHostKeyboard::init() { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 100 | dev = NULL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 101 | int_in = NULL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 102 | report_id = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 103 | onKey = NULL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 104 | onKeyCode = NULL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 105 | dev_connected = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 106 | keyboard_intf = -1; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 107 | keyboard_device_found = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 108 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 109 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 110 | bool USBHostKeyboard::connected() { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 111 | return dev_connected; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 112 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 113 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 114 | |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 115 | bool USBHostKeyboard::connect() |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 116 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 117 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 118 | if (dev_connected) { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 119 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 120 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 121 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 122 | for (uint8_t i = 0; i < MAX_DEVICE_CONNECTED; i++) { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 123 | if ((dev = host->getDevice(i)) != NULL) { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 124 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 125 | if (host->enumerate(dev, this)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 126 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 127 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 128 | if (keyboard_device_found) { |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 129 | { |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 130 | /* As this is done in a specific thread |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 131 | * this lock is taken to avoid to process the device |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 132 | * disconnect in usb process during the device registering */ |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 133 | USBHost::Lock Lock(host); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 134 | |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 135 | int_in = dev->getEndpoint(keyboard_intf, INTERRUPT_ENDPOINT, IN); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 136 | |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 137 | if (!int_in) |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 138 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 139 | |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 140 | USB_INFO("New Keyboard device: VID:%04x PID:%04x [dev: %p - intf: %d]", dev->getVid(), dev->getPid(), dev, keyboard_intf); |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 141 | dev->setName("Keyboard", keyboard_intf); |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 142 | host->registerDriver(dev, keyboard_intf, this, &USBHostKeyboard::init); |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 143 | |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 144 | int_in->attach(this, &USBHostKeyboard::rxHandler); |
frq08711@LMECWL0871.LME.ST.COM | 5:fc157e6bd5a5 | 145 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 146 | host->interruptRead(dev, int_in, report, int_in->getSize(), false); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 147 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 148 | dev_connected = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 149 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 150 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 151 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 152 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 153 | init(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 154 | return false; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 155 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 156 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 157 | void USBHostKeyboard::rxHandler() { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 158 | int len = int_in->getLengthTransferred(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 159 | int index = (len == 9) ? 1 : 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 160 | int len_listen = int_in->getSize(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 161 | uint8_t key = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 162 | if (len == 8 || len == 9) { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 163 | uint8_t modifier = (report[index] == 4) ? 3 : report[index]; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 164 | len_listen = len; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 165 | key = keymap[modifier][report[index + 2]]; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 166 | if (key && onKey) { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 167 | (*onKey)(key); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 168 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 169 | if ((report[index + 2] || modifier) && onKeyCode) { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 170 | (*onKeyCode)(report[index + 2], modifier); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 171 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 172 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 173 | if (dev && int_in) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 174 | host->interruptRead(dev, int_in, report, len_listen, false); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 175 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 176 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 177 | /*virtual*/ void USBHostKeyboard::setVidPid(uint16_t vid, uint16_t pid) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 178 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 179 | // we don't check VID/PID for keyboard driver |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 180 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 181 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 182 | /*virtual*/ bool USBHostKeyboard::parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol) //Must return true if the interface should be parsed |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 183 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 184 | if ((keyboard_intf == -1) && |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 185 | (intf_class == HID_CLASS) && |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 186 | (intf_subclass == 0x01) && |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 187 | (intf_protocol == 0x01)) { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 188 | keyboard_intf = intf_nb; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 189 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 190 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 191 | return false; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 192 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 193 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 194 | /*virtual*/ bool USBHostKeyboard::useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) //Must return true if the endpoint will be used |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 195 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 196 | if (intf_nb == keyboard_intf) { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 197 | if (type == INTERRUPT_ENDPOINT && dir == IN) { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 198 | keyboard_device_found = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 199 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 200 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 201 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 202 | return false; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 203 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 204 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 205 | #endif |