| // Copyright 2019 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.hardware.hidctl; |
| |
| using zx; |
| |
| const MAX_RPT_DESC_LEN uint32 = 8196; |
| |
| @for_deprecated_c_bindings |
| type HidCtlConfig = struct { |
| /// The device number. This is used in print statements to identify the device. Can be set to |
| /// any value. |
| dev_num uint8; |
| /// If this is set to true, the hid driver will force the device to use either the boot mouse or |
| /// boot keyboard report descriptor. |
| boot_device bool; |
| /// This sets the device class of the HID device. A list of device classes can be found in |
| /// hidbus.banjo in the HidDeviceClass enum. |
| dev_class uint8; |
| }; |
| |
| /// Interface for creating a fake HID device. |
| /// |
| /// The device is controlled through a socket that can Read/Write HID reports. When the socket |
| /// is closed the device will remove itself from the system. |
| @for_deprecated_c_bindings |
| protocol Device { |
| /// Create a fake HID device with a given report descriptor. Returns a |
| /// socket that can Read/Write HID reports. |
| MakeHidDevice(struct { |
| config HidCtlConfig; |
| rpt_desc vector<uint8>:MAX_RPT_DESC_LEN; |
| }) -> (resource struct { |
| report_socket zx.handle:SOCKET; |
| }); |
| }; |