Skip to content
  • Hans de Goede's avatar
    HID: logitech-hidpp: add support for HID++ 1.0 consumer keys reports · 42bc4f31
    Hans de Goede authored
    
    
    All Logitech 27 MHz keyboards and also the MX5000 bluetooth keyboard use
    Logitech custom usages of 0x10xx in the consumer page. The descriptor for
    the consumer input-report only declares usages up to 652, so we end up
    dropping all the input-reports reporting 0x10xx usages without reporting
    events for these to userspace.
    
    This commit adds a descriptor_fixup function for this which changes the
    usage and logical maximum to 0x107f. Mapping these usages to something
    other then KEY_UNKNOWN is left to userspace (hwdb). Note:
    1. The old descriptor_fixup for this in hid-lg.c used a maximimum of 0x104d
       this is not high enough, the S520 keyboard battery key sends 0x106f.
    2. The descriptor_fixup is flexible so that it works with both the kbd-
       desc. passed by the logitech-dj code and with bluetooth descriptors.
    
    The descriptor_fixup makes most keys work on 27 MHz keyboards, but it is
    not enough to get all keys to work on 27 MHz keyboards and just the fixup
    is not enough to get the MX5000 to generate 0x10xx events:
    
    1) The LX501 and MX3000 27 MHz kbds both have a button labelled "media"
    (called "Media Player" by SetPoint) and a button with a remote-control
    symbol ("Media Life" in SetPoint) which both send an identical consumer
    usage-page code (0x0183) making the 2 buttons indistinguishable,
    switching to HID++ 1.0 consumer keys reports makes the remote-control
    symbol button generate a 0x10xx Logitech specific code instead.
    
    2) The MX5000 Bluetooth keyboard has 11 keys which report 0x10xx consumer
    page usages, but unlike 27 MHz devices which happily send 0x10xx codes in
    their normal consumer-page input-report, the MX5000 honors the maximum of
    652 from its descriptor and sends a 0x0000 code (so release) whenever these
    keys are pressed. When switching to HID++ sub-id 0x03 HID++ 1.0 consumer
    keys reports these 0x10xx codes do get properly reported.
    
    This commit adds support for HID++ 1.0 consumer keys reports and enables
    this for all 27 MHz keyboards and for the MX5000.
    
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
    42bc4f31