1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef DEVICE_HID_HID_USAGE_AND_PAGE_H_ 6 #define DEVICE_HID_HID_USAGE_AND_PAGE_H_ 7 8 #include "base/basictypes.h" 9 10 namespace device { 11 12 struct HidUsageAndPage { 13 enum Page { 14 kPageUndefined = 0x00, 15 kPageGenericDesktop = 0x01, 16 kPageSimulation = 0x02, 17 kPageVirtualReality = 0x03, 18 kPageSport = 0x04, 19 kPageGame = 0x05, 20 kPageKeyboard = 0x07, 21 kPageLed = 0x08, 22 kPageButton = 0x09, 23 kPageOrdinal = 0x0A, 24 kPageTelephony = 0x0B, 25 kPageConsumer = 0x0C, 26 kPageDigitizer = 0x0D, 27 kPagePidPage = 0x0F, 28 kPageUnicode = 0x10, 29 kPageAlphanumericDisplay = 0x14, 30 kPageMedicalInstruments = 0x40, 31 kPageMonitor0 = 0x80, 32 kPageMonitor1 = 0x81, 33 kPageMonitor2 = 0x82, 34 kPageMonitor3 = 0x83, 35 kPagePower0 = 0x84, 36 kPagePower1 = 0x85, 37 kPagePower2 = 0x86, 38 kPagePower3 = 0x87, 39 kPageBarCodeScanner = 0x8C, 40 kPageScale = 0x8D, 41 kPageMagneticStripeReader = 0x8E, 42 kPageReservedPointOfSale = 0x8F, 43 kPageCameraControl = 0x90, 44 kPageArcade = 0x91, 45 kPageVendor = 0xFF00, 46 kPageMediaCenter = 0xFFBC 47 }; 48 49 // These usage enumerations are derived from the HID Usage Tables v1.11 spec. 50 enum GenericDesktopUsage { 51 kGenericDesktopUndefined = 0, 52 kGenericDesktopPointer = 1, 53 kGenericDesktopMouse = 2, 54 kGenericDesktopJoystick = 4, 55 kGenericDesktopGamePad = 5, 56 kGenericDesktopKeyboard = 6, 57 kGenericDesktopKeypad = 7, 58 kGenericDesktopMultiAxisController = 8, 59 kGenericDesktopX = 0x30, 60 kGenericDesktopY = 0x31, 61 kGenericDesktopZ = 0x32, 62 kGenericDesktopRx = 0x33, 63 kGenericDesktopRy = 0x34, 64 kGenericDesktopRz = 0x35, 65 kGenericDesktopSlider = 0x36, 66 kGenericDesktopDial = 0x37, 67 kGenericDesktopWheel = 0x38, 68 kGenericDesktopHatSwitch = 0x39, 69 kGenericDesktopCountedBuffer = 0x3a, 70 kGenericDesktopByteCount = 0x3b, 71 kGenericDesktopMotionWakeup = 0x3c, 72 kGenericDesktopStart = 0x3d, 73 kGenericDesktopSelect = 0x3e, 74 kGenericDesktopVx = 0x40, 75 kGenericDesktopVy = 0x41, 76 kGenericDesktopVz = 0x42, 77 kGenericDesktopVbrx = 0x43, 78 kGenericDesktopVbry = 0x44, 79 kGenericDesktopVbrz = 0x45, 80 kGenericDesktopVno = 0x46, 81 82 kGenericDesktopSystemControl = 0x80, 83 kGenericDesktopSystemPowerDown = 0x81, 84 kGenericDesktopSystemSleep = 0x82, 85 kGenericDesktopSystemWakeUp = 0x83, 86 kGenericDesktopSystemContextMenu = 0x84, 87 kGenericDesktopSystemMainMenu = 0x85, 88 kGenericDesktopSystemAppMenu = 0x86, 89 kGenericDesktopSystemMenuHelp = 0x87, 90 kGenericDesktopSystemMenuExit = 0x88, 91 kGenericDesktopSystemMenuSelect = 0x89, 92 kGenericDesktopSystemMenuRight = 0x8a, 93 kGenericDesktopSystemMenuLeft = 0x8b, 94 kGenericDesktopSystemMenuUp = 0x8c, 95 kGenericDesktopSystemMenuDown = 0x8d, 96 kGenericDesktopSystemColdRestart = 0x8e, 97 kGenericDesktopSystemWarmRestart = 0x8f, 98 99 kGenericDesktopDPadUp = 0x90, 100 kGenericDesktopDPadDown = 0x91, 101 kGenericDesktopDPadLeft = 0x92, 102 kGenericDesktopDPadRight = 0x93, 103 104 kGenericDesktopSystemDock = 0xa0, 105 kGenericDesktopSystemUndock = 0xa1, 106 kGenericDesktopSystemSetup = 0xa2, 107 kGenericDesktopSystemBreak = 0xa3, 108 kGenericDesktopSystemDebuggerBreak = 0xa4, 109 kGenericDesktopApplicationBreak = 0xa5, 110 kGenericDesktopApplicationDebuggerBreak = 0xa6, 111 kGenericDesktopSystemSpeakerMute = 0xa7, 112 kGenericDesktopSystemHibernate = 0xa8, 113 kGenericDesktopSystemDisplayInvert = 0xb0, 114 kGenericDesktopSystemDisplayInternal = 0xb1, 115 kGenericDesktopSystemDisplayExternal = 0xb2, 116 kGenericDesktopSystemDisplayBoth = 0xb3, 117 kGenericDesktopSystemDisplayDual = 0xb4, 118 kGenericDesktopSystemDisplayToggle = 0xb5, 119 kGenericDesktopSystemDisplaySwap = 0xb6, 120 }; 121 122 HidUsageAndPage(uint16_t usage, Page usage_page) 123 : usage(usage), usage_page(usage_page) {} 124 ~HidUsageAndPage() {} 125 126 uint16_t usage; 127 Page usage_page; 128 129 // Indicates whether this usage is protected by Chrome. 130 bool IsProtected() const; 131 }; 132 133 } // namespace device 134 135 #endif // DEVICE_HID_HID_USAGE_AND_PAGE_H_ 136