blob: f30eae7aab95af480cbd5d76499e69e935f8a971 [file] [log] [blame]
// Copyright 2018 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 ddk.protocol.hidbus;
using zx;
enum HidDescriptionType : uint8 {
REPORT = 0x22;
};
enum HidReportType : uint8 {
INPUT = 1;
OUTPUT = 2;
FEATURE = 3;
};
enum HidProtocol : uint8 {
BOOT = 0;
REPORT = 0;
};
enum HidDeviceClass : uint8 {
OTHER = 0;
KBD = 1;
POINTER = 2;
KBD_POINTER = 3;
FIRST = 0;
LAST = 3;
};
struct HidInfo {
uint8 dev_num;
HidDeviceClass device_class;
bool boot_device;
};
[Layout = "ddk-interface"]
protocol HidbusIfc {
/// Queues a report received by the hidbus device.
IoQueue(vector<voidptr> buf) -> ();
};
[Layout = "ddk-protocol"]
protocol Hidbus {
/// Obtain information about the hidbus device and supported features.
/// Safe to call at any time.
Query(uint32 options) -> (zx.status s, HidInfo info);
/// Start the hidbus device. The device may begin queueing hid reports via
/// ifc->io_queue before this function returns. It is an error to start an
/// already-started hidbus device.
Start(HidbusIfc ifc) -> (zx.status s);
/// Stop the hidbus device. Safe to call if the hidbus is already stopped.
Stop() -> ();
/// What are the ownership semantics with regards to the data buffer passed back?
/// is len an input and output parameter?
GetDescriptor(HidDescriptionType desc_type) -> (zx.status s, vector<voidptr>? data);
GetReport(HidReportType rpt_type, uint8 rpt_id) -> (zx.status s, vector<voidptr> data);
SetReport(HidReportType rpt_type, uint8 rpt_id, vector<voidptr> data) -> (zx.status s);
GetIdle(uint8 rpt_id) -> (zx.status s, uint8 duration);
SetIdle(uint8 rpt_id, uint8 duration) -> (zx.status s);
GetProtocol() -> (zx.status s, HidProtocol protocol);
SetProtocol(HidProtocol protocol) -> (zx.status s);
};