1313import json
1414import time
1515
16- # import evdev
17- from evdev import InputDevice , categorize , ecodes , list_devices
16+ import evdev
17+ # from evdev import InputDevice, categorize, ecodes, list_devices
1818
1919import asyncio
2020
@@ -230,7 +230,7 @@ def scan_devices(self):
230230 self .inputs = []
231231 self .input_data = {}
232232
233- self .inputs = [InputDevice (path ) for path in list_devices ()]
233+ self .inputs = [evdev . InputDevice (path ) for path in evdev . list_devices ()]
234234
235235 if self .DEBUG :
236236 print ("scan_devices: len(self.inputs): " + str (len (self .inputs )))
@@ -307,7 +307,7 @@ async def print_events(self,device):
307307 try :
308308 async for event in device .async_read_loop ():
309309
310- event_category = str (categorize (event ))
310+ event_category = str (evdev . categorize (event ))
311311
312312 #print("event_category: " + str(event_category))
313313
@@ -329,7 +329,7 @@ async def print_events(self,device):
329329
330330 #if self.input_data[device.path]['has_buttons'] == True:
331331
332- #print("_OK_" , device.path, categorize(event), event, sep=': ')
332+ #print("_OK_" , device.path, evdev. categorize(event), event, sep=': ')
333333
334334 #print("VAL! " + str(event.value))
335335
@@ -341,19 +341,19 @@ async def print_events(self,device):
341341
342342
343343 #if self.input_data[device.path]['has_buttons'] == True:
344- # print("X" , device.path, categorize(event), event, sep=': ')
344+ # print("X" , device.path, evdev. categorize(event), event, sep=': ')
345345
346346 #else:
347347 # continue
348348
349349
350350
351351
352- if event .type == ecodes .EV_KEY or event_category .startswith ('key event' ) or (event_category .startswith ('absolute axis event' ) and self .input_data [device .path ]['has_buttons' ] == True ):
352+ if event .type == evdev . ecodes .EV_KEY or event_category .startswith ('key event' ) or (event_category .startswith ('absolute axis event' ) and self .input_data [device .path ]['has_buttons' ] == True ):
353353
354- #print(device.path, categorize(event), sep=': ')
354+ #print(device.path, evdev. categorize(event), sep=': ')
355355 #print("event: " + str(event))
356- #print("categorize(event): " + str(categorize(event)))
356+ #print("evdev. categorize(event): " + str(evdev. categorize(event)))
357357
358358 self .input_data [device .path ]['has_buttons' ] = True
359359
@@ -373,7 +373,7 @@ async def print_events(self,device):
373373 if (self .input_data [device .path ]['capabilities' ]['EV_ABS' ]['children' ][abs_code ]['last_time' ] < time .time () - self .rate_limit ) or ('max' in self .input_data [device .path ]['capabilities' ]['EV_ABS' ]['children' ][abs_code ].keys () and self .input_data [device .path ]['capabilities' ]['EV_ABS' ]['children' ][abs_code ]['max' ] == 1 ):
374374 self .input_data [device .path ]['capabilities' ]['EV_ABS' ]['children' ][abs_code ]['last_time' ] = time .time ()
375375
376- #print(device.path, categorize(event), sep=': ')
376+ #print(device.path, evdev. categorize(event), sep=': ')
377377 #print("event: " + str(event))
378378
379379 if 'nice_name' in self .input_data [device .path ]: # and self.input_data[device.path]['nice_name'] in self.devices.keys():
0 commit comments