I finally have an LG panel with an RS232 connection! So obviously I had to automate it - at least a little. I decided that I wouldn't start from scratch but modify my ampserver application to control the TV too (using two different dbus objects with different interfaces on the same bus). For the the time being, I've restructured ampserver to enable me to add the behaviour in a clean fashion, so all ampserver functionality works just as well as before. I've implemented it as a service (azurserver) in my new application - rs232server. The lgtvservice will follow sometime in the new year.
If people find other gadgets or other brands of gadgets it should be easier to add them using this new 'service' system. I havent quite worked out how services will be enabled/disabled but I guess it will have to be in a configuration file with the corresponding tty for each device.
I've edited the original post in so that the instructions to get your amplifier working with xbmc still function with the new git links etc...
As many people who have hacked on a CE4100 board can tell you, there's not much that works on them. Intel provides PRs, trimmed down linux images that lack common things such as Xorg or gstreamer, or (if you can get your hands on it) MeeGo. With MeeGo's grim future and any news of Tizen being scarce, there's an alternative - Ubuntu on CE4100!
Demo
In the following demo I show the boot of the CE4100 to ubuntu 11.04, then X11, firefox running, audio playback from mp3 over HDMI, then video playback in H264 (high profile) using UMMS + gstreamer ismd elements on UPP_A, and then some GDL transparency tricks to show firefox is still running and working nicely.
Note: theres a long pause in the middle as I open some ssh terminals to the box and export the display, firefox is actually fairly quick to launch and, as you can see, quite speedy in use. Also notice I boot the box with the HDMI monitor off, that's simply because hdmi handshaking on this benq monitor is terrible and no one has been kind enough to give me their TV!
Details
I started with a ubuntu 11.04 filesystem, and added a CE4100 kernel which boots using redboot. (grub2 could be used because the cocom boxes can use UEFI). I wrote an upstart job to start all the CE4100 goodness in order (platform_config,smd,gdl,hdmi,acore). In order to keep boot times low I used uxlaunch to start openbox in a very similar manner to meego-cetv images. GStreamer comes from the ubuntu repository. The GStreamer ismd elements however come from MeeGo. The PVR drivers (PowerVR SGX 535 a.k.a GMA500), are from meego and are the special pvr-tv drivers. Note that mesa/X11 is mostly from meego also.
Wait a second...
If you know the CE4100 OS mess a little you'll immediately be thinking - so what kernel are you running? - This is all done with the meego kernel for CE4100 based on PR21. X11 and the PVR driver is also from meego for PR21, as well as the SMD layer etc... This is basically Ubuntu + MeeGo + PR21. The advantage being that using ubuntu is a lot easier than using PRs and if you are used to using ubuntu/debian it's a lot easier to start developing or porting your application.
Where can I get it?
To start with you'll need a CE4100 'open' box. All this work was done on the Cocom Churchill 177 board, which is probably the most powerful board you can get right now (1.6ghz/2GB DDR3/hyperthreading), but theres no reason it shouldn't work on others (such as videon/tatung boxes). Next you'll need the PR21 CEFDK and the same redboot cmd as for MeeGo PR21 images.
For many unfortunate legal reasons, I can't simply share this image with you, but if you speak to the people at Cocom, they can provide the image.
NOTE: AmpServer was renamed to rs232server, it's the same but is made to be more extensible so it can control other rs232 gadgets! See here. I've edited this post so that you can still follow the instructions with the updated software.
Intro
I love automation. And I hate having to get up to turn my amplifier on when playing a video or some music on my HTPC - running XBMC of course.
So I went on ebay and found a Cambridge Audio 340R 5.1 receiver/amplifier. It was the cheapest amplifier from Cambridge Audio on ebay that provided a RS232 serial port. I knew communication between the amp and PC was possible because of previous work done on this little python script by another Kent university student. Most current high-end products from Cambridge Audio come with a serial port that includes the 340R, 540R v3, 640R, 650R, 840A, 840E. I'd welcome any contributions and would love to help you to support any of these other amps or amps with similar serial ports & commands.
Requirements
A Cambridge Audio amplifier with RS232 port
A serial null modem cable (available on ebay for very cheap)
A USB -> Serial adapter (cheap on ebay, not necessary if your PC has a serial port)
Running ampserver
In order to run the ampserver, you need to run the python daemon. You'll need to clone the git repository and adapt dbus permissions (dbus conf file is included), as well as the serial port configurations. On Arch Linux serial ports are of the group uucp (gpasswd -a brendan uucp), so I simply added myself to the group to be able to access ttyUSB0 (your serial port may vary, depending on whether you are using a USB adapter or not).
mkdir ~/git
cd ~/git
git clone git://github.com/arfoll/rs232server.git
cd ampserver
cp uk.co.madeo.rs232server.conf /etc/dbus-1/system.d/
python2 server/rs232server.py
To autostart ampserver, either place the .desktop file in /etc/xdg/autostart/ or add a startup using your windowmanager. Additionally modifying the bash xbmc startup script in /usr/bin/xbmc is easy.
Using the included dbus client
with ampserver I include the ampclient.py which is a simple implementation of an ampserver client using the dbus API. Execute with 'python2 ~/git/rs232server/client/ampclient.py --help' to see the list of commands.
Automating from XBMC
I wrote a small XBMC addon to automatically turn the amp on when music/video is played and to stop it after 120secs of inactivity. The volume will also be adjusted when playing a video and then playing music and vice versa. To run the addon you will need an XBMC 11.x 'eden' build as it is a services addon not available in 10.1 'dharma'. I recommend you install the addon in your home folder and symlink it from the git/ folder we made for ampserver.
Most interesting settings are controlable from the XBMC UI, go to system->addons->services->ampserver->configure.
cd ~/git
git clone git://github.com/arfoll/script.madeo.rs232server.git
ln -s ~/git/script.madeo.rs232server ~/.xbmc/addons/script.madeo.rs232server
Restart XBMC and as long as ampserver is running, your amp should poweron as soon as you play something. The XBMC addon should be able to recover from ampserver being restarted. An error message will popup once if ampserver cannot be contacted. Further errors will by default be discarded. (enable debug mode to see them all). When ampserver is restarted the addon should automatically start working again.
Going Further
Supporting a new model of amplifier is easy, for example if you have a 850E pre amplifier and poweron is different, copy the azur_cmds.py file to 850E_cmds.py. Change the "poweron" value in the dictionary with the serial command in the manual. Change the import azur_cmds line in ampserver.py to 850E_cmds, and map cmds = 850E_cmds. Done! If many amps are started maybe i will write a small config file and a startup cmd line option to do this automatically.
I think this is a first, XBMC on ARM hardfp As you can see in the video the UI is pretty smooth. We have sound working over stereo jack, we are using the DVI out, so no HDMI sound yet. CPU usage is actually fairly good. The builds are here.
Thanks to vgrade who worked hard to get a meego image running so well on trimslice. And thanks to irads from Compulab who kindly sent me a trimslice! And no thanks to UPS/Malta who charged me 13 euros in tax.
More updates will come on the MeeGo TV for Trimslice wiki page here and on the trimslice forums.
Problems:
- Video playback is broken, looks like ffmpeg build is borked
- pulseaudio is broken (on all SMP arm?) only reason i can even start this is if I zypper rm pulseaudio
OpenCPN is a GPLv2 navigation software for the marine. As part of my recent involvement in Marine MeeGo at Marsec-XL I decided to port it to take a look. I may also have gotten bullied into it by two short white-haired men...
Porting/Packaging of OpenCPN
OpenCPN uses the wx framework and is basically the only dependency not in MeeGo already. Obviously wx is abit of a monster and I rewrote the package from scratch because the opensuse/mandriva ones are heavily patched and modular, which is nice but makes packaging wx a complete nightmare. So I made a devel and non devel package for wx using yaml! I used the latest version from git of opencpn for no valid reason other than I wanted to see what the latest opencpn had to offer. If anyone's interested I can give you a hand to port the latest stable release, it's really not much work.
The first unanticipated problem I came across was MeeGo's antique gpsd that did not let me compile opencpn with libgps support. This took me a while to find out, but I eventually packaged the latest version of that for MeeGo and it's now in Trunk:Testing.
The second was that opencpn doesn't work with the newer gpsd versions... So I wrote a dirty patch to fix it wih the instructions from gpsd's site here. For a project which has the reputation of having terrible documentation I was really impressed.
I then went on to to port zyGrib which is a grib file viewer. It's actually written in Qt, unfortunately it needs QWT which wasn't ported but I grabbed a pkg from the opensuse OBS and quickly built one up. It's not the nicest of packages (it's not yaml'ified fully) and QWT 6.0 should probably be used - contributions are welcome!
Test setup
For my tests I used a phottix USB GPS unit (it's usually attached to my Nikon D200), but it's just a generic U-Blox 5 USB GPS on my Samsung NC10. It would have been nice to have a boat to test it on, but I still haven't found someone willing to lend me their yacht here in Malta... (offers welcome!)
I also used a WeTab running MeeGo 1.0 from WeTab with it's integrated GPS (only in the 32GB/3G version I believe and I don't think the 64GB exopc have it).
I'll have it on the N900 as soon as I find a build of MeeGo CE that boots and lets me ssh in! But it builds and you can try it out - send me a screenshot if you do!
Installing it
First work out what version of MeeGo you have so what build you need from here: http://repo.pub.meego.com/home:/arfoll:/opencpn/ . MeeGo Current is 1.3, MeeGo Trunk is 1.2, MeeGo 1.0 is what you want for the WeTab OS. If these repo names sound silly to you, complain to the community OBS guys
cd /etc/zypper/repos.d/
wget http://repo.pub.meego.com/home:/arfoll:/opencpn/YOUR_MEEGO_VERSION/home:arfoll:opencpn.repo
sudo zypper refresh
sudo zypper in gpsd gpsd-client opencpn
Then start gpsd, my GPS ends up in /dev/ttyACM0 but check where your one ends up! The -N keeps gpsd in the foreground which is nice for debugging.
gpsd -D 2 -n -N /dev/ttyACM0
On the wetab use:
/usr/bin/tiitoo-3g-functions.sh enable_gps
to start the GPS. The cgps cli tool is really handy to see if you have a GPS fix.
Running it
And here is OpenCPN running on MeeGo 1.2 with a GPS fix! Enjoy.
Many questions not many answers. Unless you go to the MeeGo conferences and manage to find the right person, this info is fairly hard to come by so I thought i'd make this blog post.
MeeGo TV 1.2
MeeGo TV is an effort to bring a new vertical to MeeGo. (see MeeGo Tablet, IVI, Handset, etc...). It currently only targets the Intel CE4100 and CE4200 SOC platform - Sodaville/Groveland (same as on Boxee Box/Google TV/Telecom Italia cubovision/Free Revolution). A MeeGo TV 1.2 release is expected in the open sometime soon (despite the 1.2 there has never been any other MeeGo TV releases). More on this here.
XBMC has been chosen as a test UI for MeeGo TV while waiting for the TV vertical to create a dedicated TV UI. System integrators are expected to build their own UI on top of the stack and are not expected to reuse this UI.
XBMC in MeeGo TV 1.2
UMMS player backend (GStreamer based). More on UMMS here.
Removal of settings that make no sense in confluence and XBMC
Extension of python API so plugins can unmap XBMC's window to save CPU
Removal of all ffmpeg codecs
Removal of GPLv3' licenses. See debate on MeeGo IVI list here.
How media playback works on this XBMC build
The new player backend uses Dbus to talk to madeo-uplayer a UMMS prototype player service. A URI is given to this service and when the play signal is sent the GStreamer pipeline is started (it really is that simple ).
On a CE4100 there are 4 full planes (there are 6 total), and we have X11 running in the 3rd plane. The gdlsink GStreamer element outputs the video on the first plane. Planes are all blended in hardware to provide the final output. In order to show the video in the UI we use the OpenGL ALPHA value to set the region of video transparent. Therefore the UI (3rd plane) and the video (1st plane) get blended in hardware at very little CPU cost. More on GDL here.
Why GStreamer?
Because the ISMD (Intel Streaming Media Driver) has well proven GStreamer plugins, and GStreamer is the preferred MeeGo media playback API (and also most other Linux distributions). More information on GStreamer ISMD plugins and Intel ISMD capabilities can be found here. The UMMS spec does not require you to use GStreamer so you can use anything you want.
XBMC on ARM
Alot of people would like to see MeeGo TV on different architectures. That's a question for the MeeGo TV list, but I can answer why XBMC is not currently compiling for ARM on OBS. Currently we use GDL transparency to provide video playback within the UI. That's simply not going to work on any architectures not running this kind of hardware. More on GDL here and here.
Still that doesn't excuse why the package is failing to build in OBS, and it will be fixed sooner rather than later. You can track progress here.
Upstream
We would really like the UMMS player backend to make it to XBMC upstream. However currently the madeo-uplayer API (the prototype UMMS player written in python) is far from stable and is probably going to be replaced for a C based GStreamer player soon.
The python API extension to unmap XBMC's X11 window would be a great addition to XBMC's API, opinions on that would also be great.
The current license/patent cleanup would also be a great thing to add to XBMC upstream. I understand most people would like to keep ffmpeg codecs, however a compile time option and a cleanup script to create clean source tarballs and be able to compile without dvdplayer/paplayer would be great. I'd really like some input on how this would best be done.
Show me the code!
Sure. It's in the meego OBS here. I prefer to think of it as a patchset for XBMC 10.1, however there is a git too. All this code is GPLv2 as is XBMC.
Madeo-uplayer is LGPLv2.1 and the code is here and on OBS here.
Wait, can I run this code?
Yes you can run the code on a MeeGo 1.2 device, however video playback as explained above will not work properly. Once MeeGo TV 1.2 is released you'll be able to run this code on any sodaville box (you'll probably have to update the CEFDK), you can get 'open' boxes from Cocom here or Videon here.
So I went to San Francisco thanks to the great people at the Linux Foundation. Place was great, organisation was top notch and content was good. (no I did not expect a device release nor do I care we still don't have a MeeGo phone...)
I gave a session on audio continuums which went quite well despite my demo failing (wifi fail). Even so my backup film seemed to have made my ideas clear enough so I was happy. Next time I'll skip the hassle of a live demo and just borrow a decent camera and tripod! Hopefully the videos will be up soon so I can add it here.
There were some very good sessions explaining things about multi-plane architectures (CE4xxx) + HTML5 where all very informative. Auke Kok was kind enough to spend the time to convince me on systemd and while I left with the best intentions to read up on it and try it out myself I still haven't had the time.
There was a great BOF on media centers in MeeGo focusing on the qtmediahub project which sounds very promising (when is it coming to OBS?). Discussion was very good and it was great to get different people's opinion and learn about grillo.
I was extremely happy to get given a Nokia N900 to hack on, now I will have no excuse for untested arm packages on OBS. I'm hoping to bring a port of XBMC to the N900 (and all other non touchscreen only devices) that will hopefully be available from the official apps repository.
I got to sit down with @MeegoExperts who was kind enough to film me demonstrating XBMC running on MeeGo netbook edition with a GStreamer backend. The article is here. More on this coming soon.
So thats about it really, the only real downside of this was that it took a long time to get back to Barcelona really.
I had my Joggler sitting around doing very little in Barcelona, so as XBMC dharma went stable I decided to play with the new web addons. I thought i'd share my current setup, which I've actually been using instead of my android XBMC remote lately.
Shown here is chromium and the AWX web interface on XBMC dharma 10.0 (available from the default repository) to control XBMC from an O2 joggler running Ubuntu 10.10 with the Intel EMGD drivers. Obviously this is nothing particularly new or difficult but it serves it's desired purpose quite well. I hope to develop a slightly improved version of the AWX addon for small screens (800x480 in this case), and with a close button so that you can easily go back to a desktop - the aim is to have local radio playback on the device and maybe some UPNP music from the XBMC server.
Joggler is running over wifi for the demo, latency is very reasonable. Volume is hard to control, and scrollbar when not playing anything is out of place.
Installing AWX interface on XBMC
Install the AWX web addon from the official XBMC repository on an XBMC 10.0 dharma installation, activate it and check you can access it from another browser
Install ubuntu 10.0 on the Joggler
Use and install the new 10.10 image from http://joggler.exotica.org.uk/ubuntu, just write the image with dd to a 4GB or more USB stick (extend the partition if needed), plug in the joggler and reboot. Login with (user:joggler, password:joggler).
If using wireless, connect to the network entering the password etc. If using only ethernet then ignore this and the seahorse step.
This next step is for people that dont worry too much about the local security of their networks. Personally I assume that if you are in my house, you have access to the ethernet plugs so there is little point in encryting my WPA2 passphrase.
seahorse
and in edit the passwords:login by right clicking (use ssh -X or a mouse/keyboard on the joggler), then proceed to using a blank password. It will complain but you can ignore it. If anyone knows how to do this from the CLI please leave a comment.
Openbox setup
Edit the /etc/xdg/openbox/rc.xml to add chromium. Add something like this inside the XML tags.
- Edit the /etc/xdg/openbox/autostart.sh, and put something similar to this (i prefer to wipe it first):
# This shell script is run before Openbox launches.
# D-bus
if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
eval `dbus-launch --sh-syntax --exit-with-session`
fi
# To make gtk apps pretty.
#if test -x /usr/libexec/gnome-settings-daemon >/dev/null; then
# /usr/libexec/gnome-settings-daemon &
#elif which gnome-settings-daemon >/dev/null; then
# gnome-settings-daemon &
# Make GTK apps look and behave how they were set up in the XFCE config tools
#elif which xfce-mcs-manager >/dev/null; then
# xfce-mcs-manager n &
#fi
# Run XDG autostart things. By default don't run anything desktop-specific
# See xdg-autostart --help more info
DESKTOP_ENV="OPENBOX"
if which /usr/lib/openbox/xdg-autostart >/dev/null; then
/usr/lib/openbox/xdg-autostart $DESKTOP_ENV
fi
# Not strictly neccessary
sleep 1
# taskbar. Needed if using wifi, otherwise can be nice to do taskswitching
tint2 &
# only if using wifi this is needed
nm-applet &
# only if you want desktop icons and other goodies
pcmanfm --desktop &
# uncomment following if you want to autolaunch the remote
#sh /home/joggler/launchRemote.sh
- Create a file as /home/joggler/launchRemote.sh with this (change the URL to suit your XBMC install)
# enter the correct URL for your XBMC web server
/usr/bin/chromium-browser --app=http://baldwin:8080 &
# this makes it work ok for me. Would be better fixed by a nice tint2rc or if not running tint2.
# I don't understand why there isn't a flag for chromium to enter this mode on launch
sleep 4
xte "key F11"
# can be removed (especially if you don't have a password secured XBMC webserver)
sleep 2
xte "key Return"
Note: This is very hackish, if anyone can show me how to do it in a better way than using keypresses i'd be glad. Also I use tint2 for a tray to show nm-applet. This is obviously not neccessary and a good tint2rc would probably be preferable to the xset F11, but I have not had time to read the tint2 manual fully yet.
Making an icon for the desktop
Save this file as /home/joggler/xbmc.png
Save this as xbmc_remote.desktop in ~/Desktop
Finishing off
Logout and back in selecting openbox as you click on your selected user
Run `pcmanfm --desktop-pref --show-pref=1` and enable single click.
Run XBMC remote from the dekstop and enjoy!
Enna - is a Media Center application. Featuring a simple user interface, Enna is based on the powerful Enlightenment Foundations Libraries (EFL) as for its graphical user interface and GeeXboX libraries as for multimedia playback and information retrieval.
I've been interesting in building Enna for a little while now, as it has a gstreamer backend and is made to run on embedded platforms on powerpc, arm and intel x86. It is made using the Enlightenment libraries. I'm using the 0.4.1 branch which is still under development - This is not a release nor is it meant to be. My builds are definately not something you should consider stable!. I've put a dirty patch on elementary in order for the headers to find the efreet libraries. Arm builds are available but I have no arm platform to test them on. They are built with the default options so do not have NEON extensions enabled. I've had to disable the photo module because there where compilation errors, hopefully those will be fixed soon
The repository is on the new public meego OBS, to install follow the instructions below:
You'll want to change at least the /home/brendan to /home/yourname in the config file. First launch is a little slow.
Here is a short demo using only gstreamer. libplayer still needs to be fixed in a few areas. As you can see in the video, skipping audio does not work, and stopping an ongoing video seems impossible. Using the vlc/xine/mplayer backends will probably provide better results but using gstreamer is particularly interesting because of it's tight integration with Meego and the ability to use existing plugins.
As you may (although unlikely) have noticed, I've updated the repository page here. Once the repo is installed do a 'zypper refresh' and 'zypper install xbmc' and you should be on the latest XBMC in no time!
Basically I've moved everything onto the new meego public OBS thanks to lbt and X-fade for some truly awesome work setting it up and all!
I know build all my various utilities for armv7 as well, and XBMC is in it's seperate repo. There is a testing repo, so hopefully the main repo will not break too often.
The upgrade to RC1, brings something sorely missed in dharma beta4 for us linux users... Sound! So yes it's definately worth the upgrade, make sure to delete the old repo (zypper rr is your friend!).
If like me, you are installing XBMC on your new Lenovo S10-3t from the Meego conference, check out this small page with instructions to make the touchscreen work!