| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * Copyright (C) 2012 The Android Open Source Project | 
 | 3 |  * | 
 | 4 |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
 | 5 |  * you may not use this file except in compliance with the License. | 
 | 6 |  * You may obtain a copy of the License at | 
 | 7 |  * | 
 | 8 |  *      http://www.apache.org/licenses/LICENSE-2.0 | 
 | 9 |  * | 
 | 10 |  * Unless required by applicable law or agreed to in writing, software | 
 | 11 |  * distributed under the License is distributed on an "AS IS" BASIS, | 
 | 12 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
 | 13 |  * See the License for the specific language governing permissions and | 
 | 14 |  * limitations under the License. | 
 | 15 |  */ | 
 | 16 |  | 
 | 17 | #ifndef _LIBINPUT_INPUT_DEVICE_H | 
 | 18 | #define _LIBINPUT_INPUT_DEVICE_H | 
 | 19 |  | 
| Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 20 | #include <android/sensor.h> | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 21 | #include <input/Input.h> | 
 | 22 | #include <input/KeyCharacterMap.h> | 
| Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 23 | #include <unordered_map> | 
| Arthur Hung | 7c3ae9c | 2019-03-11 11:23:03 +0800 | [diff] [blame] | 24 | #include <vector> | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 25 |  | 
 | 26 | namespace android { | 
 | 27 |  | 
 | 28 | /* | 
 | 29 |  * Identifies a device. | 
 | 30 |  */ | 
 | 31 | struct InputDeviceIdentifier { | 
 | 32 |     inline InputDeviceIdentifier() : | 
 | 33 |             bus(0), vendor(0), product(0), version(0) { | 
 | 34 |     } | 
 | 35 |  | 
 | 36 |     // Information provided by the kernel. | 
| Siarhei Vishniakou | ec8f725 | 2018-07-06 11:19:32 +0100 | [diff] [blame] | 37 |     std::string name; | 
 | 38 |     std::string location; | 
 | 39 |     std::string uniqueId; | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 40 |     uint16_t bus; | 
 | 41 |     uint16_t vendor; | 
 | 42 |     uint16_t product; | 
 | 43 |     uint16_t version; | 
 | 44 |  | 
 | 45 |     // A composite input device descriptor string that uniquely identifies the device | 
 | 46 |     // even across reboots or reconnections.  The value of this field is used by | 
 | 47 |     // upper layers of the input system to associate settings with individual devices. | 
 | 48 |     // It is hashed from whatever kernel provided information is available. | 
 | 49 |     // Ideally, the way this value is computed should not change between Android releases | 
 | 50 |     // because that would invalidate persistent settings that rely on it. | 
| Siarhei Vishniakou | ec8f725 | 2018-07-06 11:19:32 +0100 | [diff] [blame] | 51 |     std::string descriptor; | 
| RoboErik | ec2a15a | 2013-12-19 11:54:29 -0800 | [diff] [blame] | 52 |  | 
 | 53 |     // A value added to uniquely identify a device in the absence of a unique id. This | 
 | 54 |     // is intended to be a minimum way to distinguish from other active devices and may | 
 | 55 |     // reuse values that are not associated with an input anymore. | 
 | 56 |     uint16_t nonce; | 
| Siarhei Vishniakou | b45635c | 2019-02-20 19:22:09 -0600 | [diff] [blame] | 57 |  | 
 | 58 |     /** | 
 | 59 |      * Return InputDeviceIdentifier.name that has been adjusted as follows: | 
 | 60 |      *     - all characters besides alphanumerics, dash, | 
 | 61 |      *       and underscore have been replaced with underscores. | 
 | 62 |      * This helps in situations where a file that matches the device name is needed, | 
 | 63 |      * while conforming to the filename limitations. | 
 | 64 |      */ | 
 | 65 |     std::string getCanonicalName() const; | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 66 | }; | 
 | 67 |  | 
| Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 68 | /* Types of input device sensors. Keep sync with core/java/android/hardware/Sensor.java */ | 
 | 69 | enum class InputDeviceSensorType : int32_t { | 
 | 70 |     ACCELEROMETER = ASENSOR_TYPE_ACCELEROMETER, | 
 | 71 |     MAGNETIC_FIELD = ASENSOR_TYPE_MAGNETIC_FIELD, | 
 | 72 |     ORIENTATION = 3, | 
 | 73 |     GYROSCOPE = ASENSOR_TYPE_GYROSCOPE, | 
 | 74 |     LIGHT = ASENSOR_TYPE_LIGHT, | 
 | 75 |     PRESSURE = ASENSOR_TYPE_PRESSURE, | 
 | 76 |     TEMPERATURE = 7, | 
 | 77 |     PROXIMITY = ASENSOR_TYPE_PROXIMITY, | 
 | 78 |     GRAVITY = ASENSOR_TYPE_GRAVITY, | 
 | 79 |     LINEAR_ACCELERATION = ASENSOR_TYPE_LINEAR_ACCELERATION, | 
 | 80 |     ROTATION_VECTOR = ASENSOR_TYPE_ROTATION_VECTOR, | 
 | 81 |     RELATIVE_HUMIDITY = ASENSOR_TYPE_RELATIVE_HUMIDITY, | 
 | 82 |     AMBIENT_TEMPERATURE = ASENSOR_TYPE_AMBIENT_TEMPERATURE, | 
 | 83 |     MAGNETIC_FIELD_UNCALIBRATED = ASENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED, | 
 | 84 |     GAME_ROTATION_VECTOR = ASENSOR_TYPE_GAME_ROTATION_VECTOR, | 
 | 85 |     GYROSCOPE_UNCALIBRATED = ASENSOR_TYPE_GYROSCOPE_UNCALIBRATED, | 
 | 86 |     SIGNIFICANT_MOTION = ASENSOR_TYPE_SIGNIFICANT_MOTION, | 
 | 87 | }; | 
 | 88 |  | 
 | 89 | enum class InputDeviceSensorAccuracy : int32_t { | 
 | 90 |     ACCURACY_NONE = 0, | 
 | 91 |     ACCURACY_LOW = 1, | 
 | 92 |     ACCURACY_MEDIUM = 2, | 
 | 93 |     ACCURACY_HIGH = 3, | 
 | 94 | }; | 
 | 95 |  | 
 | 96 | enum class InputDeviceSensorReportingMode : int32_t { | 
 | 97 |     CONTINUOUS = 0, | 
 | 98 |     ON_CHANGE = 1, | 
 | 99 |     ONE_SHOT = 2, | 
 | 100 |     SPECIAL_TRIGGER = 3, | 
 | 101 | }; | 
 | 102 |  | 
| Chris Ye | 3fdbfef | 2021-01-06 18:45:18 -0800 | [diff] [blame] | 103 | enum class InputDeviceLightType : int32_t { | 
| Chris Ye | 8575833 | 2021-05-16 23:05:17 -0700 | [diff] [blame] | 104 |     MONO = 0, | 
| Chris Ye | 3fdbfef | 2021-01-06 18:45:18 -0800 | [diff] [blame] | 105 |     PLAYER_ID = 1, | 
 | 106 |     RGB = 2, | 
 | 107 |     MULTI_COLOR = 3, | 
 | 108 | }; | 
 | 109 |  | 
| Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 110 | struct InputDeviceSensorInfo { | 
 | 111 |     explicit InputDeviceSensorInfo(std::string name, std::string vendor, int32_t version, | 
 | 112 |                                    InputDeviceSensorType type, InputDeviceSensorAccuracy accuracy, | 
 | 113 |                                    float maxRange, float resolution, float power, int32_t minDelay, | 
 | 114 |                                    int32_t fifoReservedEventCount, int32_t fifoMaxEventCount, | 
 | 115 |                                    std::string stringType, int32_t maxDelay, int32_t flags, | 
 | 116 |                                    int32_t id) | 
 | 117 |           : name(name), | 
 | 118 |             vendor(vendor), | 
 | 119 |             version(version), | 
 | 120 |             type(type), | 
 | 121 |             accuracy(accuracy), | 
 | 122 |             maxRange(maxRange), | 
 | 123 |             resolution(resolution), | 
 | 124 |             power(power), | 
 | 125 |             minDelay(minDelay), | 
 | 126 |             fifoReservedEventCount(fifoReservedEventCount), | 
 | 127 |             fifoMaxEventCount(fifoMaxEventCount), | 
 | 128 |             stringType(stringType), | 
 | 129 |             maxDelay(maxDelay), | 
 | 130 |             flags(flags), | 
 | 131 |             id(id) {} | 
 | 132 |     // Name string of the sensor. | 
 | 133 |     std::string name; | 
 | 134 |     // Vendor string of this sensor. | 
 | 135 |     std::string vendor; | 
 | 136 |     // Version of the sensor's module. | 
 | 137 |     int32_t version; | 
 | 138 |     // Generic type of this sensor. | 
 | 139 |     InputDeviceSensorType type; | 
 | 140 |     // The current accuracy of sensor event. | 
 | 141 |     InputDeviceSensorAccuracy accuracy; | 
 | 142 |     // Maximum range of the sensor in the sensor's unit. | 
 | 143 |     float maxRange; | 
 | 144 |     // Resolution of the sensor in the sensor's unit. | 
 | 145 |     float resolution; | 
 | 146 |     // The power in mA used by this sensor while in use. | 
 | 147 |     float power; | 
 | 148 |     // The minimum delay allowed between two events in microsecond or zero if this sensor only | 
 | 149 |     // returns a value when the data it's measuring changes. | 
 | 150 |     int32_t minDelay; | 
 | 151 |     // Number of events reserved for this sensor in the batch mode FIFO. | 
 | 152 |     int32_t fifoReservedEventCount; | 
 | 153 |     // Maximum number of events of this sensor that could be batched. | 
 | 154 |     int32_t fifoMaxEventCount; | 
 | 155 |     // The type of this sensor as a string. | 
 | 156 |     std::string stringType; | 
 | 157 |     // The delay between two sensor events corresponding to the lowest frequency that this sensor | 
 | 158 |     // supports. | 
 | 159 |     int32_t maxDelay; | 
 | 160 |     // Sensor flags | 
 | 161 |     int32_t flags; | 
 | 162 |     // Sensor id, same as the input device ID it belongs to. | 
 | 163 |     int32_t id; | 
 | 164 | }; | 
 | 165 |  | 
| Chris Ye | 3fdbfef | 2021-01-06 18:45:18 -0800 | [diff] [blame] | 166 | struct InputDeviceLightInfo { | 
 | 167 |     explicit InputDeviceLightInfo(std::string name, int32_t id, InputDeviceLightType type, | 
 | 168 |                                   int32_t ordinal) | 
 | 169 |           : name(name), id(id), type(type), ordinal(ordinal) {} | 
 | 170 |     // Name string of the light. | 
 | 171 |     std::string name; | 
 | 172 |     // Light id | 
 | 173 |     int32_t id; | 
 | 174 |     // Type of the light. | 
 | 175 |     InputDeviceLightType type; | 
 | 176 |     // Ordinal of the light | 
 | 177 |     int32_t ordinal; | 
 | 178 | }; | 
 | 179 |  | 
| Chris Ye | e2b1e5c | 2021-03-10 22:45:12 -0800 | [diff] [blame] | 180 | struct InputDeviceBatteryInfo { | 
 | 181 |     explicit InputDeviceBatteryInfo(std::string name, int32_t id) : name(name), id(id) {} | 
 | 182 |     // Name string of the battery. | 
 | 183 |     std::string name; | 
 | 184 |     // Battery id | 
 | 185 |     int32_t id; | 
 | 186 | }; | 
 | 187 |  | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 188 | /* | 
 | 189 |  * Describes the characteristics and capabilities of an input device. | 
 | 190 |  */ | 
 | 191 | class InputDeviceInfo { | 
 | 192 | public: | 
 | 193 |     InputDeviceInfo(); | 
 | 194 |     InputDeviceInfo(const InputDeviceInfo& other); | 
 | 195 |     ~InputDeviceInfo(); | 
 | 196 |  | 
 | 197 |     struct MotionRange { | 
 | 198 |         int32_t axis; | 
 | 199 |         uint32_t source; | 
 | 200 |         float min; | 
 | 201 |         float max; | 
 | 202 |         float flat; | 
 | 203 |         float fuzz; | 
 | 204 |         float resolution; | 
 | 205 |     }; | 
 | 206 |  | 
| Michael Wright | 0415d63 | 2013-07-17 13:23:26 -0700 | [diff] [blame] | 207 |     void initialize(int32_t id, int32_t generation, int32_t controllerNumber, | 
| Siarhei Vishniakou | ec8f725 | 2018-07-06 11:19:32 +0100 | [diff] [blame] | 208 |             const InputDeviceIdentifier& identifier, const std::string& alias, bool isExternal, | 
| Tim Kilbourn | 063ff53 | 2015-04-08 10:26:18 -0700 | [diff] [blame] | 209 |             bool hasMic); | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 210 |  | 
 | 211 |     inline int32_t getId() const { return mId; } | 
| Michael Wright | 0415d63 | 2013-07-17 13:23:26 -0700 | [diff] [blame] | 212 |     inline int32_t getControllerNumber() const { return mControllerNumber; } | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 213 |     inline int32_t getGeneration() const { return mGeneration; } | 
 | 214 |     inline const InputDeviceIdentifier& getIdentifier() const { return mIdentifier; } | 
| Siarhei Vishniakou | ec8f725 | 2018-07-06 11:19:32 +0100 | [diff] [blame] | 215 |     inline const std::string& getAlias() const { return mAlias; } | 
 | 216 |     inline const std::string& getDisplayName() const { | 
 | 217 |         return mAlias.empty() ? mIdentifier.name : mAlias; | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 218 |     } | 
 | 219 |     inline bool isExternal() const { return mIsExternal; } | 
| Tim Kilbourn | 063ff53 | 2015-04-08 10:26:18 -0700 | [diff] [blame] | 220 |     inline bool hasMic() const { return mHasMic; } | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 221 |     inline uint32_t getSources() const { return mSources; } | 
 | 222 |  | 
 | 223 |     const MotionRange* getMotionRange(int32_t axis, uint32_t source) const; | 
 | 224 |  | 
 | 225 |     void addSource(uint32_t source); | 
 | 226 |     void addMotionRange(int32_t axis, uint32_t source, | 
 | 227 |             float min, float max, float flat, float fuzz, float resolution); | 
 | 228 |     void addMotionRange(const MotionRange& range); | 
| Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 229 |     void addSensorInfo(const InputDeviceSensorInfo& info); | 
| Chris Ye | e2b1e5c | 2021-03-10 22:45:12 -0800 | [diff] [blame] | 230 |     void addBatteryInfo(const InputDeviceBatteryInfo& info); | 
| Chris Ye | 3fdbfef | 2021-01-06 18:45:18 -0800 | [diff] [blame] | 231 |     void addLightInfo(const InputDeviceLightInfo& info); | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 232 |  | 
 | 233 |     inline void setKeyboardType(int32_t keyboardType) { mKeyboardType = keyboardType; } | 
 | 234 |     inline int32_t getKeyboardType() const { return mKeyboardType; } | 
 | 235 |  | 
| Chris Ye | 3a1e446 | 2020-08-12 10:13:15 -0700 | [diff] [blame] | 236 |     inline void setKeyCharacterMap(const std::shared_ptr<KeyCharacterMap> value) { | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 237 |         mKeyCharacterMap = value; | 
 | 238 |     } | 
 | 239 |  | 
| Chris Ye | 3a1e446 | 2020-08-12 10:13:15 -0700 | [diff] [blame] | 240 |     inline const std::shared_ptr<KeyCharacterMap> getKeyCharacterMap() const { | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 241 |         return mKeyCharacterMap; | 
 | 242 |     } | 
 | 243 |  | 
 | 244 |     inline void setVibrator(bool hasVibrator) { mHasVibrator = hasVibrator; } | 
 | 245 |     inline bool hasVibrator() const { return mHasVibrator; } | 
 | 246 |  | 
| Kim Low | 03ea035 | 2020-11-06 12:45:07 -0800 | [diff] [blame] | 247 |     inline void setHasBattery(bool hasBattery) { mHasBattery = hasBattery; } | 
 | 248 |     inline bool hasBattery() const { return mHasBattery; } | 
 | 249 |  | 
| Michael Wright | 931fd6d | 2013-07-10 18:05:15 -0700 | [diff] [blame] | 250 |     inline void setButtonUnderPad(bool hasButton) { mHasButtonUnderPad = hasButton; } | 
 | 251 |     inline bool hasButtonUnderPad() const { return mHasButtonUnderPad; } | 
 | 252 |  | 
| Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 253 |     inline void setHasSensor(bool hasSensor) { mHasSensor = hasSensor; } | 
 | 254 |     inline bool hasSensor() const { return mHasSensor; } | 
 | 255 |  | 
| Arthur Hung | 7c3ae9c | 2019-03-11 11:23:03 +0800 | [diff] [blame] | 256 |     inline const std::vector<MotionRange>& getMotionRanges() const { | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 257 |         return mMotionRanges; | 
 | 258 |     } | 
 | 259 |  | 
| Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 260 |     const InputDeviceSensorInfo* getSensorInfo(InputDeviceSensorType type); | 
 | 261 |  | 
 | 262 |     const std::vector<InputDeviceSensorType> getSensorTypes(); | 
 | 263 |  | 
| Chris Ye | 3fdbfef | 2021-01-06 18:45:18 -0800 | [diff] [blame] | 264 |     const std::vector<int32_t> getLightIds(); | 
 | 265 |  | 
 | 266 |     const InputDeviceLightInfo* getLightInfo(int32_t id); | 
 | 267 |  | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 268 | private: | 
 | 269 |     int32_t mId; | 
 | 270 |     int32_t mGeneration; | 
| Michael Wright | 0415d63 | 2013-07-17 13:23:26 -0700 | [diff] [blame] | 271 |     int32_t mControllerNumber; | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 272 |     InputDeviceIdentifier mIdentifier; | 
| Siarhei Vishniakou | ec8f725 | 2018-07-06 11:19:32 +0100 | [diff] [blame] | 273 |     std::string mAlias; | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 274 |     bool mIsExternal; | 
| Tim Kilbourn | 063ff53 | 2015-04-08 10:26:18 -0700 | [diff] [blame] | 275 |     bool mHasMic; | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 276 |     uint32_t mSources; | 
 | 277 |     int32_t mKeyboardType; | 
| Chris Ye | 3a1e446 | 2020-08-12 10:13:15 -0700 | [diff] [blame] | 278 |     std::shared_ptr<KeyCharacterMap> mKeyCharacterMap; | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 279 |     bool mHasVibrator; | 
| Kim Low | 03ea035 | 2020-11-06 12:45:07 -0800 | [diff] [blame] | 280 |     bool mHasBattery; | 
| Michael Wright | 931fd6d | 2013-07-10 18:05:15 -0700 | [diff] [blame] | 281 |     bool mHasButtonUnderPad; | 
| Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 282 |     bool mHasSensor; | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 283 |  | 
| Arthur Hung | 7c3ae9c | 2019-03-11 11:23:03 +0800 | [diff] [blame] | 284 |     std::vector<MotionRange> mMotionRanges; | 
| Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 285 |     std::unordered_map<InputDeviceSensorType, InputDeviceSensorInfo> mSensors; | 
| Chris Ye | 3fdbfef | 2021-01-06 18:45:18 -0800 | [diff] [blame] | 286 |     /* Map from light ID to light info */ | 
 | 287 |     std::unordered_map<int32_t, InputDeviceLightInfo> mLights; | 
| Chris Ye | e2b1e5c | 2021-03-10 22:45:12 -0800 | [diff] [blame] | 288 |     /* Map from battery ID to battery info */ | 
 | 289 |     std::unordered_map<int32_t, InputDeviceBatteryInfo> mBatteries; | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 290 | }; | 
 | 291 |  | 
 | 292 | /* Types of input device configuration files. */ | 
| Chris Ye | 1d927aa | 2020-07-04 18:22:41 -0700 | [diff] [blame] | 293 | enum class InputDeviceConfigurationFileType : int32_t { | 
 | 294 |     CONFIGURATION = 0,     /* .idc file */ | 
 | 295 |     KEY_LAYOUT = 1,        /* .kl file */ | 
 | 296 |     KEY_CHARACTER_MAP = 2, /* .kcm file */ | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 297 | }; | 
 | 298 |  | 
 | 299 | /* | 
 | 300 |  * Gets the path of an input device configuration file, if one is available. | 
 | 301 |  * Considers both system provided and user installed configuration files. | 
 | 302 |  * | 
 | 303 |  * The device identifier is used to construct several default configuration file | 
 | 304 |  * names to try based on the device name, vendor, product, and version. | 
 | 305 |  * | 
 | 306 |  * Returns an empty string if not found. | 
 | 307 |  */ | 
| Siarhei Vishniakou | ec8f725 | 2018-07-06 11:19:32 +0100 | [diff] [blame] | 308 | extern std::string getInputDeviceConfigurationFilePathByDeviceIdentifier( | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 309 |         const InputDeviceIdentifier& deviceIdentifier, | 
 | 310 |         InputDeviceConfigurationFileType type); | 
 | 311 |  | 
 | 312 | /* | 
 | 313 |  * Gets the path of an input device configuration file, if one is available. | 
 | 314 |  * Considers both system provided and user installed configuration files. | 
 | 315 |  * | 
 | 316 |  * The name is case-sensitive and is used to construct the filename to resolve. | 
 | 317 |  * All characters except 'a'-'z', 'A'-'Z', '0'-'9', '-', and '_' are replaced by underscores. | 
 | 318 |  * | 
 | 319 |  * Returns an empty string if not found. | 
 | 320 |  */ | 
| Siarhei Vishniakou | ec8f725 | 2018-07-06 11:19:32 +0100 | [diff] [blame] | 321 | extern std::string getInputDeviceConfigurationFilePathByName( | 
 | 322 |         const std::string& name, InputDeviceConfigurationFileType type); | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 323 |  | 
| Prabir Pradhan | cae4b3a | 2019-02-05 18:51:32 -0800 | [diff] [blame] | 324 | enum ReservedInputDeviceId : int32_t { | 
 | 325 |     // Device id of a special "virtual" keyboard that is always present. | 
 | 326 |     VIRTUAL_KEYBOARD_ID = -1, | 
 | 327 |     // Device id of the "built-in" keyboard if there is one. | 
 | 328 |     BUILT_IN_KEYBOARD_ID = 0, | 
| Nathaniel R. Lewis | a7b82e1 | 2020-02-12 15:40:45 -0800 | [diff] [blame] | 329 |     // First device id available for dynamic devices | 
 | 330 |     END_RESERVED_ID = 1, | 
| Prabir Pradhan | cae4b3a | 2019-02-05 18:51:32 -0800 | [diff] [blame] | 331 | }; | 
 | 332 |  | 
| Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 333 | } // namespace android | 
 | 334 |  | 
 | 335 | #endif // _LIBINPUT_INPUT_DEVICE_H |