@@ -32,10 +32,18 @@ def __eq__(self, o):
3232
3333
3434
35- _AbsInfo = namedtuple ('AbsInfo ' ,
35+ _AbsData = namedtuple ('AbsData ' ,
3636 ['min' , 'max' , 'fuzz' , 'flat' ])
3737
38- class AbsInfo (_AbsInfo ):
38+ class AbsData (_AbsData ):
39+ '''
40+ A ``namedtuple`` for storing absolut axis information:
41+
42+ - min - minimal value for an absolute axis
43+ - max - maximum value for an absolute axis
44+ - fuzz - noise tolerance (+- value)
45+ - flat - size of the center flat position
46+ '''
3947 pass
4048
4149
@@ -70,17 +78,20 @@ def __init__(self, dev, nophys=False):
7078
7179 #: The physical topology of the device
7280 self .phys = info_res [5 ] if not nophys else ''
81+ self .phys = info_res [5 ]
82+
83+ #: The raw dictionary of device capabilities - see `:func:capabilities()`
7384 self ._rawcapabilities = info_res [6 ]
7485
75- def _capabilities (self , absinfo = True ):
86+ def _capabilities (self , absdata = True ):
7687 res = {}
7788 for etype , ecodes in self ._rawcapabilities .items ():
7889 for code in ecodes :
7990 l = res .setdefault (etype , [])
8091 if isinstance (code , tuple ):
81- if absinfo :
92+ if absdata :
8293 a = code [1 ] # (0, 0, 255, 0)
83- i = AbsInfo (min = a [1 ], max = a [2 ], fuzz = a [3 ], flat = a [4 ])
94+ i = AbsData (min = a [1 ], max = a [2 ], fuzz = a [3 ], flat = a [4 ])
8495 l .append ((code [0 ], i ))
8596 else :
8697 l .append (code [0 ])
@@ -89,7 +100,7 @@ def _capabilities(self, absinfo=True):
89100
90101 return res
91102
92- def capabilities (self , verbose = False , absinfo = True ):
103+ def capabilities (self , verbose = False , absdata = True ):
93104 '''
94105 Returns the event types that this device supports as a a mapping of
95106 supported event types to lists of handled event codes. Example::
@@ -105,24 +116,24 @@ def capabilities(self, verbose=False, absinfo=True):
105116
106117 Unknown codes or types will be resolved to '?'.
107118
108- If ``absinfo `` is ``True``, the list of capabilities will also
119+ If ``absdata `` is ``True``, the list of capabilities will also
109120 include absolute axis information (``absmin``, ``absmax``,
110121 ``absfuzz``, ``absflat``) in the following form::
111122
112- { 3 : [ (0, AbsInfo (min=0, max=255, fuzz=0, flat=0)),
113- (1, AbsInfo (min=0, max=255, fuzz=0, flat=0)) ]}
123+ { 3 : [ (0, AbsData (min=0, max=255, fuzz=0, flat=0)),
124+ (1, AbsData (min=0, max=255, fuzz=0, flat=0)) ]}
114125
115126 Combined with ``verbose`` the above becomes::
116127
117- { ('EV_ABS', 3) : [ (('ABS_X', 0), AbsInfo (min=0, max=255, fuzz=0, flat=0)),
118- (('ABS_Y', 1), AbsInfo (min=0, max=255, fuzz=0, flat=0)) ]}
128+ { ('EV_ABS', 3) : [ (('ABS_X', 0), AbsData (min=0, max=255, fuzz=0, flat=0)),
129+ (('ABS_Y', 1), AbsData (min=0, max=255, fuzz=0, flat=0)) ]}
119130
120131 '''
121132
122133 if verbose :
123- return dict (util .resolve_ecodes (self ._capabilities (absinfo )))
134+ return dict (util .resolve_ecodes (self ._capabilities (absdata )))
124135 else :
125- return self ._capabilities (absinfo )
136+ return self ._capabilities (absdata )
126137
127138 def __eq__ (self , o ):
128139 ''' Two devices are considered equal if their :data:`info` attributes are equal. '''
0 commit comments