Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -501,16 +501,16 @@ jobs:

# This intentionally uses a separate BUILD_TESTS=OFF configuration. Test
# builds add lizardbyte-common for test support and therefore cannot prove
# that a normal installed package is independently consumable. Debug keeps
# this packaging regression isolated from the open optimized-GCC P2; switch
# this job to Release when that warning is resolved.
# that a normal installed package is independently consumable. Release also
# keeps an optimized GCC library build under warnings-as-errors without
# changing or publishing the ordinary library artifacts.
- name: Configure tests-disabled package
run: |
cmake \
-DBUILD_DOCS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTS=OFF \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/cmake-build-package/install" \
-DLIBVIRTUALHID_BUILD_TOOLS=OFF \
-DLIBVIRTUALHID_ENABLE_PACKAGING=OFF \
Expand Down
19 changes: 15 additions & 4 deletions src/core/profiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// standard includes
#include <cstddef>
#include <cstdint>
#include <initializer_list>
#include <string>
#include <string_view>
#include <vector>
Expand Down Expand Up @@ -90,6 +91,16 @@ namespace lvh::profiles {
return descriptor;
}

void append_descriptor_bytes(
std::vector<std::uint8_t> &descriptor,
std::initializer_list<std::uint8_t> bytes
) {
descriptor.reserve(descriptor.size() + bytes.size());
for (const auto byte : bytes) {
descriptor.push_back(byte);
}
}

void append_common_gamepad_buttons(std::vector<std::uint8_t> &descriptor, bool include_misc_button) {
descriptor.insert(
descriptor.end(),
Expand Down Expand Up @@ -270,8 +281,8 @@ namespace lvh::profiles {
report_id, // Report ID
};
append_common_gamepad_buttons(descriptor, false);
descriptor.insert(
descriptor.end(),
append_descriptor_bytes(
descriptor,
{
0x05,
0x01, // Usage Page (Generic Desktop)
Expand Down Expand Up @@ -325,8 +336,8 @@ namespace lvh::profiles {
);

if (supports_rumble) {
descriptor.insert(
descriptor.end(),
append_descriptor_bytes(
descriptor,
{
0x06,
0x00,
Expand Down
Loading