libs/core: add more heuristics to infer device name from switch name