1. 19 Aug, 2020 2 commits
    • Grant Likely's avatar
      HID: input: Fix devices that return multiple bytes in battery report · 37274b5c
      Grant Likely authored
      commit 4f57cace upstream.
      
      Some devices, particularly the 3DConnexion Spacemouse wireless 3D
      controllers, return more than just the battery capacity in the battery
      report. The Spacemouse devices return an additional byte with a device
      specific field. However, hidinput_query_battery_capacity() only
      requests a 2 byte transfer.
      
      When a spacemouse is connected via USB (direct wire, no wireless dongle)
      and it returns a 3 byte report instead of the assumed 2 byte battery
      report the larger transfer confuses and frightens the USB subsystem
      which chooses to ignore the transfer. Then after 2 seconds assume the
      device has stopped responding and reset it. This can be reproduced
      easily by using a wired connection with a wireless spacemouse. The
      Spacemouse will enter a loop of resetting every 2 seconds which can be
      observed in dmesg.
      
      This patch solves the problem by increasing the transfer request to 4
      bytes instead of 2. The fix isn't particularly elegant, but it is simple
      and safe to backport to stable kernels. A further patch will follow to
      more elegantly handle battery reports that contain additional data.
      Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      Cc: Darren Hart <darren@dvhart.com>
      Cc: Jiri Kosina <jikos@kernel.org>
      Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
      Cc: stable@vger.kernel.org
      Tested-by: default avatarDarren Hart <dvhart@infradead.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      37274b5c
    • Nick Desaulniers's avatar
      tracepoint: Mark __tracepoint_string's __used · 1874d3d6
      Nick Desaulniers authored
      commit f3751ad0 upstream.
      
      __tracepoint_string's have their string data stored in .rodata, and an
      address to that data stored in the "__tracepoint_str" section. Functions
      that refer to those strings refer to the symbol of the address. Compiler
      optimization can replace those address references with references
      directly to the string data. If the address doesn't appear to have other
      uses, then it appears dead to the compiler and is removed. This can
      break the /tracing/printk_formats sysfs node which iterates the
      addresses stored in the "__tracepoint_str" section.
      
      Like other strings stored in custom sections in this header, mark these
      __used to inform the compiler that there are other non-obvious users of
      the address, so they should still be emitted.
      
      Link: https://lkml.kernel.org/r/20200730224555.2142154-2-ndesaulniers@google.com
      
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
      Cc: stable@vger.kernel.org
      Fixes: 102c9323 ("tracing: Add __tracepoint_string() to export string pointers")
      Reported-by: default avatarTim Murray <timmurray@google.com>
      Reported-by: default avatarSimon MacMullen <simonmacm@google.com>
      Suggested-by: default avatarGreg Hackmann <ghackmann@google.com>
      Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1874d3d6
  2. 11 Aug, 2020 38 commits