auto detect whether use master/slave mode