@@ -1741,26 +1741,23 @@ def process(self):
17411741 self .on_change ([(button , button in new_state ) for button in state_diff ])
17421742
17431743
1744- # ~autogen button-class classes.button>currentClass
1745- class Button (ButtonBase ):
1744+ class ButtonEVIO (ButtonBase ):
17461745
17471746 """
1748- Provides a generic button reading mechanism that can be adapted
1749- to platform specific implementations. Each platform's specific
1750- button capabilites are enumerated in the 'platforms' section
1751- of this specification
1747+ Provides a generic button reading mechanism that works with event interface
1748+ and may be adapted to platform specific implementations.
17521749
17531750 This implementation depends on the availability of the EVIOCGKEY ioctl
17541751 to be able to read the button state buffer. See Linux kernel source
17551752 in /include/uapi/linux/input.h for details.
17561753 """
17571754
1758- # ~autogen
1759-
17601755 KEY_MAX = 0x2FF
17611756 KEY_BUF_LEN = int ((KEY_MAX + 7 ) / 8 )
17621757 EVIOCGKEY = (2 << (14 + 8 + 8 ) | KEY_BUF_LEN << (8 + 8 ) | ord ('E' ) << 8 | 0x18 )
17631758
1759+ _buttons = {}
1760+
17641761 def __init__ (self ):
17651762 self ._file_cache = FileCache ()
17661763 self ._buffer_cache = {}
@@ -1789,51 +1786,7 @@ def buttons_pressed(self):
17891786 pressed += [k ]
17901787 return pressed
17911788
1792- if current_platform () == 'ev3' :
1793- # ~autogen button-property platforms.ev3.button>currentClass
1794-
1795- on_up = None
1796- on_down = None
1797- on_left = None
1798- on_right = None
1799- on_enter = None
1800- on_backspace = None
1801-
1802- _buttons = {
1803- 'up' : {'name' : '/dev/input/by-path/platform-gpio-keys.0-event' , 'value' : 103 },
1804- 'down' : {'name' : '/dev/input/by-path/platform-gpio-keys.0-event' , 'value' : 108 },
1805- 'left' : {'name' : '/dev/input/by-path/platform-gpio-keys.0-event' , 'value' : 105 },
1806- 'right' : {'name' : '/dev/input/by-path/platform-gpio-keys.0-event' , 'value' : 106 },
1807- 'enter' : {'name' : '/dev/input/by-path/platform-gpio-keys.0-event' , 'value' : 28 },
1808- 'backspace' : {'name' : '/dev/input/by-path/platform-gpio-keys.0-event' , 'value' : 14 },
1809- }
1810-
1811- @property
1812- def up (self ):
1813- return 'up' in self .buttons_pressed
1814-
1815- @property
1816- def down (self ):
1817- return 'down' in self .buttons_pressed
18181789
1819- @property
1820- def left (self ):
1821- return 'left' in self .buttons_pressed
1822-
1823- @property
1824- def right (self ):
1825- return 'right' in self .buttons_pressed
1826-
1827- @property
1828- def enter (self ):
1829- return 'enter' in self .buttons_pressed
1830-
1831- @property
1832- def backspace (self ):
1833- return 'backspace' in self .buttons_pressed
1834-
1835-
1836- # ~autogen
18371790# ~autogen remote-control classes.infraredSensor.remoteControl>currentClass
18381791class RemoteControl (ButtonBase ):
18391792 """
0 commit comments