- def getHandlerName(self, h, s):
- if h is None or len(h) == 0:
- return ""
-
- handles = h.split()
- #print "handles >> ", handles
- for tmp_h in handles:
- #print "handle_item >> ", tmp_h
- if tmp_h.startswith(s):
- #print "detected : [%s]" % tmp_h
- return tmp_h
- return ""
+ event_list = []
+ lines = data.split('\n')
+ for line in lines:
+ print ">>", line
+ if line is not None and len(line) > 0:
+ if line[0] == 'I':
+ n = ""
+ p = ""
+ h_list = []
+ elif line[0] == 'N':
+ n = line[8:].strip()
+ elif line[0] == 'P':
+ p = line[8:].strip()
+ elif line[0] == 'H':
+ h_list = line[12:].strip().split()
+ tn = line[12:].strip().find("mouse")
+ for h in h_list:
+ event_list.append((h, _(h)))
+ self.name_list.append((h, n))
+ if n[1:].startswith("dream") and self.rc_mouse is None:
+ self.rc_mouse = copy.deepcopy(h)
+ self.rc_keyboard = copy.deepcopy(h)
+ print "detected!! rc"
+ continue
+ if h.startswith("mouse") and self.usb_mouse is None:
+ self.usb_mouse = copy.deepcopy(h)
+ print "detected!! usb mouse"
+ continue
+ if tn == -1 and self.usb_keyboard is None:
+ self.usb_keyboard = copy.deepcopy(h)
+ print "detected!! usb keyboard"
+ elif line[0] == 'B' and line[3:].startswith("ABS") and p.startswith("usb-"):
+ for h in h_list:
+ if self.usb_mouse is not None:
+ break
+ if self.usb_keyboard is not None and h == self.usb_keyboard[0]:
+ self.usb_keyboard = None
+ print "clean!! usb keyboard"
+ self.usb_mouse = copy.deepcopy(h)
+ print "detected!! usb mouse"
+
+ tmp = copy.deepcopy(event_list)
+ if self.usb_mouse is not None:
+ tmp.insert(0, ("musb", "USB Mouse"))
+ if self.rc_mouse is not None:
+ tmp.insert(0, ("mrc", "Remote Control"))
+ self.mouse_list = tmp
+
+ tmp = copy.deepcopy(event_list)
+ if self.usb_keyboard is not None:
+ tmp.insert(0, ("kusb", "USB Keyboard"))
+ if self.rc_keyboard is not None:
+ tmp.insert(0, ("krc", "Remote Control"))
+ self.keyboard_list = tmp
+ print "E:", event_list
+ print "M:", self.mouse_list
+ print "K:", self.keyboard_list