@@ -979,15 +979,36 @@ def test_mt_azimuth(self):
979979 assert libevdev .InputEvent (libevdev .EV_ABS .ABS_MT_ORIENTATION , 90 ) in events
980980
981981 class TestPTP (TestWin8Multitouch ):
982+ def test_buttontype (self ):
983+ """Check for the right ButtonType."""
984+ uhdev = self .uhdev
985+ assert uhdev is not None
986+ evdev = uhdev .get_evdev ()
987+
988+ # If libevdev.so is not yet compiled with INPUT_PROP_PRESSUREPAD
989+ # python-libevdev won't have it either, let's fake it
990+ if not getattr (libevdev , "INPUT_PROP_PRESSUREPAD" , None ):
991+ prop = libevdev .InputProperty (name = "INPUT_PROP_PRESSUREPAD" , value = 0x7 )
992+ libevdev .INPUT_PROP_PRESSUREPAD = prop
993+ libevdev .props .append (prop )
994+
995+ if uhdev .buttontype == HIDButtonType .CLICKPAD :
996+ assert libevdev .INPUT_PROP_BUTTONPAD in evdev .properties
997+ elif uhdev .buttontype == HIDButtonType .PRESSUREPAD :
998+ assert libevdev .INPUT_PROP_PRESSUREPAD in evdev .properties
999+ else :
1000+ assert libevdev .INPUT_PROP_PRESSUREPAD not in evdev .properties
1001+ assert libevdev .INPUT_PROP_BUTTONPAD not in evdev .properties
1002+
9821003 def test_ptp_buttons (self ):
9831004 """check for button reliability.
984- There are 2 types of touchpads: the click pads and the pressure pads.
985- Each should reliably report the BTN_LEFT events.
1005+ There are 3 types of touchpads: click pads + pressure pads and
1006+ those with discrete buttons. Each should reliably report the BTN_LEFT events.
9861007 """
9871008 uhdev = self .uhdev
9881009 evdev = uhdev .get_evdev ()
9891010
990- if uhdev .buttontype == HIDButtonType .CLICKPAD :
1011+ if uhdev .buttontype in [ HIDButtonType .CLICKPAD , HIDButtonType . PRESSUREPAD ] :
9911012 r = uhdev .event (click = True )
9921013 events = uhdev .next_sync_events ()
9931014 self .debug_reports (r , uhdev , events )
@@ -999,7 +1020,7 @@ def test_ptp_buttons(self):
9991020 self .debug_reports (r , uhdev , events )
10001021 assert libevdev .InputEvent (libevdev .EV_KEY .BTN_LEFT , 0 ) in events
10011022 assert evdev .value [libevdev .EV_KEY .BTN_LEFT ] == 0
1002- else :
1023+ elif uhdev . buttontype == HIDButtonType . DISCRETE_BUTTONS :
10031024 r = uhdev .event (left = True )
10041025 events = uhdev .next_sync_events ()
10051026 self .debug_reports (r , uhdev , events )
@@ -2062,6 +2083,16 @@ def create_device(self):
20622083 )
20632084
20642085
2086+ class Testven_0488_108c (BaseTest .TestPTP ):
2087+ def create_device (self ):
2088+ return PTP (
2089+ "uhid test ven_0488_108c" ,
2090+ rdesc = "05 01 09 02 a1 01 85 06 09 01 a1 00 05 09 19 01 29 03 15 00 25 01 95 03 75 01 81 02 95 01 75 05 81 03 05 01 09 30 09 31 09 38 15 81 25 7f 75 08 95 03 81 06 c0 c0 05 0d 09 05 a1 01 85 01 05 0d 09 22 a1 02 15 00 25 01 09 47 09 42 95 02 75 01 81 02 95 01 75 03 25 05 09 51 81 02 81 03 05 01 15 00 26 ba 0d 75 10 55 0e 65 11 09 30 35 00 46 d0 05 95 01 81 02 26 d0 06 46 bb 02 09 31 81 02 05 0d 95 01 75 10 26 ff 7f 46 ff 7f 09 30 81 02 c0 05 0d 09 22 a1 02 15 00 25 01 09 47 09 42 95 02 75 01 81 02 95 01 75 03 25 05 09 51 81 02 81 03 05 01 15 00 26 ba 0d 75 10 55 0e 65 11 09 30 35 00 46 d0 05 95 01 81 02 26 d0 06 46 bb 02 09 31 81 02 05 0d 95 01 75 10 26 ff 7f 46 ff 7f 09 30 81 02 c0 05 0d 09 22 a1 02 15 00 25 01 09 47 09 42 95 02 75 01 81 02 95 01 75 03 25 05 09 51 81 02 81 03 05 01 15 00 26 ba 0d 75 10 55 0e 65 11 09 30 35 00 46 d0 05 95 01 81 02 26 d0 06 46 bb 02 09 31 81 02 05 0d 95 01 75 10 26 ff 7f 46 ff 7f 09 30 81 02 c0 55 0c 66 01 10 47 ff ff 00 00 27 ff ff 00 00 75 10 95 01 05 0d 09 56 81 02 09 54 25 05 95 01 75 08 81 02 05 09 09 01 25 01 75 01 95 01 81 02 95 07 81 03 05 0d 85 02 09 55 75 08 95 01 25 05 b1 02 09 59 b1 02 06 00 ff 85 03 09 c5 15 00 26 ff 00 75 08 96 00 01 b1 02 05 0e 09 01 a1 02 85 13 09 23 15 00 25 64 75 08 95 01 b1 02 c0 c0 05 0d 09 0e a1 01 85 04 09 22 a1 02 09 52 15 00 25 0a 75 08 95 01 b1 02 c0 09 22 a1 00 85 05 09 57 09 58 75 01 95 02 25 01 b1 02 95 06 b1 03 c0 c0 06 01 ff 09 02 a1 01 09 00 85 07 15 00 26 ff 00 75 08 96 12 02 b1 02 c0 06 00 ff 09 01 a1 01 85 0d 15 00 26 ff 00 75 08 95 11 09 01 81 02 09 01 91 02 c0 05 0e 09 01 a1 01 85 11 09 35 15 00 26 ff 00 75 08 95 17 b1 02 c0 06 81 ff 09 01 a1 01 09 20 85 17 15 00 26 ff 00 75 08 95 3f 09 01 81 02 09 01 91 02 c0" ,
2091+ input_info = (0x18 , 0x0488 , 0x108C ),
2092+ buttontype = HIDButtonType .PRESSUREPAD ,
2093+ )
2094+
2095+
20652096class Testn_trig_1b96_0c01 (BaseTest .TestWin8Multitouch ):
20662097 def create_device (self ):
20672098 return Digitizer (
0 commit comments