1. 31 5月, 2019 1 次提交
    • N
      HID: core: move Usage Page concatenation to Main item · 69f67200
      Nicolas Saenz Julienne 提交于
      [ Upstream commit 58e75155009cc800005629955d3482f36a1e0eec ]
      
      As seen on some USB wireless keyboards manufactured by Primax, the HID
      parser was using some assumptions that are not always true. In this case
      it's s the fact that, inside the scope of a main item, an Usage Page
      will always precede an Usage.
      
      The spec is not pretty clear as 6.2.2.7 states "Any usage that follows
      is interpreted as a Usage ID and concatenated with the Usage Page".
      While 6.2.2.8 states "When the parser encounters a main item it
      concatenates the last declared Usage Page with a Usage to form a
      complete usage value." Being somewhat contradictory it was decided to
      match Window's implementation, which follows 6.2.2.8.
      
      In summary, the patch moves the Usage Page concatenation from the local
      item parsing function to the main item parsing function.
      Signed-off-by: NNicolas Saenz Julienne <nsaenzjulienne@suse.de>
      Reviewed-by: NTerry Junge <terry.junge@poly.com>
      Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      69f67200
  2. 05 9月, 2018 1 次提交
  3. 28 8月, 2018 1 次提交
  4. 23 7月, 2018 1 次提交
  5. 17 7月, 2018 1 次提交
  6. 25 6月, 2018 1 次提交
  7. 13 6月, 2018 1 次提交
    • K
      treewide: kmalloc() -> kmalloc_array() · 6da2ec56
      Kees Cook 提交于
      The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
      patch replaces cases of:
      
              kmalloc(a * b, gfp)
      
      with:
              kmalloc_array(a * b, gfp)
      
      as well as handling cases of:
      
              kmalloc(a * b * c, gfp)
      
      with:
      
              kmalloc(array3_size(a, b, c), gfp)
      
      as it's slightly less ugly than:
      
              kmalloc_array(array_size(a, b), c, gfp)
      
      This does, however, attempt to ignore constant size factors like:
      
              kmalloc(4 * 1024, gfp)
      
      though any constants defined via macros get caught up in the conversion.
      
      Any factors with a sizeof() of "unsigned char", "char", and "u8" were
      dropped, since they're redundant.
      
      The tools/ directory was manually excluded, since it has its own
      implementation of kmalloc().
      
      The Coccinelle script used for this was:
      
      // Fix redundant parens around sizeof().
      @@
      type TYPE;
      expression THING, E;
      @@
      
      (
        kmalloc(
      -	(sizeof(TYPE)) * E
      +	sizeof(TYPE) * E
        , ...)
      |
        kmalloc(
      -	(sizeof(THING)) * E
      +	sizeof(THING) * E
        , ...)
      )
      
      // Drop single-byte sizes and redundant parens.
      @@
      expression COUNT;
      typedef u8;
      typedef __u8;
      @@
      
      (
        kmalloc(
      -	sizeof(u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(__u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(char) * (COUNT)
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(unsigned char) * (COUNT)
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(u8) * COUNT
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(__u8) * COUNT
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(char) * COUNT
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(unsigned char) * COUNT
      +	COUNT
        , ...)
      )
      
      // 2-factor product with sizeof(type/expression) and identifier or constant.
      @@
      type TYPE;
      expression THING;
      identifier COUNT_ID;
      constant COUNT_CONST;
      @@
      
      (
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * (COUNT_ID)
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * COUNT_ID
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * COUNT_CONST
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * (COUNT_ID)
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * COUNT_ID
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * COUNT_CONST
      +	COUNT_CONST, sizeof(THING)
        , ...)
      )
      
      // 2-factor product, only identifiers.
      @@
      identifier SIZE, COUNT;
      @@
      
      - kmalloc
      + kmalloc_array
        (
      -	SIZE * COUNT
      +	COUNT, SIZE
        , ...)
      
      // 3-factor product with 1 sizeof(type) or sizeof(expression), with
      // redundant parens removed.
      @@
      expression THING;
      identifier STRIDE, COUNT;
      type TYPE;
      @@
      
      (
        kmalloc(
      -	sizeof(TYPE) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kmalloc(
      -	sizeof(THING) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kmalloc(
      -	sizeof(THING) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kmalloc(
      -	sizeof(THING) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kmalloc(
      -	sizeof(THING) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      )
      
      // 3-factor product with 2 sizeof(variable), with redundant parens removed.
      @@
      expression THING1, THING2;
      identifier COUNT;
      type TYPE1, TYPE2;
      @@
      
      (
        kmalloc(
      -	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kmalloc(
      -	sizeof(THING1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kmalloc(
      -	sizeof(THING1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      )
      
      // 3-factor product, only identifiers, with redundant parens removed.
      @@
      identifier STRIDE, SIZE, COUNT;
      @@
      
      (
        kmalloc(
      -	(COUNT) * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	COUNT * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	COUNT * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	(COUNT) * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	COUNT * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	(COUNT) * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	(COUNT) * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	COUNT * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      )
      
      // Any remaining multi-factor products, first at least 3-factor products,
      // when they're not all constants...
      @@
      expression E1, E2, E3;
      constant C1, C2, C3;
      @@
      
      (
        kmalloc(C1 * C2 * C3, ...)
      |
        kmalloc(
      -	(E1) * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kmalloc(
      -	(E1) * (E2) * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kmalloc(
      -	(E1) * (E2) * (E3)
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kmalloc(
      -	E1 * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      )
      
      // And then all remaining 2 factors products when they're not all constants,
      // keeping sizeof() as the second factor argument.
      @@
      expression THING, E1, E2;
      type TYPE;
      constant C1, C2, C3;
      @@
      
      (
        kmalloc(sizeof(THING) * C2, ...)
      |
        kmalloc(sizeof(TYPE) * C2, ...)
      |
        kmalloc(C1 * C2 * C3, ...)
      |
        kmalloc(C1 * C2, ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * (E2)
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * E2
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * (E2)
      +	E2, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * E2
      +	E2, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	(E1) * E2
      +	E1, E2
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	(E1) * (E2)
      +	E1, E2
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	E1 * E2
      +	E1, E2
        , ...)
      )
      Signed-off-by: NKees Cook <keescook@chromium.org>
      6da2ec56
  8. 16 5月, 2018 1 次提交
  9. 26 4月, 2018 1 次提交
    • B
      HID: generic: create one input report per application type · f07b3c1d
      Benjamin Tissoires 提交于
      It is not a good idea to try to fit all types of applications in the
      same input report. There are a lot of devices that are needing
      the quirk HID_MULTI_INPUT but this quirk doesn't match the actual HID
      description as it is based on the report ID.
      
      Given that most devices with MULTI_INPUT I can think of split nicely
      the devices inputs into application, it is a good thing to split the
      devices by default based on this assumption.
      
      Also make hid-multitouch following this rule, to not have to deal
      with too many input created.
      
      While we are at it, fix some checkpatch complaints about converting
      'unsigned' to 'unsigned int'.
      Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      f07b3c1d
  10. 23 3月, 2018 1 次提交
  11. 06 3月, 2018 1 次提交
  12. 16 2月, 2018 1 次提交
  13. 07 12月, 2017 1 次提交
  14. 21 11月, 2017 4 次提交
  15. 07 11月, 2017 1 次提交
  16. 17 10月, 2017 2 次提交
    • M
      HID: alps: add new U1 device ID · 287b8e11
      Masaki Ota 提交于
      Add new U1 device Product ID This device is used on HP Elite book x360 series.
      
      [jkosina@suse.cz: update changelog]
      Signed-off-by: NMasaki Ota <masaki.ota@jp.alps.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      287b8e11
    • M
      HID: alps: add support for Alps T4 Touchpad device · 73196ebe
      Masaki Ota 提交于
      - Define T4 device specification value for support T4 device.
      
      - Creeate "t4_contact_data" and "t4_input_report" structure for decoding and
        storing T4-specific data
      
      - Create "t4_calc_check_sum()" function for calculating checksum value to send
        to the device. T4 needs to send this value when reading or writing device
        address value.
      
      - Create "t4_read_write_register()" function for reading and writing device
        address value.
      
      - Create "t4_raw_event()" function for decodin XYZ, palm and button data.
      
      - Replace "MAX_TOUCHES" fixed variable to "max_fingers" variable.
      
      - Add T4 devuce product ID. (0x120C)
      
      T4 device is used on HP EliteBook 1000 series and Zbook Stduio
      
      [jkosina@suse.cz: rewrite changelog]
      Signed-off-by: NMasaki Ota <masaki.ota@jp.alps.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      73196ebe
  17. 11 10月, 2017 1 次提交
  18. 16 9月, 2017 1 次提交
  19. 06 9月, 2017 1 次提交
  20. 01 8月, 2017 1 次提交
  21. 24 7月, 2017 1 次提交
  22. 20 7月, 2017 1 次提交
  23. 22 6月, 2017 1 次提交
  24. 13 6月, 2017 2 次提交
    • J
      HID: let generic driver yield control iff specific driver has been enabled · 0ca4cd7b
      Jiri Kosina 提交于
      There are many situations where generic HID driver provides some basic level
      of support for certain device, but later this support (usually by implementing
      vendor-specific extensions of HID protocol) is extended and the support moved
      over to a separate (usually per-vendor) specific driver.
      
      This might bring a rather unpleasant suprise for users, as all of a sudden
      there is a new config option they have to enable in order to get any support
      for their device whatsoever, although previous kernel versions provided basic
      support through the generic driver. Which is rightfully seen as a regression.
      
      Fix this by including the entry for a particular device in
      hid_have_special_driver[] iff the specific config option has been specified,
      and let generic driver handle the device otherwise.
      Also make the behavior of hid_scan_report() (where the same decision is being
      taken on a per-report level) consistent.
      
      While at it, reshuffle the hid_have_special_driver[] a bit to restore the
      alphabetical ordering (first order by config option, and within those
      sections order by VID).
      
      This is considered a short-term solution, before generic way of giving
      precedence to special drivers and falling back to generic driver is
      figured out.
      
      While at it, fixup a missing entry for GFRM driver; thanks to Hans de Geode for
      spotting this (and for discovering a few issues in the conversion).
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      0ca4cd7b
    • A
      HID: core: don't use negative operands when shift · 08585e43
      Andy Shevchenko 提交于
      The recent C standard in 6.5.7 paragraph 4 defines that operands for
      bitwise shift operators should be non-negative, otherwise it's an
      undefined behaviour.
      Signed-off-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
      Acked-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      08585e43
  25. 12 6月, 2017 1 次提交
  26. 08 6月, 2017 3 次提交
  27. 22 5月, 2017 1 次提交
  28. 11 5月, 2017 2 次提交
    • D
      HID: elecom: extend to fix the descriptor for DEFT trackballs · 0bb7a37f
      Diego Elio Pettenò 提交于
      The ELECOM DEFT trackballs report only five buttons, when the device
      actually has 8. Change the descriptor so that the HID driver can see all of
      them.
      
      For completeness and future reference, I included a side-by-side diff of
      the part of the descriptor that is being edited.
      
      Cc: Jiri Kosina <jikos@kernel.org>
      Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
      Cc: Yuxuan Shui <yshuiv7@gmail.com>
      Signed-off-by: NDiego Elio Pettenò <flameeyes@flameeyes.eu>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      0bb7a37f
    • H
      HID: ite: Add hid-ite driver · f1918be1
      Hans de Goede 提交于
      The ITE8595 keyboard uses the HID_GD_RFKILL_BTN usage code
      from the Wireless Radio Controls Application Collection Microsoft
      has defined for Windows 8 and later.
      
      However it has a quirk, when the rfkill hotkey is pressed it does
      generate a report for the collection, but the reported value is
      always 0. Luckily it is the only button in this collection / report,
      and it sends a report on release only, so receiving a report means the
      button was pressed.
      
      This commit adds a hid-ite driver which watches for the Wireless Radio
      Controls Application Collection report and then reports a KEY_RFKILL event,
      ignoring the value, making the rfkill on this keyboard work.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      f1918be1
  29. 11 4月, 2017 1 次提交
  30. 06 4月, 2017 1 次提交
  31. 30 3月, 2017 2 次提交