# Path: resources/lib/model/inputdevice.py
# class InputDevice:
#     def __init__(self):
#         self.name = None
#         self.handlers = []
#         self.mapping = None
# 
#     def is_kbd(self):
#         return False
#         # found_kbd = False
#         # found_js = False
#         # for _handler in self.handlers:
#         #     if _handler[:-1] == 'kbd':
#         #         found_kbd = True
#         #     if _handler[:-1] == 'js':
#         #         found_js = True
#         #
#         # return found_kbd and not found_js
# 
#     def is_mouse(self):
#         return False
#         # found_mouse = False
#         # found_js = False
#         # for _handler in self.handlers:
#         #     if _handler[:-1] == 'mouse':
#         #         found_mouse = True
#         #     if _handler[:-1] == 'js':
#         #         found_js = True
#         #
#         # return found_mouse and not found_js
# 
#     def is_none_device(self):
#         return self.name == 'None (Disabled)'
# 
#     def get_evdev(self):
#         for handler in self.handlers:
#             if handler[:-1] == 'event':
#                 return os.path.join('/dev/input', handler)


import os
import re
from resources.lib.model.inputdevice import InputDevice




class DeviceWrapper:
    def __init__(self):
        self.devices = []
        self.init_devices()

    def init_devices(self):
        input_bus = '/proc/bus/input/devices'
        if not os.path.exists(input_bus):
            message = 'Input bus (%s) could not be accessed.' % input_bus
            raise OSError(message)
        with open(input_bus) as f:
            device = None
            for line in f.readlines():
                if line.startswith('I:'):

# Path: resources/lib/model/inputdevice.py
# class InputDevice:
#     def __init__(self):
#         self.name = None
#         self.handlers = []
#         self.mapping = None
# 
#     def is_kbd(self):
#         return False
#         # found_kbd = False
#         # found_js = False
#         # for _handler in self.handlers:
#         #     if _handler[:-1] == 'kbd':
#         #         found_kbd = True
#         #     if _handler[:-1] == 'js':
#         #         found_js = True
#         #
#         # return found_kbd and not found_js
# 
#     def is_mouse(self):
#         return False
#         # found_mouse = False
#         # found_js = False
#         # for _handler in self.handlers:
#         #     if _handler[:-1] == 'mouse':
#         #         found_mouse = True
#         #     if _handler[:-1] == 'js':
#         #         found_js = True
#         #
#         # return found_mouse and not found_js
# 
#     def is_none_device(self):
#         return self.name == 'None (Disabled)'
# 
#     def get_evdev(self):
#         for handler in self.handlers:
#             if handler[:-1] == 'event':
#                 return os.path.join('/dev/input', handler)


# Path: resources/lib/util/devicewrapper.py
import os
import re
from resources.lib.model.inputdevice import InputDevice





class DeviceWrapper:
    def __init__(self):
        self.devices = []
        self.init_devices()

    def init_devices(self):
        input_bus = '/proc/bus/input/devices'
        if not os.path.exists(input_bus):
            message = 'Input bus (%s) could not be accessed.' % input_bus
            raise OSError(message)
        with open(input_bus) as f:
            device = None
            for line in f.readlines():
                if line.startswith('I:'):

                    device = InputDevice()