fuchsia.input.report

PROTOCOLS

InputDevice

Defined in fuchsia.input.report/device.fidl

An |InputDevice| driver represents a single physical input device. The InputDevice maintains an internal FIFO of |MAX_DEVICE_REPORT_COUNT| reports for each client that connects. Reports are removed from the FIFO once they are read by the client. If the FIFO is full, it will drop the oldest report to make room for an incoming report.

GetReportsEvent

Receive an event that will be signalled when there are reports in the Device's report FIFO. When there are events in the FIFO, |event| will have |DEV_STATE_READABLE| triggered. When the client has read all of the events, |DEV_STATE_READABLE| will be cleared.

Request

NameType

Response

NameType
status zx/status
event handle<event>

GetReports

Get all of the reports that have been seen since the last time this method was called. If this returns 0 reports, please wait on the report event.

Request

NameType

Response

NameType
reports vector<InputReport>[50]

GetDescriptor

Gets the device descriptor for this device.

Request

NameType

Response

NameType
descriptor DeviceDescriptor

STRUCTS

DeviceInfo

Defined in fuchsia.input.report/descriptor.fidl

DeviceInfo provides more information about the device and lets a client distinguish between devices (e.g between two touchscreens that come from different vendors). If the device is a HID device, then the id information will come from the device itself. Other, non-HID devices may assign the ids in the driver, so it will be the driver author's responsibility to assign sensible ids.

NameTypeDescriptionDefault
vendor_id uint32 No default
product_id uint32 No default
version uint32 No default
name string[256] No default

SensorAxis

Defined in fuchsia.input.report/sensor.fidl

A |SensorAxis| is a normal |Axis| with an additional |SensorType| to describe what the axis is measuring.

NameTypeDescriptionDefault
axis Axis No default
type SensorType No default

Range

Defined in fuchsia.input.report/units.fidl

Describe a |Range| of values.

NameTypeDescriptionDefault
min int64 No default
max int64 No default

Axis

Defined in fuchsia.input.report/units.fidl

An |Axis| is defined as a |range| and a |unit|.

NameTypeDescriptionDefault
range Range No default
unit Unit No default

ENUMS

SensorType

Type: uint32

Defined in fuchsia.input.report/sensor.fidl

Each sensor value has a corresponding SensorType, which explains what the value is measuring in the world.

NameValueDescription
ACCELEROMETER_X 1

Acceleration on the X axis.

ACCELEROMETER_Y 2

Acceleration on the Y axis.

ACCELEROMETER_Z 3

Acceleration on the Z axis.

MAGNETOMETER_X 4

Strength of the Magnetic Field in the X axis.

MAGNETOMETER_Y 5

Strength of the Magnetic Field in the Y axis.

MAGNETOMETER_Z 6

Strength of the Magnetic Field in the Z axis.

GYROSCOPE_X 7

Angular Velocity in the X direction moving counter-clockwise.

GYROSCOPE_Y 8

Angular Velocity in the Y direction moving counter-clockwise.

GYROSCOPE_Z 9

Angular Velocity in the Z direction moving counter-clockwise.

LIGHT_ILLUMINANCE 10

Ambient level of Light.

LIGHT_RED 11

Ambient level of Red Light.

LIGHT_GREEN 12

Ambient level of Green Light.

LIGHT_BLUE 13

Ambient level of Blue Light.

TouchType

Type: uint32

Defined in fuchsia.input.report/touch.fidl

The device type from which the touch originated.

NameValueDescription
TOUCHSCREEN 1

A touch screen has direct finger input associated with a display.

Unit

Type: uint32

Defined in fuchsia.input.report/units.fidl

