17 .Buffer = Buffers::ProcessingToken::INPUT_BACKEND,
18 .Node = Nodes::ProcessingToken::EVENT_RATE,
19 .Task = Vruta::ProcessingToken::EVENT_DRIVEN
38 "Initializing Input Subsystem...");
64 "Input Subsystem initialized with {} backend(s)",
m_backends.size());
71 auto input_service = std::make_shared<Registry::Service::InputService>();
73 input_service->get_all_devices = [
this]() {
77 input_service->open_device = [
this](
InputType type, uint32_t id) {
81 input_service->close_device = [
this](
InputType type, uint32_t id) {
88 [input_service]() ->
void* {
89 return input_service.get();
97 "Cannot start InputSubsystem: not initialized");
117 "Input Subsystem started");
167 "Input Subsystem stopped");
194 "Input Subsystem shutdown complete");
199 while (!
m_running.load(std::memory_order_acquire))
200 std::this_thread::yield();
218 "Backend type {} already registered",
static_cast<int>(
type));
222 if (!backend->initialize()) {
224 "Failed to initialize backend: {}", backend->get_name());
242 return (it !=
m_backends.end()) ? it->second.get() :
nullptr;
248 std::vector<IInputBackend*> result;
251 result.push_back(backend.get());
263 std::vector<InputDeviceInfo> result;
265 auto devices = backend->get_devices();
266 result.insert(result.end(), devices.begin(), devices.end());
277 "Backend not found for device open request");
280 return it->second->open_device(device_id);
288 it->second->close_device(device_id);
304 "Device {}: {} ({})",
305 connected ?
"connected" :
"disconnected",
319 auto hid = std::make_unique<HIDBackend>(hid_config);
324 for (
const auto& dev : backend->get_devices()) {
333 MIDIBackend::Config midi_config;
338#if !defined(MAYAFLUX_PLATFORM_WINDOWS)
344 auto midi = std::make_unique<MIDIBackend>(midi_config);
349 for (
const auto& dev : backend->get_devices()) {
351 backend->open_device(dev.id);
360 "Serial backend not yet implemented");
370 add_backend(std::make_unique<TabletBackend>(tablet_config));
377 return (it !=
m_backends.end()) ? it->second->get_devices() : std::vector<InputDeviceInfo> {};
384 return (it !=
m_backends.end()) ? it->second->get_devices() : std::vector<InputDeviceInfo> {};
391 return (it !=
m_backends.end()) ? it->second->get_devices() : std::vector<InputDeviceInfo> {};
396 uint32_t device_id)
const
403 auto devices = it->second->get_devices();
404 for (
const auto& dev : devices) {
405 if (dev.id == device_id) {
414 uint16_t product_id)
const
417 for (
const auto& dev : devices) {
418 if (dev.vendor_id == vendor_id && dev.product_id == product_id) {
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
vk::PhysicalDeviceType type
bool open_device(uint32_t device_id) override
Open a device for input.
HIDAPI-based HID input backend.
InputManagerHandle inputs
Unified interface combining buffer and node processing for subsystems.
static BackendRegistry & instance()
Get the global registry instance.
InputType
Input backend type enumeration.
@ TABLET
Digitizers and styluses (pressure, tilt, rotation)
@ HID
Generic HID devices (game controllers, custom hardware)
@ MIDI
MIDI controllers and instruments.
CoreMidiBackend MIDIBackend
@ InputSubsystem
Input subsystem operations (device management, event dispatch)
@ Core
Core engine, backend, subsystems.
size_t read_buffer_size
Per-device read buffer size.
int poll_timeout_ms
Polling timeout in milliseconds.
bool enabled
Enable HID backend.
uint32_t reconnect_interval_ms
Reconnection attempt interval.
bool auto_open
Auto-open matching devices on start.
std::vector< HIDDeviceFilter > filters
Device filters (empty = all devices)
bool auto_reconnect
Auto-reconnect disconnected devices.
int poll_timeout_ms
Timeout for hid_read_timeout.
size_t read_buffer_size
Per-device read buffer size.
std::vector< HIDDeviceFilter > filters
Device filters (empty = all devices)
uint32_t reconnect_interval_ms
Reconnection attempt interval.
bool auto_reconnect
Auto-reopen disconnected devices.
Configuration for HID backend.
bool auto_open_outputs
Auto-open all MIDI output ports.
bool enabled
Enable MIDI backend.
bool enable_virtual_port
Create a virtual MIDI port.
std::vector< std::string > input_port_filters
Filter input ports by name substring.
std::vector< std::string > output_port_filters
Filter output ports by name substring.
bool auto_open_inputs
Auto-open all MIDI input ports.
std::string virtual_port_name
Name for virtual port.
bool enabled
Enable OSC backend.
bool enabled
Enable Serial backend.
int poll_timeout_ms
Timeout for hid_read_timeout.
size_t read_buffer_size
Per-device read buffer size.
bool split_eraser
Report the eraser end as its own tool.
bool enabled
Enable tablet backend.
bool split_eraser
Report the eraser end as its own tool.
int poll_timeout_ms
Timeout for hid_read_timeout.
size_t read_buffer_size
Per-device read buffer.
Configuration for the tablet backend.