modify query_device function, and know port 1 is active.