libvirtualhid 18
Cross-platform C++ library for virtual HID devices.
lvh Namespace Reference

Public libvirtualhid API namespace. More...

Classes

struct  BackendCapabilities
 Feature set exposed by the selected backend. More...
 
class  ButtonSet
 Compact set of pressed gamepad buttons. More...
 
struct  CreateGamepadOptions
 Full gamepad creation request. More...
 
struct  CreateKeyboardOptions
 Full keyboard creation request. More...
 
struct  CreateMouseOptions
 Full mouse creation request. More...
 
struct  CreatePenTabletOptions
 Full pen tablet creation request. More...
 
struct  CreateTouchscreenOptions
 Full touchscreen creation request. More...
 
struct  CreateTrackpadOptions
 Full trackpad creation request. More...
 
struct  DeviceNode
 Platform-visible node or path associated with a virtual device. More...
 
struct  DeviceProfile
 Descriptor and identity data used to create a virtual device. More...
 
class  Gamepad
 Virtual gamepad device handle. More...
 
struct  GamepadBattery
 Gamepad battery charge metadata. More...
 
struct  GamepadCreationResult
 Result returned by gamepad creation. More...
 
struct  GamepadMetadata
 Consumer-provided metadata for a gamepad device. More...
 
struct  GamepadOutput
 Normalized gamepad output event delivered to the consumer. More...
 
struct  GamepadProfileCapabilities
 Optional behavior advertised by a gamepad profile. More...
 
struct  GamepadState
 Common gamepad input state accepted by libvirtualhid. More...
 
struct  GamepadTouchContact
 Touchpad contact carried by a gamepad report. More...
 
class  Keyboard
 Virtual keyboard device handle. More...
 
struct  KeyboardCreationResult
 Result returned by keyboard creation. More...
 
struct  KeyboardEvent
 Keyboard key transition. More...
 
struct  KeyboardTextEvent
 UTF-8 text input request. More...
 
class  Mouse
 Virtual mouse device handle. More...
 
struct  MouseCreationResult
 Result returned by mouse creation. More...
 
struct  MouseEvent
 Mouse input event. More...
 
class  OperationStatus
 Result status with an error category and human-readable message. More...
 
class  PenTablet
 Virtual pen tablet device handle. More...
 
struct  PenTabletCreationResult
 Result returned by pen tablet creation. More...
 
struct  PenToolState
 Pen tablet tool position and analog state. More...
 
class  Runtime
 Runtime that owns backend state and creates virtual devices. More...
 
struct  RuntimeOptions
 Runtime creation options. More...
 
struct  Stick
 Normalized two-axis stick state. More...
 
struct  TouchContact
 Touch contact event for touchscreen and trackpad devices. More...
 
class  Touchscreen
 Virtual touchscreen device handle. More...
 
struct  TouchscreenCreationResult
 Result returned by touchscreen creation. More...
 
class  Trackpad
 Virtual trackpad device handle. More...
 
struct  TrackpadCreationResult
 Result returned by trackpad creation. More...
 
struct  Vector3
 Normalized three-axis sensor state. More...
 
class  VirtualDevice
 Common interface for virtual device handles. More...
 

Typedefs

using DeviceId = std::uint64_t
 Stable identifier assigned to a virtual device instance.
 
using KeyboardKeyCode = std::uint16_t
 Keyboard key code accepted by the keyboard event model.
 
using OutputCallback = std::function<void(const GamepadOutput &)>
 Callback invoked when a gamepad receives output from the backend.
 

Enumerations

enum class  BackendKind { fake , platform_default }
 Backend implementation selection. More...
 
enum class  BusType { unknown , usb , bluetooth }
 Transport bus identity advertised by a device profile. More...
 
enum class  ClientControllerType { unknown , xbox , playstation , nintendo }
 Controller family reported by a streaming client. More...
 
enum class  DeviceNodeKind {
  input_event , joystick , hidraw , sysfs ,
  other
}
 Platform device-node categories reported by virtual devices. More...
 
enum class  DeviceType {
  gamepad , keyboard , mouse , touchscreen ,
  trackpad , pen_tablet
}
 Device categories supported by the public profile model. More...
 
enum class  ErrorCode {
  ok , invalid_argument , backend_unavailable , device_closed ,
  unsupported_profile , backend_failure
}
 Error categories returned by libvirtualhid operations. More...
 
enum class  GamepadBatteryState : std::uint8_t {
  unknown , discharging , charging , full ,
  voltage_or_temperature_error , temperature_error , charging_error
}
 Common gamepad battery states. More...
 
enum class  GamepadButton : std::uint8_t {
  a = 0 , b , x , y ,
  back , start , guide , left_stick ,
  right_stick , left_shoulder , right_shoulder , dpad_up ,
  dpad_down , dpad_left , dpad_right , misc1
}
 Logical gamepad buttons accepted by the common gamepad state model. More...
 
enum class  GamepadOutputKind { rumble , rgb_led , adaptive_triggers , raw_report }
 Output report categories delivered by a gamepad backend. More...
 
enum class  GamepadProfileKind {
  generic , xbox_360 , xbox_one , xbox_series ,
  dualsense , switch_pro
}
 Built-in gamepad profile identifiers. More...
 
enum class  MouseButton : std::uint8_t {
  left = 0 , middle , right , side ,
  extra
}
 Mouse buttons accepted by the mouse event model. More...
 
enum class  MouseEventKind {
  relative_motion , absolute_motion , button , vertical_scroll ,
  horizontal_scroll
}
 Mouse event categories accepted by the mouse event model. More...
 
enum class  PenButton : std::uint8_t { primary , secondary , tertiary }
 Pen tablet buttons. More...
 
