* @brief Sends @p data to the device as an interrupt OUT / feature report. */
| 145 | * @brief Sends @p data to the device as an interrupt OUT / feature report. |
| 146 | */ |
| 147 | qint64 IO::Drivers::HID::write(const QByteArray& data) |
| 148 | { |
| 149 | if (!isOpen()) |
| 150 | return -1; |
| 151 | |
| 152 | const auto* buf = reinterpret_cast<const unsigned char*>(data.constData()); |
| 153 | const int n = hid_write(m_handle, buf, static_cast<size_t>(data.size())); |
| 154 | return static_cast<qint64>(n); |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * @brief Opens the selected HID device and starts the read thread. |