This provides an easy, standardized way to specify units. New units can be added as needed. There should not be ambiguity between units, so no new units should be added that can be converted from the old units. (e.g: Please don't add DISTANCE_METERS since there is already DISTANCE).

NameValueDescription
NONE 0

The device did not specify units.

OTHER 1

The device specified units that are not convertible to any of the other units.

DISTANCE 2

A measurement of distance in 10^-6 meter units.

WEIGHT 3

A measurement of weight in 10^-3 gram units.

ROTATION 4

A measurement of rotation is 10^-3 degrees.

ANGULAR_VELOCITY 5

A measurement of angular velocity is 10^-3 deg/s.

LINEAR_VELOCITY 6

A measurement of linear velocity is 10^-3 m/s

ACCELERATION 7

A measurement of acceleration is 10^-3 Gs

MAGNETIC_FLUX 8

A measurement of magnetic_flux is 10^-6 T

LUMINOUS_FLUX 9

A measurement of light is 1 Candela

PRESSURE 10

A measurement of pressure is 10^-3 Pascal

LUX 11

TABLES

DeviceDescriptor

Defined in fuchsia.input.report/descriptor.fidl

|DeviceDescriptor| describes a physical input device. Some physical devices may send multiple types of reports (E.g: a physical touchscreen can send touch and stylus reports, so it will have both a TouchDescriptor and a StylusDescriptor).

OrdinalNameTypeDescription
1 device_info DeviceInfo

|device_info| should always be present to help distinguish between physical devices.

2 mouse MouseDescriptor

When |mouse| is present the device has a mouse.

3 sensor SensorDescriptor

When |sensor| is present the device has a sensor.

4 touch TouchDescriptor

When |touch| is present the device has a touch device. (E.g: Touchscreen, touchpad).

5 keyboard KeyboardDescriptor

When |keyboard| is present the device has a keyboard.

KeyboardDescriptor

Defined in fuchsia.input.report/keyboard.fidl

The capabilities of a keyboard device.

OrdinalNameTypeDescription
1 keys vector<fuchsia.ui.input2/Key>[150]

The list of keys that this keyboard contains.

KeyboardReport

Defined in fuchsia.input.report/keyboard.fidl

A single report created by a keyboard device.

OrdinalNameTypeDescription
1 pressed_keys vector<fuchsia.ui.input2/Key>[15]

The list of keys that are currently pressed down.

MouseDescriptor

Defined in fuchsia.input.report/mouse.fidl

|MouseDescriptor| describes the capabilities of a mouse.

OrdinalNameTypeDescription
1 movement_x Axis

The range of relative X movement.

2 movement_y Axis

The range of relative Y movement.

3 scroll_v Axis

The range of relative vertical scroll.

4 scroll_h Axis

The range of relative horizontal scroll.

5 buttons vector<uint8>[32]

This is a vector of id's for the mouse buttons.

MouseReport

Defined in fuchsia.input.report/mouse.fidl

|MouseReport| gives the relative movement of the mouse and currently pressed buttons. Relative means the movement seen between the previous report and this report. The client is responsble for tracking this and converting it to absolute movement.

OrdinalNameTypeDescription
1 movement_x int64

Relative X positional displacement.

2 movement_y int64

Relative Y positional displacement.

3 scroll_v int64

Relative vertical scrolling displacement.

4 scroll_h int64

Relative horizontal scrolling displacement.

5 pressed_buttons vector<uint8>[32]

A list of currently pressed buttons.

InputReport

Defined in fuchsia.input.report/report.fidl

|InputReport| is a single report that is created by an input device.

OrdinalNameTypeDescription
1 event_time zx/time

|event_time| is in nanoseconds when the event was recorded.

2 mouse MouseReport

|mouse| is the report generated if the device contains a mouse.

4 sensor SensorReport

|sensor| is the report generated if the device contains a sensor.

5 touch TouchReport

|touch| is the report generated if the device contains a touch device.

6 keyboard KeyboardReport

|keyboard| is the report generated if the device contains a keyboard.

3 trace_id uint64

Unique ID to connect trace async begin/end events.

SensorDescriptor

Defined in fuchsia.input.report/sensor.fidl

|SensorDescriptor| describes the capabilities of a sensor.

OrdinalNameTypeDescription
1 values vector<SensorAxis>[100]

Each |SensorAxis| in |values| describes what a sensor is measuring and its range. These will directly correspond to the values in |SensorReport|.

SensorReport

Defined in fuchsia.input.report/sensor.fidl

|SensorReport| gives the values measured by a sensor at a given point in time.

OrdinalNameTypeDescription
1 values vector<int64>[100]

The ordering of |values| will always directly correspond to the ordering of the values in |SensorDescriptor|.

ContactDescriptor

Defined in fuchsia.input.report/touch.fidl

ContactDescriptor describes the fields associated with a touch on a touch device.

OrdinalNameTypeDescription
1 position_x Axis

Describes the reporting of the x-axis.

2 position_y Axis

Describes the reporting of the y-axis.

3 pressure Axis

Pressure of the contact.

4 contact_width Axis

Width of the area of contact.

5 contact_height Axis

Height of the area of contact.

TouchDescriptor

Defined in fuchsia.input.report/touch.fidl

TouchDescriptor describes the fields associated with an individual touch device.

OrdinalNameTypeDescription
1 contacts vector<ContactDescriptor>[10]

The contact descriptors associated with this touch descriptor.

2 max_contacts uint32

The max number of contacts that this touch device can report at once.

3 touch_type TouchType

The type of touch device being used.

ContactReport

Defined in fuchsia.input.report/touch.fidl

Contact describes one touch on a touch device.

OrdinalNameTypeDescription
1 contact_id uint32

Identifier for this contact.

2 position_x int64

A contact's position on the x axis.

3 position_y int64

A contact's position on the y axis.

4 pressure int64

Pressure of the contact.

5 contact_width int64

Width of the bounding box around the touch contact. Combined with contact_height, this describes the area of the touch contact. contact_width and contact_height should both have units of distance, and they should be in the same units as position_x and position_y.

6 contact_height int64

Height of the bounding box around the touch contact. Combined with contact_width, this describes the area of the touch contact. contact_width and contact_height should both have units of distance, and they should be in the same units as position_x and position_y.

TouchReport

Defined in fuchsia.input.report/touch.fidl

TouchscreenReport describes the current contacts recorded by the touchscreen.

OrdinalNameTypeDescription
1 contacts vector<ContactReport>[10]

The contacts currently being reported by the device.

CONSTANTS

NameValueTypeDescription
MAX_DEVICE_NAME_LENGTH 256 uint32
MAX_DEVICE_REPORT_COUNT 50 uint32
KEYBOARD_MAX_NUM_KEYS 150 uint32

A hardcoded number of max keys. This should be increased in the future if we ever see keyboards with more keys.

KEYBOARD_MAX_PRESSED_KEYS 15 uint32

A hardcoded number of the maximum keys that can be pressed at a time. This should be increased in the future if we see keyboards that can handle more pressed keys.

MOUSE_MAX_NUM_BUTTONS 32 uint32

A hardcoded number of max mouse buttons. This should be increased in the future if we ever see mice with more buttons.

SENSOR_MAX_VALUES 100 uint32

A hardcoded number of max sensor values. This should be increased in the future if we ever see a sensor with more values.

TOUCH_MAX_CONTACTS 10 uint32

A hardcoded number of max contacts per report. This should be increased in the future if we see devices with more than the max amount.