  for regex patterns always do r in your case r s  s data vendor id  data product id meanwhile is equivalent to match any char the is useless here because overrides it  what s the real pattern you want to match here in  sys bus hid devices there are directories with names like cb i am just trying to look up the one which contains the vid and pid which genericinput found  you may have noticed i do not write a lot of python  what i have seems to work  but i am sure it is not the best way to do it 