1. 17 4月, 2018 1 次提交
    • B
      HID: input: do not increment usages when a duplicate is found · 190d7f02
      Benjamin Tissoires 提交于
      This is something that bothered us from a long time. When hid-input
      doesn't know how to map a usage, it uses *_MISC. But there is something
      else which increments the usage if the evdev code is already used.
      
      This leads to few issues:
      - some devices may have their ABS_X mapped to ABS_Y if they export a bad
        set of usages (see the DragonRise joysticks IIRC -> fixed in a specific
        HID driver)
      - *_MISC + N might (will) conflict with other defined axes (my Logitech
        H800 exports some multitouch axes because of that)
      - this prevents to freely add some new evdev usages, because "hey, my
        headset will now report ABS_COFFEE, and it's not coffee capable".
      
      So let's try to kill this nonsense, and hope we won't break too many
      devices.
      
      I my headset case, the ABS_MISC axes are created because of some
      proprietary usages, so we might not break that many devices.
      
      For backward compatibility, a quirk HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE
      is created and can be applied to any device that needs this behavior.
      Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Acked-by: NPeter Hutterer <peter.hutterer@who-t.net>
      Acked-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      190d7f02
  2. 23 3月, 2018 1 次提交
  3. 16 2月, 2018 1 次提交
  4. 05 10月, 2017 1 次提交
  5. 15 8月, 2017 1 次提交
  6. 02 8月, 2017 2 次提交
  7. 22 5月, 2017 1 次提交
  8. 11 5月, 2017 1 次提交
  9. 21 3月, 2017 1 次提交
  10. 06 3月, 2017 1 次提交
  11. 28 11月, 2016 1 次提交
    • B
      HID: input: rework HID_QUIRK_MULTI_INPUT · 72d19459
      Benjamin Tissoires 提交于
      The purpose of HID_QUIRK_MULTI_INPUT is to have an input device per
      report id. This is useful when the HID device presents several HID
      collections of different device types.
      
      The current implementation of hid-input creates one input node per id per
      type (input or output). This is problematic for the LEDs of a keyboard as
      they are often set through an output report. The current code creates
      one input node with all the keyboard keys, and one other with only the
      LEDs.
      
      To solve this, we use a two-passes way:
      - first, we initialize all input nodes and associate one per report id
      - then, we register all the input nodes
      Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      72d19459
  12. 20 10月, 2016 1 次提交
    • J
      HID: input: Recognize ABS_WHEEL in hidinput_calc_abs_res · c0bf5741
      Jason Gerecke 提交于
      The "Steering" usage (HID_UP_SIMULATION | 0xc8) is defined in HUT 1.12 as
      follows:
      
      "A steering wheel is a single degree-of-freedom device that rotates about
      an axis. The zero position is always the neutral or 'straight ahead'
      position, with positive values turning clockwise and negative values
      turning counterclockwise. If the Coordinate Values Wrap attribute is
      set, the steering wheel can be turned past 360 degrees."
      
      The hidinput_configure_usage function canonically maps this usage to the
      ABS_WHEEL axis, but hidinput_calc_abs_res does not recognize this axis
      as one for which it can calculate a resolution. This effectively prevents
      wheels from being assigned a proper resolution that userspace can use
      to determine the precise angle of input.
      
      This commit adds ABS_WHEEL as a rotational axis to hidinput_calc_abs_res.
      Signed-off-by: NJason Gerecke <jason.gerecke@wacom.com>
      Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      c0bf5741
  13. 19 9月, 2016 1 次提交
  14. 05 8月, 2016 1 次提交
    • A
      HID: input: add mic mute key on HP slim keyboard · 08fc9473
      AceLan Kao 提交于
      Add MIC mute key which is found on HP Business Slim Keyboard
      
      T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 23 Spd=1.5 MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
      P:  Vendor=03f0 ProdID=2f4a Rev=00.10
      S:  Manufacturer=Chicony
      S:  Product=HP Business Slim Keyboard
      C:  #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=100mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=01 Driver=usbhid
      I:  If#= 1 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
      Signed-off-by: NAceLan Kao <acelan.kao@canonical.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      08fc9473
  15. 18 12月, 2015 1 次提交
  16. 20 11月, 2015 1 次提交
  17. 06 11月, 2015 1 次提交
  18. 30 9月, 2015 1 次提交
  19. 04 8月, 2015 1 次提交
  20. 10 7月, 2015 1 次提交
  21. 28 5月, 2015 3 次提交
  22. 24 3月, 2015 1 次提交
  23. 14 3月, 2015 2 次提交
    • K
      power_supply: Change ownership from driver to core · 297d716f
      Krzysztof Kozlowski 提交于
      Change the ownership of power_supply structure from each driver
      implementing the class to the power supply core.
      
      The patch changes power_supply_register() function thus all drivers
      implementing power supply class are adjusted.
      
      Each driver provides the implementation of power supply. However it
      should not be the owner of power supply class instance because it is
      exposed by core to other subsystems with power_supply_get_by_name().
      These other subsystems have no knowledge when the driver will unregister
      the power supply. This leads to several issues when driver is unbound -
      mostly because user of power supply accesses freed memory.
      
      Instead let the core own the instance of struct 'power_supply'.  Other
      users of this power supply will still access valid memory because it
      will be freed when device reference count reaches 0. Currently this
      means "it will leak" but power_supply_put() call in next patches will
      solve it.
      
      This solves invalid memory references in following race condition
      scenario:
      
      Thread 1: charger manager
      Thread 2: power supply driver, used by charger manager
      
      THREAD 1 (charger manager)         THREAD 2 (power supply driver)
      ==========================         ==============================
      psy = power_supply_get_by_name()
                                         Driver unbind, .remove
                                           power_supply_unregister()
                                           Device fully removed
      psy->get_property()
      
      The 'get_property' call is executed in invalid context because the driver was
      unbound and struct 'power_supply' memory was freed.
      
      This could be observed easily with charger manager driver (here compiled
      with max17040 fuel gauge):
      
      $ cat /sys/devices/virtual/power_supply/cm-battery/capacity &
      $ echo "1-0036" > /sys/bus/i2c/drivers/max17040/unbind
      [   55.725123] Unable to handle kernel NULL pointer dereference at virtual address 00000000
      [   55.732584] pgd = d98d4000
      [   55.734060] [00000000] *pgd=5afa2831, *pte=00000000, *ppte=00000000
      [   55.740318] Internal error: Oops: 80000007 [#1] PREEMPT SMP ARM
      [   55.746210] Modules linked in:
      [   55.749259] CPU: 1 PID: 2936 Comm: cat Tainted: G        W       3.19.0-rc1-next-20141226-00048-gf79f475f3c44-dirty #1496
      [   55.760190] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [   55.766270] task: d9b76f00 ti: daf54000 task.ti: daf54000
      [   55.771647] PC is at 0x0
      [   55.774182] LR is at charger_get_property+0x2f4/0x36c
      [   55.779201] pc : [<00000000>]    lr : [<c034b0b4>]    psr: 60000013
      [   55.779201] sp : daf55e90  ip : 00000003  fp : 00000000
      [   55.790657] r10: 00000000  r9 : c06e2878  r8 : d9b26c68
      [   55.795865] r7 : dad81610  r6 : daec7410  r5 : daf55ebc  r4 : 00000000
      [   55.802367] r3 : 00000000  r2 : daf55ebc  r1 : 0000002a  r0 : d9b26c68
      [   55.808879] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
      [   55.815994] Control: 10c5387d  Table: 598d406a  DAC: 00000015
      [   55.821723] Process cat (pid: 2936, stack limit = 0xdaf54210)
      [   55.827451] Stack: (0xdaf55e90 to 0xdaf56000)
      [   55.831795] 5e80:                                     60000013 c01459c4 0000002a c06f8ef8
      [   55.839956] 5ea0: db651000 c06f8ef8 daebac00 c04cb668 daebac08 c0346864 00000000 c01459c4
      [   55.848115] 5ec0: d99eaa80 c06f8ef8 00000fff 00001000 db651000 c027f25c c027f240 d99eaa80
      [   55.856274] 5ee0: d9a06c00 c0146218 daf55f18 00001000 d99eaa80 db4c18c0 00000001 00000001
      [   55.864468] 5f00: daf55f80 c0144c78 c0144c54 c0107f90 00015000 d99eaab0 00000000 00000000
      [   55.872603] 5f20: 000051c7 00000000 db4c18c0 c04a9370 00015000 00001000 daf55f80 00001000
      [   55.880763] 5f40: daf54000 00015000 00000000 c00e53dc db4c18c0 c00e548c 0000000d 00008124
      [   55.888937] 5f60: 00000001 00000000 00000000 db4c18c0 db4c18c0 00001000 00015000 c00e5550
      [   55.897099] 5f80: 00000000 00000000 00001000 00001000 00015000 00000003 00000003 c000f364
      [   55.905239] 5fa0: 00000000 c000f1a0 00001000 00015000 00000003 00015000 00001000 0001333c
      [   55.913399] 5fc0: 00001000 00015000 00000003 00000003 00000002 00000000 00000000 00000000
      [   55.921560] 5fe0: 7fffe000 be999850 0000a225 b6f3c19c 60000010 00000003 00000000 00000000
      [   55.929744] [<c034b0b4>] (charger_get_property) from [<c0346864>] (power_supply_show_property+0x48/0x20c)
      [   55.939286] [<c0346864>] (power_supply_show_property) from [<c027f25c>] (dev_attr_show+0x1c/0x48)
      [   55.948130] [<c027f25c>] (dev_attr_show) from [<c0146218>] (sysfs_kf_seq_show+0x84/0x104)
      [   55.956298] [<c0146218>] (sysfs_kf_seq_show) from [<c0144c78>] (kernfs_seq_show+0x24/0x28)
      [   55.964536] [<c0144c78>] (kernfs_seq_show) from [<c0107f90>] (seq_read+0x1b0/0x484)
      [   55.972172] [<c0107f90>] (seq_read) from [<c00e53dc>] (__vfs_read+0x18/0x4c)
      [   55.979188] [<c00e53dc>] (__vfs_read) from [<c00e548c>] (vfs_read+0x7c/0x100)
      [   55.986304] [<c00e548c>] (vfs_read) from [<c00e5550>] (SyS_read+0x40/0x8c)
      [   55.993164] [<c00e5550>] (SyS_read) from [<c000f1a0>] (ret_fast_syscall+0x0/0x48)
      [   56.000626] Code: bad PC value
      [   56.011652] ---[ end trace 7b64343fbdae8ef1 ]---
      Signed-off-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Reviewed-by: NBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      
      [for the nvec part]
      Reviewed-by: NMarc Dietrich <marvin24@gmx.de>
      
      [for compal-laptop.c]
      Acked-by: NDarren Hart <dvhart@linux.intel.com>
      
      [for the mfd part]
      Acked-by: NLee Jones <lee.jones@linaro.org>
      
      [for the hid part]
      Acked-by: NJiri Kosina <jkosina@suse.cz>
      
      [for the acpi part]
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NSebastian Reichel <sre@kernel.org>
      297d716f
    • K
      power_supply: Move run-time configuration to separate structure · 2dc9215d
      Krzysztof Kozlowski 提交于
      Add new structure 'power_supply_config' for holding run-time
      initialization data like of_node, supplies and private driver data.
      
      The power_supply_register() function is changed so all power supply
      drivers need updating.
      
      When registering the power supply this new 'power_supply_config' should be
      used instead of directly initializing 'struct power_supply'. This allows
      changing the ownership of power_supply structure from driver to the
      power supply core in next patches.
      
      When a driver does not use of_node or supplies then it should use NULL
      as config. If driver uses of_node or supplies then it should allocate
      config on stack and initialize it with proper values.
      Signed-off-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Reviewed-by: NBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      
      [for the nvec part]
      Reviewed-by: NMarc Dietrich <marvin24@gmx.de>
      
      [for drivers/platform/x86/compal-laptop.c]
      Reviewed-by: NDarren Hart <dvhart@linux.intel.com>
      
      [for drivers/hid/*]
      Reviewed-by: NJiri Kosina <jkosina@suse.cz>
      Signed-off-by: NSebastian Reichel <sre@kernel.org>
      2dc9215d
  24. 05 3月, 2015 1 次提交
    • D
      HID: map telephony usage page · f3dddf24
      Dmitry Torokhov 提交于
      Currently HID code maps usages from telephony page into BTN_0, BTN_1, etc
      keys which get interpreted by mousedev and userspace as left/right/middle
      button clicks, which is not really helpful.
      
      This change adds mappings for usages that have corresponding input event
      definitions, and leaves the rest unmapped. This can be changed when
      there are userspace consumers for more telephony usages.
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      f3dddf24
  25. 07 1月, 2015 3 次提交
    • J
      HID: fixup the conflicting keyboard mappings quirk · 8e7b3410
      Jiri Kosina 提交于
      The ignore check that got added in 6ce901eb ("HID: input: fix confusion
      on conflicting mappings") needs to properly check for VARIABLE reports
      as well (ARRAY reports should be ignored), otherwise legitimate keyboards
      might break.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 6ce901eb ("HID: input: fix confusion on conflicting mappings")
      Reported-by: NFredrik Hallenberg <megahallon@gmail.com>
      Reported-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      8e7b3410
    • R
      HID: apple: fix battery support for the 2009 ANSI wireless keyboard · cbd366be
      Ross Skaliotis 提交于
      Enabled quirks necessary for correct battery capacity reporting. Cleaned up
      surrounding style.
      Signed-off-by: NRoss Skaliotis <rskaliotis@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      cbd366be
    • D
      HID: input: fix confusion on conflicting mappings · 6ce901eb
      David Herrmann 提交于
      On an PC-101/103/104 keyboard (American layout) the 'Enter' key and its
      neighbours look like this:
      
                 +---+ +---+ +-------+
                 | 1 | | 2 | |   5   |
                 +---+ +---+ +-------+
                   +---+ +-----------+
                   | 3 | |     4     |
                   +---+ +-----------+
      
      On a PC-102/105 keyboard (European layout) it looks like this:
      
                 +---+ +---+ +-------+
                 | 1 | | 2 | |       |
                 +---+ +---+ +-+  4  |
                   +---+ +---+ |     |
                   | 3 | | 5 | |     |
                   +---+ +---+ +-----+
      
      (Note that the number of keys is the same, but key '5' is moved down and
       the shape of key '4' is changed. Keys '1' to '3' are exactly the same.)
      
      The keys 1-4 report the same scan-code in HID in both layouts, even though
      the keysym they produce is usually different depending on the XKB-keymap
      used by user-space.
      However, key '5' (US 'backslash'/'pipe') reports 0x31 for the upper layout
      and 0x32 for the lower layout, as defined by the HID spec. This is highly
      confusing as the linux-input API uses a single keycode for both.
      
      So far, this was never a problem as there never has been a keyboard with
      both of those keys present at the same time. It would have to look
      something like this:
      
                 +---+ +---+ +-------+
                 | 1 | | 2 | |  x31  |
                 +---+ +---+ +-------+
                   +---+ +---+ +-----+
                   | 3 | |x32| |  4  |
                   +---+ +---+ +-----+
      
      HID can represent such a keyboard, but the linux-input API cannot.
      Furthermore, any user-space mapping would be confused by this and,
      luckily, no-one ever produced such hardware.
      
      Now, the HID input layer fixed this mess by mapping both 0x31 and 0x32 to
      the same keycode (KEY_BACKSLASH==0x2b). As only one of both physical keys
      is present on a hardware, this works just fine.
      
      Lets introduce hardware-vendors into this:
      ------------------------------------------
      
      Unfortunately, it seems way to expensive to produce a different device for
      American and European layouts. Therefore, hardware-vendors put both keys,
      (0x31 and 0x32) on the same keyboard, but only one of them is hooked up
      to the physical button, the other one is 'dead'.
      This means, they can use the same hardware, with a different button-layout
      and automatically produce the correct HID events for American *and*
      European layouts. This is unproblematic for normal keyboards, as the
      'dead' key will never report any KEY-DOWN events. But RollOver keyboards
      send the whole matrix on each key-event, allowing n-key roll-over mode.
      This means, we get a 0x31 and 0x32 event on each key-press. One of them
      will always be 0, the other reports the real state. As we map both to the
      same keycode, we will get spurious key-events, even though the real
      key-state never changed.
      
      The easiest way would be to blacklist 'dead' keys and never handle those.
      We could simply read the 'country' tag of USB devices and blacklist either
      key according to the layout. But... hardware vendors... want the same
      device for all countries and thus many of them set 'country' to 0 for all
      devices. Meh..
      
      So we have to deal with this properly. As we cannot know which of the keys
      is 'dead', we either need a heuristic and track those keys, or we simply
      make use of our value-tracking for HID fields. We simply ignore HID events
      for absolute data if the data didn't change. As HID tracks events on the
      HID level, we haven't done the keycode translation, yet. Therefore, the
      'dead' key is tracked independently of the real key, therefore, any events
      on it will be ignored.
      
      This patch simply discards any HID events for absolute data if it didn't
      change compared to the last report. We need to ignore relative and
      buffered-byte reports for obvious reasons. But those cannot be affected by
      this bug, so we're fine.
      
      Preferably, we'd do this filtering on the HID-core level. But this might
      break a lot of custom drivers, if they do not follow the HID specs.
      Therefore, we do this late in hid-input just before we inject it into the
      input layer (which does the exact same filtering, but on the keycode
      level).
      
      If this turns out to break some devices, we might have to limit filtering
      to EV_KEY events. But lets try to do the Right Thing first, and properly
      filter any absolute data that didn't change.
      
      This patch is tagged for 'stable' as it fixes a lot of n-key RollOver
      hardware. We might wanna wait with backporting for a while, before we know
      it doesn't break anything else, though.
      
      Cc: <stable@vger.kernel.org>
      Reported-by: NAdam Goode <adam@spicenitz.org>
      Reported-by: NFredrik Hallenberg <megahallon@gmail.com>
      Tested-by: NFredrik Hallenberg <megahallon@gmail.com>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      6ce901eb
  26. 17 12月, 2014 1 次提交
  27. 02 12月, 2014 1 次提交
  28. 29 10月, 2014 1 次提交
  29. 22 10月, 2014 1 次提交
  30. 21 10月, 2014 1 次提交
  31. 26 8月, 2014 1 次提交
  32. 03 6月, 2014 1 次提交
  33. 28 4月, 2014 1 次提交
  34. 25 2月, 2014 1 次提交