1. 18 10月, 2013 1 次提交
    • N
      HID: Fix unit exponent parsing again · ad0e669b
      Nikolai Kondrashov 提交于
      Revert some changes done in 77463838.
      
      Revert all changes done in hidinput_calc_abs_res as it mistakingly used
      "Unit" item exponent nibbles to affect resolution value. This wasn't
      breaking resolution calculation of relevant axes of any existing
      devices, though, as they have only one dimension to their units and thus
      1 in the corresponding nible.
      
      Revert to reading "Unit Exponent" item value as a signed integer in
      hid_parser_global to fix reading specification-complying values. This
      fixes resolution calculation of devices complying to the HID standard,
      including Huion, KYE, Waltop and UC-Logic graphics tablets which have
      their report descriptors fixed by the drivers.
      
      Explanations follow.
      
      There are two "unit exponents" in HID specification and it is important
      not to mix them. One is the global "Unit Exponent" item and another is
      nibble values in the global "Unit" item. See 6.2.2.7 Global Items.
      
      The "Unit Exponent" value is just a signed integer and is used to scale
      the integer resolution unit values, so fractions can be expressed.
      
      The nibbles of "Unit" value are used to select the unit system (nibble
      0), and presence of a particular basic unit type in the unit formula and
      its *exponent* (or power, nibbles 1-6). And yes, the latter is in two
      complement and zero means absence of the unit type.
      
      Taking the representation example of (integer) joules from the
      specification:
      
      [mass(grams)][length(centimeters)^2][time(seconds)^-2] * 10^-7
      
      the "Unit Exponent" would be -7 (or 0xF9, if stored as a byte) and the
      "Unit" value would be 0xE121, signifying:
      
      Nibble  Part        Value   Meaning
      -----   ----        -----   -------
      0       System      1       SI Linear
      1       Length      2       Centimeters^2
      2       Mass        1       Grams
      3       Time        -2      Seconds^-2
      
      To give the resolution in e.g. hundredth of joules the "Unit Exponent"
      item value should have been -9.
      
      See also the examples of "Unit" values for some common units in the same
      chapter.
      
      However, there is a common misunderstanding about the "Unit Exponent"
      value encoding, where it is assumed to be stored the same as nibbles in
      "Unit" item. This is most likely due to the specification being a bit
      vague and overloading the term "unit exponent". This also was and still
      is proliferated by the official "HID Descriptor Tool", which makes this
      mistake and stores "Unit Exponent" as such. This format is also
      mentioned in books such as "USB Complete" and in Microsoft's hardware
      design guides.
      
      As a result many devices currently on the market use this encoding and
      so the driver should support them.
      Signed-off-by: NNikolai Kondrashov <spbnick@gmail.com>
      Acked-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      ad0e669b
  2. 13 9月, 2013 1 次提交
  3. 02 9月, 2013 1 次提交
  4. 31 7月, 2013 1 次提交
    • D
      HID: input: generic hidinput_input_event handler · 50c9d75b
      David Herrmann 提交于
      The hidinput_input_event() callback converts input events written from
      userspace into HID reports and sends them to the device. We currently
      implement this in every HID transport driver, even though most of them do
      the same.
      
      This provides a generic hidinput_input_event() implementation which is
      mostly copied from usbhid. It uses a delayed worker to allow multiple LED
      events to be collected into a single output event.
      We use the custom ->request() transport driver callback to allow drivers
      to adjust the outgoing report and handle the request asynchronously. If no
      custom ->request() callback is available, we fall back to the generic raw
      output report handler (which is synchronous).
      
      Drivers can still provide custom hidinput_input_event() handlers (see
      logitech-dj) if the generic implementation doesn't fit their needs.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      50c9d75b
  5. 20 6月, 2013 2 次提交
  6. 29 5月, 2013 1 次提交
    • D
      HID: input: return ENODATA if reading battery attrs fails · d0a934b7
      David Herrmann 提交于
      power_supply core has the bad habit of calling our battery callbacks
      from within power_supply_register(). Furthermore, if the callbacks
      fail with an unhandled error code, it will skip any uevent that it
      might currently process.
      So if HID-core registers battery devices, an "add" uevent is generated
      and the battery callbacks are called. These will gracefully fail due
      to timeouts as they might still hold locks on event processing. One
      could argue that this should be fixed in power_supply core, but the
      least we can do is to signal ENODATA so power_supply core will just
      skip the property and continue with the uevent.
      
      This fixes a bug where "add" and "remove" uevents are skipped for
      battery devices. upower is unable to track these devices and currently
      needs to ignore them.
      
      This patch also overwrites any other error code. I cannot see any reason
      why we should forward protocol- or I/O-errors to the power_supply core.
      We handle these errors in hid_ll_driver later, anyway, so just skip
      them. power_supply core cannot do anything useful with them, anyway,
      and we avoid skipping important uevents and confusing user-space.
      
      Thanks a lot to Daniel Nicoletti for pushing and investigating
      on this.
      
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Anton Vorontsov <cbou@mail.ru>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Reported-by: NDaniel Nicoletti <dantti12@gmail.com>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      d0a934b7
  7. 27 3月, 2013 1 次提交
  8. 29 11月, 2012 1 次提交
  9. 26 11月, 2012 1 次提交
  10. 15 11月, 2012 3 次提交
  11. 31 10月, 2012 1 次提交
    • I
      HID: fix incorrect handling of devices with high button count · f8e86d05
      Ingo Ruhnke 提交于
      Button names for USB gamepads are currently assigned incorrectly, as the evdev
      code assigned to buttons is "BTN_GAMEPAD + code", which on devices with more
      then 16 buttons bleeds over into button names reserved for graphic tablets
      (BTN_TOOL_PEN, etc.). This causes problems further down the line as the device
      are now no longer detected as joystick. This patch fixes that by assigning
      buttons outside the range to BTN_TRIGGER_HAPPY (as is already the case for USB
      joysticks).
      
      Furthermore this patch corrects the assignment to BTN_TRIGGER_HAPPY, as
      currently the first button over 16 is assigned to BTN_TRIGGER_HAPPY17 (i.e.
      BTN_TRIGGER_HAPPY+0x10) not BTN_TRIGGER_HAPPY.
      Signed-off-by: NIngo Ruhnke <grumbel@gmail.com>
      Acked-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      f8e86d05
  12. 20 9月, 2012 1 次提交
  13. 09 7月, 2012 1 次提交
  14. 04 7月, 2012 1 次提交
  15. 01 5月, 2012 1 次提交
    • H
      HID: hid-multitouch: Switch to device groups · 4fa3a583
      Henrik Rydberg 提交于
      Switch the driver over to device group handling.  By adding the
      HID_GROUP_MULTITOUCH group to hid-core, hid-generic will no longer
      match multitouch devices.  By adding the HID_GROUP_MULTITOUCH entry to
      the device list, hid-multitouch will match all unknown multitouch
      devices, and udev will automatically load the module.
      
      Since HID_QUIRK_MULTITOUCH never gets set, the special quirks handling
      can be removed.  Since all HID MT devices have HID_DG_CONTACTID, they
      can be removed from the hid_have_special_driver list.
      
      With this patch, the unknown device ids are no longer NULL, so the code
      is modified to check for the generic entry instead.
      Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
      Acked-by: NBenjamin Tissoires <benjamin.tissoires@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      4fa3a583
  16. 28 3月, 2012 1 次提交
  17. 05 3月, 2012 1 次提交
    • N
      HID: hid-input: allow array fields out of range · 883e0e36
      Nikolai Kondrashov 提交于
      Allow array field values out of range as per HID 1.11 specification,
      section 6.2.25:
      
      	Rather than returning a single bit for each button in the group, an
      	array returns an index in each field that corresponds to the pressed
      	button (like keyboard scan codes). An out-of range value in and array
      	field is considered no controls asserted.
      
      Apparently, "and" above is a typo and should be "an".
      
      This fixes at least Waltop tablet pen clicks - otherwise BTN_TOUCH is never
      released.
      
      The relevant part of Waltop tablet report descriptors is this:
      
      	0x09, 0x42,         /*          Usage (Tip Switch),         */
      	0x09, 0x44,         /*          Usage (Barrel Switch),      */
      	0x09, 0x46,         /*          Usage (Tablet Pick),        */
      	0x15, 0x01,         /*          Logical Minimum (1),        */
      	0x25, 0x03,         /*          Logical Maximum (3),        */
      	0x75, 0x04,         /*          Report Size (4),            */
      	0x95, 0x01,         /*          Report Count (1),           */
      	0x80,               /*          Input,                      */
      
      This is a regression fix for commit b4b583d4 ("HID: be more strict when
      ignoring out-of-range fields").
      Signed-off-by: NNikolai Kondrashov <spbnick@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      883e0e36
  18. 04 2月, 2012 1 次提交
  19. 08 1月, 2012 8 次提交
  20. 21 12月, 2011 1 次提交
  21. 30 11月, 2011 1 次提交
  22. 28 11月, 2011 1 次提交
    • J
      HID: hid-input: add support for HID devices reporting Battery Strength · 4f5ca836
      Jeremy Fitzhardinge 提交于
      Some HID devices, such as my Bluetooth mouse, report their battery
      strength as an event.  Rather than passing it through as a strange
      absolute input event, this patch registers it with the power_supply
      subsystem as a battery, so that the device's Battery Strength can be
      reported to usermode.
      
      The battery appears in sysfs names
      /sys/class/power_supply/hid-<UNIQ>-battery, and it is a child of the
      battery-containing device, so it should be clear what it's the battery of.
      
      Unfortunately on my current Fedora 16 system, while the battery does
      appear in the UI, it is listed as a Laptop Battery with 0% charge (since
      it ignores the "capacity" property of the battery and instead computes
      it from the "energy*" fields, which we can't supply given the limited
      information contained within the HID Report).
      
      Still, this patch is the first step.
      Signed-off-by: NJeremy Fitzhardinge <jeremy@goop.org>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      4f5ca836
  23. 16 11月, 2011 2 次提交
  24. 26 9月, 2011 1 次提交
  25. 18 5月, 2011 1 次提交
    • J
      HID: assorted usage updates from hut 1.12 · 437f3b19
      Jarod Wilson 提交于
      I've got a Tivo Slide bluetooth remote/dongle, which uses a fair number
      of hid usages that aren't currently mapped in hid-input.c. I'd initially
      written additions to hid-input.c with just this device in mind,
      including some bits that were specific to the device. This go around,
      I'm looking at adding/correcting as many generic HID usages from the HID
      Usage Tables, version 1.12, as I can -- which also serves to enable all
      but four of the buttons on the Tivo Slide remote[*].
      
      Outside of fixing the obviously incorrect mapping of 0xc 0x45 from
      KEY_RADIO to KEY_RIGHT, and making use of the new KEY_IMAGES (just added
      in 2.6.39-rc4) for AL Image Browser instead of KEY_MEDIA, these are
      purely additions, and thus should have no negative impact on any already
      functional HID devices. Most of the added mappings seemed to be
      perfectly logical to me, but there were a few that were mapped on more
      of an "I think this makes the most sense" basis.
      
      [*] I'll handle the last four tivo buttons via an hid-tivo.c follow-up.
      
      CC: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      CC: Jiri Kosina <jkosina@suse.cz>
      Signed-off-by: NJarod Wilson <jarod@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      437f3b19
  26. 02 3月, 2011 1 次提交
  27. 16 2月, 2011 1 次提交
  28. 01 2月, 2011 1 次提交
  29. 12 1月, 2011 1 次提交