Skip to content
Snippets Groups Projects
  1. Jun 05, 2024
  2. May 31, 2024
    • Peter Hutterer's avatar
      Add a vendor report helper · 37a6f017
      Peter Hutterer authored
      
      A macro to generate a vendor-specific padding-only
      report with Report ID 0xac of the given size in bytes.
      
      HID-BPF requires that at least one report has
      the same size as the original report from the device.
      Without that events are silently discarded by the kernel.
      
      The easy way to ensure that is to add this
      macro so we have a report that's the expected size:
      
        static __u8 fixed_rdesc = [
           UsagePage_Generic_Desktop
           Usage_GD_Keyboard
           CollectionApplication(
               ... intended rdesc items go here ...
               FixedSizeVendorReport(12)
           )
        ];
      
      Side-effect: if placed outside an Application Collection this will show
      up as another device that doesn't send events so let's document this.
      
      The Report Id 0xac was picked with the guess that very
      few actual devices use this Report Id so it shouldn't clash. And even
      where it does the Report Id can be changed during the event fixup.
      
      Signed-off-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
      37a6f017
  3. May 30, 2024
    • Peter Hutterer's avatar
      bpf: add missing closing parens to UsagePage_Vendor · 2b1ccd93
      Peter Hutterer authored
      
      Fixes: e9522cd0 ("Add a HID report composition helper macros")
      
      Signed-off-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
      2b1ccd93
    • Peter Hutterer's avatar
      Add a HID report composition helper macros · e9522cd0
      Peter Hutterer authored
      These macros make it slightly easier and more modular to create
      a HID report descriptor from scratch. Since they carry the annotation
      we don't need to comment it and they cannot get stale.
      
      For comparison, before we had this:
      
      	0x15, 0x00,                    //   Logical Minimum (0)
      	0x25, 0x01,                    //   Logical Maximum (1)
      	0x95, 0x04,                    //   Report Count (4)
      	0x75, 0x01,                    //   Report Size (1)
      
      Now we can write this as:
              LogicalRange_i8(0, 1)
              ReportCount(4)
              ReportSize(1)
      
      Because these macros are for creating new report descriptors,
      some bits aren't directly exposed. e.g in the example above:
      there is a logical range as one macro that sets both min and max.
      There is seldom a good use case for skipping either anyway.
      
      These macros will need to be expanded over time.
      
      For Usage Pages and Usage IDs, we use a tool to parse the HUT JSON (attached
      to the HUT 1.5 PDF [1]) and generate all #defines for all usage pages
      and usages in the form:
      
       #define UsagePage_Foo_Bar
       #define Usage_FB_SomeOrOther
      
      Where the FB is simply the acronym based on the capital letters in the
      Usage Page name or the first three letters, whichever makes slightly
      more sense.
      
      [1] https://usb.org/document-library/hid-usage-tables-15
      
      
      
      Signed-off-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
      e9522cd0
  4. May 28, 2024
  5. May 15, 2024
  6. May 02, 2024
  7. May 01, 2024
  8. Apr 30, 2024
  9. Apr 18, 2024
  10. Apr 17, 2024
  11. Apr 16, 2024
  12. Apr 11, 2024
Loading