PSVRFramework icon indicating copy to clipboard operation
PSVRFramework copied to clipboard

Data through HDMI-CEC

Open gusmanb opened this issue 8 years ago • 17 comments

It seems the PS4 is sending data through HDMI to the headset, maybe using HDMI 2.0 network channels or with CEC 2.0

We need more info about this as it seems to control the screen locking and audio output.

gusmanb avatar Nov 04 '16 15:11 gusmanb

it's not advertised as a feature (on my non-PS4-connected unit): https://github.com/gusmanb/PSVRFramework/wiki/EDIDs

it could just be a software bug in their code....

mungewell avatar Nov 04 '16 15:11 mungewell

Ok, it's not network, it's CEC 1.4. I've checked and the transceivers of the black box have it:

http://www.analog.com/en/products/audio-video/analoghdmidvi-interfaces/analog-hdmidvi-display-interfaces/adv7626.html#product-overview

There are USB to CEC converters, I will check and if they're cheap I will buy one and test.

gusmanb avatar Nov 04 '16 16:11 gusmanb

Hint... http://blog.endpoint.com/2012/11/using-cec-client-to-control-hdmi-devices.html

mungewell avatar Nov 04 '16 16:11 mungewell

Yeah, I've been looking at that adapter, it's 40$ so may be worth it.

I've confirmed the behavior:

1-Power on headset all connected to PC, lock works as my previous tests (small locks, large unlocks) 2-Connect HDMI to PS4, screen locks and audio shuts down. 3-Connect USB to PS4, screen unlocks. 4-Connect HDMI to PC, screen remains unlocked. 5-Connect USB to PC, screen remains unlocked.

It seems PS4 sends a lock (i think that will be an "off" to the or similar) through HDMI and when it reads through USB the sensor calibration status it releases the screen.

One question, the screen locking has worked (even erraticly) any time to you? If no then that setting may be persistent.

gusmanb avatar Nov 04 '16 17:11 gusmanb

BTW it looks like the Raspberry Pi will support HDMI-CEC http://kodi.wiki/view/CEC#Raspberry_Pi

mungewell avatar Nov 04 '16 19:11 mungewell

It does, and indeed it works. The PS VR is identified as "Tuner 1" winth name "PlayStation V", it answers commands and is only visible when the device is in cinematic mode, so I belive we're on the right track.

I will study a bit the CEC protocol and make a tool to check all the possible commands (I think with CEC also custom commands can be sent, so maybe I will try a brute force).

gusmanb avatar Nov 06 '16 19:11 gusmanb

Ok, first successful test, I got to comunicate through CEC with the PSVR. on and off commands with tvservice power on and off the HMD screen without powering off the HMD itself, so it seems there really is a comunication between PS4 and PS VR through HDMI, now it's "only" time and patience to check which commands are supported :)

gusmanb avatar Nov 09 '16 16:11 gusmanb

Are you just doing this on the RaspPi command line with 'cec-client'? Can you share some examples and I'll try to duplicate findings,

mungewell avatar Nov 09 '16 17:11 mungewell

Yes, I'm doing it with the RB3 but cec-client didn't worked for me, I think it does not identify a TV (it identifies a tuner) and sending to Tuner 1 (3) does nothing and when send something to TV (0) as it's not detected it refuses to send the command, I'm using the tvservice tool included in latest raspbian. tvservice -o powers off the screen, tvservice -p powers on the screen, as it doesn't checks nothing it sends the command and it works.

gusmanb avatar Nov 09 '16 18:11 gusmanb

Interesting. If On/Off affects the HMD and not Social Screen, does Vol+/- work on controlling that 'full volume' USB audio?

mungewell avatar Nov 09 '16 22:11 mungewell

Good idea, I will try it tomorrow, now I'm going to upload a new release and go to sleep.

gusmanb avatar Nov 09 '16 23:11 gusmanb

Another thought. When setting up testing please ensure that the cable PC->PSVR and PSVR->SocialScreen are CEC compatible, otherwise 'we' might miss something.

mungewell avatar Nov 10 '16 00:11 mungewell

Hint: http://www.cec-o-matic.com/

mungewell avatar Nov 10 '16 02:11 mungewell

Had a play with CEC-Client last night, a painful experience. Was able to scan, but not much else.

Found this alternative, though very limited in what it supports. Might patch to 'TX' raw bytes (similiar to how cec-client claims it should)... https://github.com/trainman419/python-cec

mungewell avatar Nov 11 '16 00:11 mungewell

Have you tried with tvservice? is the only thing I got to work.

As time passes I'm more convinced PS4 uses CEC (or something through HDMI) to comunicate with the black box and control some aspects (at least the screen locking). Something I noticed is when the PS4 gets too busy the screen randomly locks it's position, first I thought it was just a problem with the HMD sensors, but after using during hours the HMD with PC it never happened and with the PS4 the behavior is consistent, you start the console and virtual screen works as expected, then you play a game, a video or something and when go back to the XMB the screen sometimes "jumps" because locks it's position randomly. It's like if it had some type of "ping" feature, just a guess, the PS4 identifies itself through HDMI and when it's identified the screen is unlocked whenever the black box receives some command in a concrete interval, It's consistent with my previous test, when I connected the HMD to the PS4 and then back to the PC without rebooting the black box the screen kept locked.

Now something unrelated, my hands are shaking like crazy XD. This idea about the ping came when I was playing to the brookhaven experiment, holly molly, this is real as hell... I'm really amazed on the quality achieved with that game, I've played the kitchen demo and until dawn rush of blood and none of these really scare me, but man, this one is terrrifying XD. Also, something very remarkable are the controls, not sure if it's because I changed the camera position, I followed the advices from an user on youtube, put the camera higher, then you get 360º degree of control with the move, and god, this worked perfectly, the control was 1:1. Usually these shooter games show you a laser sight because Move control is not enough reliable and this makes very easy to aim even with bad stability, but in this game you must aim like with a real gun, you must align the back and front sights, and I achieved nearly 100% headshots at a decent distance, not sure if this is the setup or the console has some learning algorithm which makes it work more reliably as time passes.

gusmanb avatar Nov 12 '16 08:11 gusmanb

Hmmm, a thought just struck me. HDMI-CEC is a single wire shared bus. So it's likely that all the HDMI sockets will be wired together. If a RPi is connected at the same time as PSVR will it see the messages that PS4 sends?

cec-client has a monitor mode, and as wiring as:

PS4 -> PSVR -> | TV
RPi ---------> |

mungewell avatar Nov 12 '16 20:11 mungewell

It can be done if you have an HDMI switch which supports CEC pass-thru, not sure if your TV has two HDMI's it will forward the CDC data.

gusmanb avatar Nov 16 '16 13:11 gusmanb