enum class  PenToolType : std::uint8_t {
  pen , eraser , brush , pencil ,
  airbrush , touch , unchanged
}
 Pen tablet tool categories. More...
 

Detailed Description

Public libvirtualhid API namespace.

Typedef Documentation

◆ KeyboardKeyCode

using lvh::KeyboardKeyCode = std::uint16_t

Keyboard key code accepted by the keyboard event model.

The initial Linux backend treats this as a Windows virtual-key code so streaming hosts can pass common client key codes without exposing platform backends. Backends translate this value to their native key representation.

Enumeration Type Documentation

◆ BackendKind

enum class lvh::BackendKind
strong

Backend implementation selection.

Enumerator
fake 

In-memory backend for tests and API validation.

platform_default 

Native backend for the current platform.

◆ BusType

enum class lvh::BusType
strong

Transport bus identity advertised by a device profile.

Enumerator
unknown 

Bus is unknown or not meaningful for the backend.

usb 

USB-style device identity.

bluetooth 

Bluetooth-style device identity.

◆ ClientControllerType

enum class lvh::ClientControllerType
strong

Controller family reported by a streaming client.

Enumerator
unknown 

Controller family is unknown.

xbox 

Xbox-style client controller.

playstation 

PlayStation-style client controller.

nintendo 

Nintendo-style client controller.

◆ DeviceNodeKind

enum class lvh::DeviceNodeKind
strong

Platform device-node categories reported by virtual devices.

Enumerator
input_event 

Linux /dev/input/event* node or equivalent.

joystick 

Linux /dev/input/js* node or equivalent.

hidraw 

Linux /dev/hidraw* node or equivalent.

sysfs 

Linux sysfs path or equivalent diagnostic path.

other 

Other platform-specific device path.

◆ DeviceType

enum class lvh::DeviceType
strong

Device categories supported by the public profile model.

Enumerator
gamepad 

Game controller device.

keyboard 

Keyboard device.

mouse 

Mouse or pointer device.

touchscreen 

Direct touch display device.

trackpad 

Indirect touchpad device.

pen_tablet 

Pen tablet device.

◆ ErrorCode

enum class lvh::ErrorCode
strong

Error categories returned by libvirtualhid operations.

Enumerator
ok 

Operation completed successfully.

invalid_argument 

Caller supplied invalid input.

backend_unavailable 

Requested backend is not available on this host.

device_closed 

Device operation was requested after the device closed.

unsupported_profile 

Backend cannot create the requested device profile.

backend_failure 

Backend-specific operation failed.

◆ GamepadBatteryState

enum class lvh::GamepadBatteryState : std::uint8_t
strong

Common gamepad battery states.

Enumerator
unknown 

Battery state is unknown.

discharging 

Battery is discharging.

charging 

Battery is charging.

full 

Battery is fully charged.

voltage_or_temperature_error 

Battery reports voltage or temperature outside the supported range.

temperature_error 

Battery reports a temperature error.

charging_error 

Battery reports a charging error.

◆ GamepadButton

enum class lvh::GamepadButton : std::uint8_t
strong

Logical gamepad buttons accepted by the common gamepad state model.

Enumerator

South face button.

East face button.

West face button.

North face button.

back 

Back, select, or share button.

start 

Start or options button.

guide 

System guide button.

left_stick 

Left stick press.

right_stick 

Right stick press.

left_shoulder 

Left shoulder button.

right_shoulder 

Right shoulder button.

dpad_up 

Directional pad up.

dpad_down 

Directional pad down.

dpad_left 

Directional pad left.

dpad_right 

Directional pad right.

misc1 

Profile-specific miscellaneous button.

◆ GamepadOutputKind

enum class lvh::GamepadOutputKind
strong

Output report categories delivered by a gamepad backend.

Enumerator
rumble 

Rumble motor output.

rgb_led 

RGB LED color output.

adaptive_triggers 

Adaptive trigger output.

raw_report 

Raw output report bytes.

◆ GamepadProfileKind

enum class lvh::GamepadProfileKind
strong

Built-in gamepad profile identifiers.

Enumerator
generic 

Generic HID gamepad profile.

xbox_360 

Xbox 360-compatible profile.

xbox_one 

Xbox One-compatible profile.

xbox_series 

Xbox Series-compatible profile.

dualsense 

PlayStation DualSense-compatible profile.

switch_pro 

Nintendo Switch Pro-compatible profile.

◆ MouseButton

enum class lvh::MouseButton : std::uint8_t
strong

Mouse buttons accepted by the mouse event model.

Enumerator
left 

Primary mouse button.

middle 

Middle mouse button.

right 

Secondary mouse button.

side 

First auxiliary mouse button.

extra 

Second auxiliary mouse button.

◆ MouseEventKind

enum class lvh::MouseEventKind
strong

Mouse event categories accepted by the mouse event model.

Enumerator
relative_motion 

Relative pointer movement.

absolute_motion 

Absolute pointer movement inside a target area.

button 

Mouse button transition.

vertical_scroll 

High-resolution vertical scroll event.

horizontal_scroll 

High-resolution horizontal scroll event.

◆ PenButton

enum class lvh::PenButton : std::uint8_t
strong

Pen tablet buttons.

Enumerator
primary 

Primary stylus button.

secondary 

Secondary stylus button.

tertiary 

Tertiary stylus button.

◆ PenToolType

enum class lvh::PenToolType : std::uint8_t
strong

Pen tablet tool categories.

Enumerator
pen 

Pen tool.

eraser 

Eraser tool.

brush 

Brush tool.

pencil 

Pencil tool.

airbrush 

Airbrush tool.

touch 

Direct touch tool.

unchanged 

Keep the previously selected tool.