implement pin state query for input.
modify pin state query.