1// Copyright 2017 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 5module device.mojom; 6 7// This input_service.mojom defines structs and interfaces for providing 8// information and notifiations about connected/disconnected input/HID 9// devices. 10 11enum InputDeviceSubsystem { 12 SUBSYSTEM_HID = 0, 13 SUBSYSTEM_INPUT = 1, 14 SUBSYSTEM_UNKNOWN = 2, 15}; 16 17enum InputDeviceType { 18 TYPE_BLUETOOTH = 0, 19 TYPE_USB = 1, 20 TYPE_SERIO = 2, 21 TYPE_UNKNOWN = 3, 22}; 23 24struct InputDeviceInfo { 25 string id; 26 string name; 27 InputDeviceSubsystem subsystem; 28 InputDeviceType type; 29 30 bool is_accelerometer; 31 bool is_joystick; 32 bool is_key; 33 bool is_keyboard; 34 bool is_mouse; 35 bool is_tablet; 36 bool is_touchpad; 37 bool is_touchscreen; 38}; 39 40interface InputDeviceManagerClient { 41 // Notifies the client that a device is added. 42 InputDeviceAdded(InputDeviceInfo device_info); 43 44 // Notifies the client that a device is removed. 45 InputDeviceRemoved(string id); 46}; 47 48interface InputDeviceManager { 49 // Returns list of all currently connected input/hid devices and set client 50 // to InputDeviceManager. The implementation of InputDeviceManager guarantees 51 // the returned callback is always posted earlier than InputDeviceAdded() 52 // and InputDeviceRemoved(). 53 GetDevicesAndSetClient( 54 pending_associated_remote<InputDeviceManagerClient> client) => 55 (array<InputDeviceInfo> devices); 56 57 // Returns list of all currently connected input/hid devices only. 58 GetDevices() => (array<InputDeviceInfo> devices); 59}; 60