Controlling the Sony PlayStation 4 for test automation
05 Jan 2017. By David Röthlisberger.
To test a PS4 app you need a mechanism to control the PS4 and a way to get feedback to check that your app is behaving as it should.
Stb-tester uses HDMI video-capture for feedback, and –traditionally– infrared to control set-top boxes. But the PS4 doesn’t have an infrared receiver. Since stb-tester v27 we can now control the PS4 using CEC commands over the HDMI connection.
We tried several control mechanisms, and CEC was the only one that worked consistently and reliably. The PS4 allows you to plug in a USB keyboard, so we considered using a Flirc Infrared-to-USB-keyboard dongle. However the USB keyboard input only works with some apps, and it doesn’t work at the PS4 login screen. Sony provides a mobile app with remote control capabilities, but it has similar limitations.
|Action||PS4 controller||HDMI CEC||USB keyboard||Android app|
|Power on the PS4||Yes.||Yes.||No.||No.|
|Navigate PS4 main UI||Yes.||Yes.||Yes.||Yes.|
The CEC control mechanism is very reliable: I ran a soak test for 3 days and there wasn’t a single missed keypress in 120,000 keypresses. The test script used CEC commands to navigate right & left through a menu, and after every keypress it checked that the selection had moved to the expected menu item.
You will need our USB CEC adapter. If we didn’t ship one with your Stb-tester device, contact firstname.lastname@example.org. Plug it in as per the diagram below – the Stb-tester node will automatically use the CEC adapter if there is no infrared transmitter connected.
To enable CEC on the PS4, go to Settings > System > Enable HDMI Device Link. On the PS3 it’s System Settings > Control for HDMI.