code: def _update_states(self, uid, states):
          
          #TODO: use try and catch all exceptions
          # test if uid exists
          if self.controllers[uid]:
              # test if states have correct lenght
              if len(states) == 14:
                  old_states = self.controllers[uid][2]
                  if old_states != states:
                      for key in range(14):
                          if int(old_states[key]) > int(states[key]):
                              e = Event(uid, E_KEYUP, key)
                              self.queue.put_nowait(e)
                          elif int(old_states[key]) < int(states[key]):
                              e = Event(uid, E_KEYDOWN, key)
                              self.queue.put_nowait(e)
                  self.controllers[uid][2] = states
              self.controllers[uid][3] = time.time()
docs: Got states of all buttons from a controller. Now check if something changed and create events if neccesary.
  
          :param uid: Unique id of the controller
          :param states: Buttons states
          :type uid: str
          :type states: str