Your main phone is used as a mobile HMD for VR,
your secondary device wirelessly sends motion tracking data to your main phone.
This data in turn is used to control a pointer device in your virtual environment. I also made a script the allows you to tap your controllers display as an input button.(It also supports gestures)