82 uintptr_t devicecontext;
90 err = gh_hid_enum_devices(driver, &device_id, &devicecontext);
91 if (err == OperationNotImplemented)
93 else if (err == Failure)
95 if (!devices.contains(device_id)) {
96 err = gh_hid_init_device(driver, device_id, &handle);
98 hidnot =
new HIDDeviceHandler(driver, handle);
99 devices.insert(device_id, hidnot);
100 QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
101 QInputDeviceManager::DeviceTypePointer,++deviceCount);
102 hidnot->async_wait();
106 if (err == OperationNotImplemented) {
108
112 if (!devices.contains(device_id)) {
113 err = gh_hid_init_device(driver, device_id, &handle);
116 hidnot =
new HIDDeviceHandler(driver, handle);
117 devices.insert(device_id, hidnot);
118 hidnot->async_wait();
121 }
while (err == Success);
131 uint32_t num_events = 1;
133 while (gh_hid_get_event(handle, &event, &num_events) == Success) {
134 if (event.type == HID_TYPE_AXIS) {
135 switch (event.index) {
137 currentPos.setX(event.value);
140 currentPos.setY(event.value);
143 currentPos.setX(currentPos.x() + event.value);
146 currentPos.setY(currentPos.y() + event.value);
152 }
else if (event.type == HID_TYPE_KEY) {
153 switch (event.index) {
154 case HID_BUTTON_LEFT:
156 buttons |= Qt::LeftButton;
158 buttons &= ~Qt::LeftButton;
160 case HID_BUTTON_MIDDLE:
162 buttons |= Qt::MiddleButton;
164 buttons &= ~Qt::MiddleButton;
166 case HID_BUTTON_RIGHT:
168 buttons |= Qt::RightButton;
170 buttons &= ~Qt::RightButton;
176 }
else if (event.type == HID_TYPE_SYNC) {
177 QWindowSystemInterface::handleMouseEvent(0, currentPos, currentPos, buttons,
178 QGuiApplication::keyboardModifiers());
179 }
else if (event.type == HID_TYPE_DISCONNECT) {