boblightd and SteamOS

By mattie, Sat 01 November 2014, in category Gaming

ambilight, boblight, gaming, lightpack, linux, steamos

Having some spare time, I thought I would see if it is possible to setup boblightd with SteamOS.

It looks like it's possible, with X11 at least.

Firstly, I added the wheezy distro to apt sources.

It doesn't look like the libraries that are required, so I'm going to have to add some apt repos

Also, openssh-server, because I'm lazy and don't want to do it via the keyboard.

sudo apt-get install libx11-dev libgl1-mesa-dev libxrender-dev libxext-dev portaudio19-dev libavcodec-dev libavformat-dev libavdevice-dev

I ommited libswscale-dev, as it appears another version is installed. Let's hope that it'll compile ok!

It appears to be missing libusb too!

apt-get install libusb-1.0.0-dev

ffmpeg - because I think we want v4l support, for boblight

but we need to install libswscale2 in order for it to compile --with-ffmpeg

apt-get remove ffmpeg libav-tools libavfilter2 libavfilter4 libswscale2 xbmc xbmc-bin

let's install XBMC again, because it's a nice to have

apt-get install xbmc

It's compling okay, let's build!

oops, apt-get install libtool g++ (no g++ was found)

Looks like boblight doesn't come with support for lightpack, so use this one

let's try that again... that worked

./configure --with-ffmpeg

You will have to open boblight-v4l.cpp and videogabber.cpp and add the unistd header to the code, for some reason this will cause errors when you try to compile boblight

vim src/clients/boblight-v4l/boblight-v4l.cpp
(some where with the rest of the headers)
#include <unistd.h>
vim src/clients/boblight-v4l/videograbber.cpp
(some where with the rest of the headers)
#include <unistd.h>
./configure --with-ffmpeg
make clean && make
sudo make install

Hooray, we have a build. Now, we need to edit /etc/boblight.conf

First, let's find the USB device

desktop@steamos:/usr/src/boblight-read-only/arduino$ lsusb
Bus 001 Device 003: ID 1d50:6022 OpenMoko, Inc.

While we're playing with USB devices, we need to make the usb port readable by the steam user, so...

  idVendor           0x1d50 OpenMoko, Inc.
  idProduct          0x6022
sudo vim /etc/udev/rules.d/69-persistent-usb.rules
and add

Here is my version of boblight.conf that I pulled from my XBMC media centre

sudo vim /etc/boblight.conf
port 19333

name ambilight
channels 30
type lightpack
output /dev/usb/hiddev0
interval 20000
debug on
#bus 1
#address 6
#debug true

name red
rgb FF0000

name green
rgb 00FF00

name blue
rgb 0000FF

name 1
color red ambilight 28
color green ambilight 29
color blue ambilight 30
hscan 0 16.67
vscan 75 100

name 2
color red ambilight 19
color green ambilight 20
color blue ambilight 21
hscan 0 16.67
vscan 50 75

name 3
color red ambilight 16
color green ambilight 17
color blue ambilight 18
hscan 0 16.67
vscan 25 50

name 4
color red ambilight 22
color green ambilight 23
color blue ambilight 24
hscan 0 16.67
vscan 0 25

name 5
color red ambilight 25
color green ambilight 26
color blue ambilight 27
hscan 0 16.67
vscan 0 16.67

name 6
color red ambilight 1
color green ambilight 2
color blue ambilight 3
hscan 50 66.67
vscan 0 16.67

name 7
color red ambilight 10
color green ambilight 11
color blue ambilight 12
hscan 66.67 83.33
vscan 0 16.67

name 8
color red ambilight 7
color green ambilight 8
color blue ambilight 9
hscan 83.33 100
vscan 0 16.67

name 9
color red ambilight 13
color green ambilight 14
color blue ambilight 15
hscan 83.33 100
vscan 0 25

name 10
color red ambilight 4
color green ambilight 5
color blue ambilight 6
hscan 0 0
vscan 0 0

We now need the daemon and the client to launch when lightvm loads

sudo vim /etc/X11/Xsession.d/91boblight
export DISPLAY=:0
boblightd -f
sleep 2
boblight-X11 -x -i 0.03 -o value=5.0 -o saturation=2.0 -o speed=60.0 &

And we need to add it to Xsession.options

sudo vim /etc/X11/Xsession.options

Reboot, and you should have a working ambilight. I've found it to be completely slow and unuseable, but it was an experience.

These things FAILED

Now I tried doing this, but I could never get it to work. Appears SteamOS doesn't run through SysV? I don't know. I spent hours on this.

Create a startup script in /etc/init.d

vim /etc/init.d/
# Provides:          boblightd
# Required-Start:    $all
# Required-Stop:
# Should-Start:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts boblightd


case "$1" in
        boblightd -f > /dev/null 2>&1
        echo "Starting boblightd..."
        # No-op
        sudo -S killall boblightd
        echo "Stopping boblightd..."
        echo "Usage: [start|stop]" >&2
        exit 3

Needs to run BEFORE lightdm

desktop@steamos:~$ sudo update-rc.d defaults