physical device main loop algo