libei/proto/ei.proto
Peter Hutterer ff9830c122 Add a sequence number to START_EMULATING
This makes it easier to correlate a particular input transaction
(whether there are events or not) with out-of-band information like the
planned portal InputCapture::Activated signal's "activation-id".
2023-02-09 11:48:29 +10:00

292 lines
6.8 KiB
Protocol Buffer

syntax = "proto3";
/**
* EI Protocol Specification
*
* This protocol is an internal implementation detail and subject to change
* at any time. This specification is for developers of libei only.
*
* ClientMessage → sent from the client to the server
* ServerMessage → sent from the server to the client
*
* A normal sequence consists of:
* [1. - client establishes connection to server
* 2. - client sends "Connect"
* 2.a - server replies with "Connected" or
* 2.b - server replies with "Disconnected" and closes its end of the socket
* 3. - server sends "AddSeat" (once or multiple times)
* 4. - client sends "BindSeat" for each seat
* 5. - server sends "DeviceAdded" for any device on this seat
* 6. - server sends "DeviceResumed"
* 7. - client sends "StartEmulating" to notify the server emulation starts
* 8. - client sends "PointerRelative" or any other event
* 9. - client sends "StopEmulating" to notify the server emulation starts
* 10. - client sends "CloseDevice"
* 11. - client sends "Disconnect" and closes its end of the socket
*
* The server may send Disconnect at any time.
* The server may send SeatRemoved for a device at any time.
* The server may send DeviceSuspended for any currently resumed device at any time.
* The server may send DeviceRemoved for a device at any time.
*
* Where a connection error occurs, the library (libei or libeis) will
* unroll the state as seen from the API.
*/
/* Request the server version. This request MAY be sent at any time and/or
* multiple times and the server always replies with the server's highest
* supported version, see Version.
*
* To avoid roundtrips during the initial connection, an EIS implementation
* *SHOULD* send a Version message immediately. A client thus may not need to
* request the version.
*
* The "ei" field is the constant string "EI" and helps identifying
* this connection in debugging tools.
*/
message GetVersion {
string ei = 1; /* always "EI" */
}
message Connect {
fixed32 version = 1; /* Must be equal or less to the server's GetVersion response */
string name = 2;
bool is_sender = 3;
}
message ConnectDone {
}
message Disconnect {
}
message BindSeat {
fixed32 seatid = 1;
fixed32 capabilities = 2;
}
message CloseDevice {
fixed32 deviceid = 1;
}
message PointerRelative {
fixed32 deviceid = 1;
double x = 2;
double y = 3;
}
message PointerAbsolute {
fixed32 deviceid = 1;
double x = 2;
double y = 3;
}
message PointerScroll {
fixed32 deviceid = 1;
double x = 2;
double y = 3;
}
message PointerScrollDiscrete {
fixed32 deviceid = 1;
double x = 2;
double y = 3;
}
message PointerScrollStop {
fixed32 deviceid = 1;
bool x = 2;
bool y = 3;
bool is_cancel = 4;
}
message PointerButton {
fixed32 deviceid = 1;
fixed32 button = 2;
bool state = 3;
}
message KeyboardKey {
fixed32 deviceid = 1;
fixed32 key = 2;
bool state = 3;
}
message TouchDown {
fixed32 deviceid = 1;
fixed32 touchid = 2;
double x = 5;
double y = 6;
}
message TouchMotion {
fixed32 deviceid = 1;
fixed32 touchid = 2;
double x = 5;
double y = 6;
}
message TouchUp {
fixed32 deviceid = 1;
fixed32 touchid = 2;
}
message StartEmulating {
fixed32 deviceid = 1;
fixed32 sequence = 2;
}
message StopEmulating {
fixed32 deviceid = 1;
}
message Frame {
fixed32 deviceid = 1;
uint64 timestamp = 2;
}
message ClientMessage {
oneof msg {
/* Client setup and configuration */
Connect connect = 1;
ConnectDone connect_done = 2;
Disconnect disconnect = 3;
BindSeat bind_seat = 4;
CloseDevice close_device = 6;
GetVersion get_version = 10;
/* Events */
StartEmulating start_emulating = 20;
StopEmulating stop_emulating = 21;
PointerRelative pointer_relative = 22;
PointerAbsolute pointer_absolute = 23;
PointerScroll pointer_scroll = 24;
PointerScrollDiscrete pointer_scroll_discrete = 25;
PointerScrollStop pointer_scroll_stop = 26;
PointerButton pointer_button = 27;
KeyboardKey keyboard_key = 28;
TouchDown touch_down = 29;
TouchMotion touch_motion = 30;
TouchUp touch_up = 31;
Frame frame = 32;
}
}
/**
* The highest version number supported by the server. This message SHOULD be
* sent by the EIS implementation immediately after a socket is
* created/obtained. This avoids roundtrips between the server and the client
* on connection.
*
* This message MAY be sent at any other time.
* This message MUST be sent in response to a GetVersion request.
*
* The "eis" field is the constant string "EIS" and helps identifying
* this connection in debugging tools.
*
* The content of this message never changes.
*/
message Version {
fixed32 version = 1;
string eis = 2; /* always "EIS" */
}
message Connected {
}
message Disconnected {
}
message SeatAdded {
fixed32 seatid = 1;
fixed32 capabilities = 2;
string name = 3;
}
message SeatRemoved {
fixed32 seatid = 1;
}
message DeviceAdded {
fixed32 deviceid = 1;
fixed32 capabilities = 2;
string name = 6;
fixed32 seatid = 7;
fixed32 type = 8;
fixed32 width = 9;
fixed32 height = 10;
}
message DeviceKeymap {
fixed32 deviceid = 1;
fixed32 keymap_type = 2;
fixed32 keymap_size = 3;
/* keymap itself is passed as fd */
}
message DeviceRegion {
fixed32 deviceid = 1;
fixed32 offset_x = 2;
fixed32 offset_y = 3;
fixed32 width = 4;
fixed32 height = 5;
double scale = 6;
}
message DeviceDone {
fixed32 deviceid = 1;
}
message DeviceRemoved {
fixed32 deviceid = 1;
}
message DeviceResumed {
fixed32 deviceid = 1;
}
message DevicePaused {
fixed32 deviceid = 1;
}
message KeyboardModifiers {
fixed32 deviceid = 1;
fixed32 depressed = 2;
fixed32 locked = 3;
fixed32 latched = 4;
fixed32 group = 5;
}
message ServerMessage {
oneof msg {
/* Server setup and configuration */
Connected connected = 2;
Disconnected disconnected = 3;
SeatAdded seat_added = 4;
SeatRemoved seat_removed = 5;
DeviceAdded device_added = 6;
DeviceRegion device_region = 7;
DeviceKeymap device_keymap = 8;
DeviceDone device_done = 9;
DeviceRemoved device_removed = 10;
DeviceResumed device_resumed = 11;
DevicePaused device_paused = 12;
KeyboardModifiers keyboard_modifiers = 13;
Version version = 15;
/* Events */
StartEmulating start_emulating = 20;
StopEmulating stop_emulating = 21;
PointerRelative pointer_relative = 22;
PointerAbsolute pointer_absolute = 23;
PointerScroll pointer_scroll = 24;
PointerScrollDiscrete pointer_scroll_discrete = 25;
PointerScrollStop pointer_scroll_stop = 26;
PointerButton pointer_button = 27;
KeyboardKey keyboard_key = 28;
TouchDown touch_down = 29;
TouchMotion touch_motion = 30;
TouchUp touch_up = 31;
Frame frame = 32;
}
}