ratbag_emu.device module

class ratbag_emu.device.Device(name, info, rdescs)

Bases: object

Represents a real device

Parameters
  • name (str) – Device name

  • info (Tuple[int, int, int]) – Bus information (bus, vid, pid)

  • rdescs (List[List[int]]) – Array of report descriptors

property actuators
Return type

List[Actuator]

destroy()
Return type

None

device_list: ClassVar[List[str]] = []
property event_nodes
Return type

List[str]

property hidraw_nodes
Return type

List[str]

property info
Return type

Tuple[int, int, int]

property name
Return type

str

property rdescs
Return type

List[List[int]]

send_hid_action(action)

Sends a HID action

We assume there’s only one endpoint for each type of action (mouse, keyboard, button, etc.) so we send the action to all endpoints. The endpoint will only act on the action if it supports it.

Parameters

action (object) – HID action

Return type

None

simulate_action(action)

Simulates action

Translates physical values according to the device properties and converts action into HID reports.

Parameters
  • action (Dict[str, Any]) – high-level action

  • type – HID report type

Return type

None

transform_action(data)

Transforms high-level action according to the actuators

A high-level action will have the x, y values in mm. This values will be converted to dots by the device actuators (in this case, the sensor/dpi actuator)

Parameters

action – high-level action

Return type

Dict[str, Any]