Add function to get device mode