Developing compatibility across multiple platforms.
If you randomly stumbled upon this, most likely you will like to discover how it all started: How I hacked Google Daydream controller (Part I).
In the last weeks I continued to develop my hack, on a mission to liberate the Google Daydream controller from its chains. My goal was now to extend its compatibility from iOS to other platforms.
Next, I set up a fresh Ubuntu 14.04 LTS (Long Time Support) machine, opened a shell and ran as sudo the installation script that I wrote for the occasion:
#!/bin/shbluetooth bluez libbluetooth-dev libudev-dev npm
apt-get update # To get the latest package lists
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
apt-get install -y nodejs
ln -s /usr/bin/nodejs /usr/bin/node # Symlink
The code above installs everything you need to get you started. However, keep in mind that to work with BLE devices you also need a Bluetooth LE 4.x USB Dongle (as below) in case your machine does not run it natively.
Then I started creating a new Node.js script and installing the noble library through npm (node package manager):
npm install noble --save
Once finished, I managed to edit the script adding the main reference to noble:
var noble = require('noble');
so I started to implement the required code to make Google Daydream controller talk with Node.js.
The diagram represented below make clear the whole flow I followed to achieve Daydream controller data reading via Bluetooth LE:
This is how it looks like when converted in executable code:
NOTE: don’t forget to run the Node.js script as sudo, on some systems the hardware interfaces aren’t accessible to not-sudoer users.
As soon as I started to receive the data, I filtered and exposed it on-the-fly through a local http server: imagine how powerful it can be to manipulate things with architecture.
As you may have noticed, the prospects of this interaction are countless. Thanks to the cross-platform nature of Node.js and its versatility, soon we will be able to run Google Daydream controller on any kind of device.
Did you miss the beginning? Check this out: How I hacked Google Daydream controller (Part I).
Or… Maybe you are interested in watching two Google Daydream controllers running at the same time: How I hacked Google Daydream controller (Part III).