]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Merge branch 'for-6.8/wacom' into for-linus
authorJiri Kosina <jkosina@suse.com>
Mon, 8 Jan 2024 20:15:36 +0000 (21:15 +0100)
committerJiri Kosina <jkosina@suse.com>
Mon, 8 Jan 2024 20:15:36 +0000 (21:15 +0100)
- functional fix for handling Confidence in Wacom driver (Jason Gerecke)
- power management fix for Wacom userspace battery exporting (Tatsunosuke Tobita)

Conflicts:
tools/testing/selftests/hid/tests/test_wacom_generic.py

1  2 
tools/testing/selftests/hid/tests/test_wacom_generic.py

index 49186a27467e63ce82e70499629d10bd360527ad,a7ee54e5090bbdf7f6958eae55a448e8716b1fd2..352fc39f3c6c160bfdcd2b3c655bfe319f00892c
@@@ -917,6 -971,228 +971,228 @@@ class TestDTH2452Tablet(test_multitouch
          events = uhdev.next_sync_events()
          self.debug_reports(r, uhdev, events)
  
 -        slot = self.get_slot(uhdev, t0, 0)
 +        _slot = self.get_slot(uhdev, t0, 0)
  
          assert not events
+     def test_confidence_multitouch(self):
+         """
+         Bring multiple fingers in contact with the tablet, some with the
+         confidence bit set, and some without.
+         Ensure that all confident touches are reported and that all non-
+         confident touches are ignored.
+         """
+         uhdev = self.uhdev
+         evdev = uhdev.get_evdev()
+         touches = self.make_contacts(5)
+         touches[0].confidence = False
+         touches[2].confidence = False
+         touches[4].confidence = False
+         r = uhdev.event(touches)
+         events = uhdev.next_sync_events()
+         self.debug_reports(r, uhdev, events)
+         assert libevdev.InputEvent(libevdev.EV_KEY.BTN_TOUCH, 1) in events
+         self.assert_contacts(uhdev, evdev,
+             [ self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = None),
+               self.ContactIds(contact_id = 1, tracking_id = 0, slot_num = 0),
+               self.ContactIds(contact_id = 2, tracking_id = -1, slot_num = None),
+               self.ContactIds(contact_id = 3, tracking_id = 1, slot_num = 1),
+               self.ContactIds(contact_id = 4, tracking_id = -1, slot_num = None) ])
+     def confidence_change_assert_playback(self, uhdev, evdev, timeline):
+         """
+         Assert proper behavior of contacts that move and change tipswitch /
+         confidence status over time.
+         Given a `timeline` list of touch states to iterate over, verify
+         that the contacts move and are reported as up/down as expected
+         by the state of the tipswitch and confidence bits.
+         """
+         t = 0
+         for state in timeline:
+             touches = self.make_contacts(len(state), t)
+             for item in zip(touches, state):
+                 item[0].tipswitch = item[1][1]
+                 item[0].confidence = item[1][2]
+             r = uhdev.event(touches)
+             events = uhdev.next_sync_events()
+             self.debug_reports(r, uhdev, events)
+             ids = [ x[0] for x in state ]
+             self.assert_contacts(uhdev, evdev, ids, t)
+             t += 1
+     def test_confidence_loss_a(self):
+         """
+         Transition a confident contact to a non-confident contact by
+         first clearing the tipswitch.
+         Ensure that the driver reports the transitioned contact as
+         being removed and that other contacts continue to report
+         normally. This mode of confidence loss is used by the
+         DTH-2452.
+         """
+         uhdev = self.uhdev
+         evdev = uhdev.get_evdev()
+         self.confidence_change_assert_playback(uhdev, evdev, [
+             # t=0: Contact 0 == Down + confident; Contact 1 == Down + confident
+             # Both fingers confidently in contact
+             [(self.ContactIds(contact_id = 0, tracking_id = 0, slot_num = 0), True, True),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)],
+             # t=1: Contact 0 == !Down + confident; Contact 1 == Down + confident
+             # First finger looses confidence and clears only the tipswitch flag
+             [(self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = 0), False, True),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)],
+             # t=2: Contact 0 == !Down + !confident; Contact 1 == Down + confident
+             # First finger has lost confidence and has both flags cleared
+             [(self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = 0), False, False),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)],
+             # t=3: Contact 0 == !Down + !confident; Contact 1 == Down + confident
+             # First finger has lost confidence and has both flags cleared
+             [(self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = 0), False, False),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)]
+         ])
+     def test_confidence_loss_b(self):
+         """
+         Transition a confident contact to a non-confident contact by
+         cleraing both tipswitch and confidence bits simultaneously.
+         Ensure that the driver reports the transitioned contact as
+         being removed and that other contacts continue to report
+         normally. This mode of confidence loss is used by some
+         AES devices.
+         """
+         uhdev = self.uhdev
+         evdev = uhdev.get_evdev()
+         self.confidence_change_assert_playback(uhdev, evdev, [
+             # t=0: Contact 0 == Down + confident; Contact 1 == Down + confident
+             # Both fingers confidently in contact
+             [(self.ContactIds(contact_id = 0, tracking_id = 0, slot_num = 0), True, True),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)],
+             # t=1: Contact 0 == !Down + !confident; Contact 1 == Down + confident
+             # First finger looses confidence and has both flags cleared simultaneously
+             [(self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = 0), False, False),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)],
+             # t=2: Contact 0 == !Down + !confident; Contact 1 == Down + confident
+             # First finger has lost confidence and has both flags cleared
+             [(self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = 0), False, False),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)],
+             # t=3: Contact 0 == !Down + !confident; Contact 1 == Down + confident
+             # First finger has lost confidence and has both flags cleared
+             [(self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = 0), False, False),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)]
+         ])
+     def test_confidence_loss_c(self):
+         """
+         Transition a confident contact to a non-confident contact by
+         clearing only the confidence bit.
+         Ensure that the driver reports the transitioned contact as
+         being removed and that other contacts continue to report
+         normally.
+         """
+         uhdev = self.uhdev
+         evdev = uhdev.get_evdev()
+         self.confidence_change_assert_playback(uhdev, evdev, [
+             # t=0: Contact 0 == Down + confident; Contact 1 == Down + confident
+             # Both fingers confidently in contact
+             [(self.ContactIds(contact_id = 0, tracking_id = 0, slot_num = 0), True, True),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)],
+             # t=1: Contact 0 == Down + !confident; Contact 1 == Down + confident
+             # First finger looses confidence and clears only the confidence flag
+             [(self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = 0), True, False),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)],
+             # t=2: Contact 0 == !Down + !confident; Contact 1 == Down + confident
+             # First finger has lost confidence and has both flags cleared
+             [(self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = 0), False, False),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)],
+             # t=3: Contact 0 == !Down + !confident; Contact 1 == Down + confident
+             # First finger has lost confidence and has both flags cleared
+             [(self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = 0), False, False),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)]
+         ])
+     def test_confidence_gain_a(self):
+         """
+         Transition a contact that was always non-confident to confident.
+         Ensure that the confident contact is reported normally.
+         """
+         uhdev = self.uhdev
+         evdev = uhdev.get_evdev()
+         self.confidence_change_assert_playback(uhdev, evdev, [
+             # t=0: Contact 0 == Down + !confident; Contact 1 == Down + confident
+             # Only second finger is confidently in contact
+             [(self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = None), True, False),
+              (self.ContactIds(contact_id = 1, tracking_id = 0, slot_num = 0), True, True)],
+             # t=1: Contact 0 == Down + !confident; Contact 1 == Down + confident
+             # First finger gains confidence
+             [(self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = None), True, False),
+              (self.ContactIds(contact_id = 1, tracking_id = 0, slot_num = 0), True, True)],
+             # t=2: Contact 0 == Down + confident; Contact 1 == Down + confident
+             # First finger remains confident
+             [(self.ContactIds(contact_id = 0, tracking_id = 1, slot_num = 1), True, True),
+              (self.ContactIds(contact_id = 1, tracking_id = 0, slot_num = 0), True, True)],
+             # t=3: Contact 0 == Down + confident; Contact 1 == Down + confident
+             # First finger remains confident
+             [(self.ContactIds(contact_id = 0, tracking_id = 1, slot_num = 1), True, True),
+              (self.ContactIds(contact_id = 1, tracking_id = 0, slot_num = 0), True, True)]
+         ])
+     def test_confidence_gain_b(self):
+         """
+         Transition a contact from non-confident to confident.
+         Ensure that the confident contact is reported normally.
+         """
+         uhdev = self.uhdev
+         evdev = uhdev.get_evdev()
+         self.confidence_change_assert_playback(uhdev, evdev, [
+             # t=0: Contact 0 == Down + confident; Contact 1 == Down + confident
+             # First and second finger confidently in contact
+             [(self.ContactIds(contact_id = 0, tracking_id = 0, slot_num = 0), True, True),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)],
+             # t=1: Contact 0 == Down + !confident; Contact 1 == Down + confident
+             # Firtst finger looses confidence
+             [(self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = 0), True, False),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)],
+             # t=2: Contact 0 == Down + confident; Contact 1 == Down + confident
+             # First finger gains confidence
+             [(self.ContactIds(contact_id = 0, tracking_id = 2, slot_num = 0), True, True),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)],
+             # t=3: Contact 0 == !Down + confident; Contact 1 == Down + confident
+             # First finger goes up
+             [(self.ContactIds(contact_id = 0, tracking_id = -1, slot_num = 0), False, True),
+              (self.ContactIds(contact_id = 1, tracking_id = 1, slot_num = 1), True, True)]
+         ])