code: static String codeToString(String type, short code) {
          int i = type.indexOf("_");
          if (i >= 0) {
              String prefix = type.substring(i + 1);
              String altPrefix = prefix.equals("KEY") ? "BTN" : prefix;
              for (Field field : LinuxInput.class.getDeclaredFields()) {
                  String name = field.getName();
                  try {
                      if ((name.startsWith(prefix) || name.startsWith(altPrefix))
                              && field.getType() == Short.TYPE
                              && field.getShort(null) == code) {
                          return field.getName();
                      }
                  } catch (IllegalAccessException e) {
                  }
              }
          }
          return new Formatter().format("0x%04x", code & 0xffff).out().toString();
      }
docs: Convert an event code to its equivalent string, given its type string.
  The type string is needed because event codes are context sensitive. For
  example, the code 1 is "SYN_CONFIG" for an EV_SYN event but "KEY_ESC" for
  an EV_KEY event.  This method is inefficient and is for debugging use
  only.