RC3 CEC Switches Wrong HDMI Input

I recently installed RC3 onto my Raspberry Pi 2. Everything is working except CEC on my Sony Bravia W8.

When I first booted into OSMC, the screen was very blurry but I managed to fix it by adding the following to the /boot/config.txt
hdmi_group=1
hdmi_mode=16

I have connected the Pi 2 to the TV via HDMI port 2. However, OSMC keeps automatically switching the TV’s input to HDMI 1 and labels it ‘recorder1 (kodi)’ The screen is obviously blank as there is no signal since nothing is connected to this port.

When I switch to HDMI port 2, I can see the OSMC interface and navigate with the Kore app on my Android phone.

I tried rebooting the Pi 2 and power off the TV multiple times without any success.

For some reason, OSMC is broadcasting to HDMI port 1 when in fact it is connected to HDMI port 2 and therefore CEC is not working.

I tried looking in Settings->System->Input Devices->Peripherals->CEC and even manually changed the HDMI port to ‘2’ and after reboot, it did not work and this option has now disappeared.

Any help would be much appreciated. Thanks in advance.

If a sensible hdmi mode wasn’t chosen and CEC is misbehaving I suspect the edid is not being read.
Can you run:
tvservice -d edid.dat

and report output (and size of edid.dat file).

Sorry for the belated reply.

Thank you popcornmix for your suggestion.

I was able to fix the problem by downloading the Pi 2 RC3 image directly and flashing it onto the Micro SD card.

Previously, I used the Windows installer which downloaded the image and flashed it automatically.

The Pi 2 booted up with the right resolution and the CEC is working.

Thanks again.

The program you used to flash the image onto the SD card makes absolutely no difference to CEC - so this will not have been your problem.

For whatever reason a fresh install has fixed the problem, but it won’t be due to using a different program to do so.