Refactor ToggleCECDevice for upstream