Difference between revisions of "BeagleBoard/James"

From eLinux.org
Jump to: navigation, search
Line 3: Line 3:
  
 
'''NOTE''' This project has been terminated.<br>
 
'''NOTE''' This project has been terminated.<br>
I have found a similar project that is much further than mine. The project is called Amahi. It is a home server and can be found at [http://www.amahi.org].<br>
+
I have found a similar project that is much further than mine. The project is called Amahi. It is a home server and can be found at [http://www.amahi.org www.amahi.org].<br>
 
Currently Amahi runs only on x86 and Marvell kirkwood (Sheevaplug and friends), but I guess running it on other hardware like beagleboard is not too difficult.
 
Currently Amahi runs only on x86 and Marvell kirkwood (Sheevaplug and friends), but I guess running it on other hardware like beagleboard is not too difficult.
 
<br>
 
<br>

Revision as of 00:46, 14 February 2011


NOTE This project has been terminated.
I have found a similar project that is much further than mine. The project is called Amahi. It is a home server and can be found at www.amahi.org.
Currently Amahi runs only on x86 and Marvell kirkwood (Sheevaplug and friends), but I guess running it on other hardware like beagleboard is not too difficult.
The distro used by Amahi is Fedora.

Introduction

James (acronym for Just A Miniature Entertainment System) is an application providing a home entertainment solution. It is also called James as it aims to be a global "butler" application providing various services. What functionality is actually offered by James also depends on the actual hardware present in the system.

Rationale for calling it Miniature, is because the system will be small in physical size (but not in functionality). Aim is also to reuse as much open source software as possible.

And actually entertainment system is a little bit of a misnomer. James will provide all kind of home services, so it could also e.g. provide NAS functionality or even a web server.

Latest News

A very nice person borrowed me a board! I don't know if you want to have your name exposed, but thank you very much; you know who you are :-)

With this board I already managed to bring up several packages (and updated these to the latest version).
The original plan was to build my own PVR (like I did with NSLU2); but the current plan is to investigate first if I can use mythTV.
For wiimote support libwiimote and CWiid have been ported. Unfortunately the wintv prv usb2 drivers seem to have some issues with usb on angstrom. No idea yet what is wrong there.

ALso a lot of effort was spent on getting Coherence up and running. Coherence is a UPnP server that supports several backends which can e.g. serve FlickR content over UPnP.

Furthermore an attempt was made to connect the webcam. Technically it works, but apparenty there are some USB related issues. The cam works fine under a regular linux system but on the Beagle over the OTG port apparently data is corrupted. I get a picture but with some colored striping in it. The same behaviour has also been reported by others, but a report from someone who has a revC board with working EHCI said that there webcams were functioning properly.

Stay tuned for progress reports.

James Hardware

Core of the James development will be a BeagleBoard, although the code should be platform independent. BeagleBoard was chosen because it is very small (although functionality wise it can be big).

Additional hardware used during the development and for prototyping

  • Philips PCVC680K webcam
  • Toshiba MK4007GAL 1.8" hard disk with USB enclosure.
  • Sitecom IT-001 USB phone
  • Pertelian X2040 Character based LCD display (4 lines, 20 columns)
  • Perhaps touch screen/pixel based display
  • GATEWAY OVU400002/00 Infrared receiver
  • bluetooth dongle (I use a very small one, but most bluetooth dongels will work)
  • Support for WII-mote (requires bluetooth)
  • WiFi. I have successfully used a 3com 3crusb10075 USB dongle (zd1211 based), a Linksys WUSB54G and a Philips CPWUA054/00 USB dongle (both Prism54 based)
  • Hauppauge WinTV PVR2 USB analog TV receiver.
  • A DVB-T receiver. (or maybe a DVB-S receiver) (to be obtained)
  • PHILIPS SPD3400CC USB CD/DVD drive.
  • various USB hubs
  • USB hard disk (Toshiba 40GB, 1.8")

Ideally of course would be to have an expansion board with features like Bbluetooth, WiFi, IR, USB hub), but as such a board does not exist yet initially the system will use standard USB components (although may be with the cover removed and mounted together). Aim is to select small components. As I am not a skilled hardware developer, creating an expansion board is outside my capabilities.

James Software

As written above James will be open source and will use open source as much as possible. Actually the programming effort will be mainly porting open source applications (with the associated debugging and problem fixing) and writing the UI software. For UI the idea is to use something web based. That would allow controlling the device locally, but also remote.

Software functionality on James is the following:

  • Personal Video Recorder (PVR): see http://www.dse.nl/~meulenbr/pvr/pvr.html for some documentation and access to a prototype running on ARM
  • Security functionality (motion pacakge)
  • Photo retrieval from digital camera (both mass storage and ptp; mtp ?)
  • Audio grabbing from CD
  • writing of CD/DVD (e.g. cdrecord)
  • File server/NAS (samba/swat)
  • uPnP server
  • PBX functionality (asterisk)
  • Media rendering (mplayer?), also from USB/CD/DVD if present (NSLU2 prototype only has mp3 playback as there is no video out.
  • Bluetooth headphone (bluez a2dp profile)
  • Internet telephony preferably with camera support (SIP based; probably EKIGA
  • Maybe: uPnP playback
  • Maybe: interface with GSM phone (e.g. using the gsm as a remote control using bluetooth)

Supporting software:

  • For wii-mote (CWiid (includes libwiimote)) Already demonstrated on eeePC under debian by me. See this page on wiki.eeeusoer.com on what I did there.
  • Lirc (for remote control) (did that already on NSLU2)
  • Web server for serving the UI (The current demo uses out-of-the-box apache2 with php)
  • Web browser for displaying the UI locally (not on NSLU2 as it has no display).

UI of the NLSU2 implementaion was done with html, javascript, css stylesheets, php and some self-written cgi scripts. It might be that for the next version I'll move to flash. I am planning to make a small prototype, but due to other things I did not get to this yet.

James Filesystem

James has no specific requirements on the filesystem. For development and testing I used a standard generated Angstrom image (see next section) with a 1GB ext3 filesystem.

James deals with multimedia content. Of course on a 1GB partition you cannot store that much multimedia data. Therefore I use a directory /media/content in this description to refer to the location of the multimedia content. By doing so you can easily mount another partition or e.g. an external USB hard disk or flash disk on this directory. But of course if you want to you can also keep /media on your SD card. And of course it is also possible to use a different directory to store the multimedia content as you see fit. Just use the directory where you stored the data instead of /media/content.

How to install

As James is still in the process of being developed, there is no automated install or precooked image or something like that. Meanwhile as a starter I have listed all steps I had to undertake with my hardware. If you are following the steps below and find things that are unclear or work out different for you (e.g because you have different hardware, please update these instructions.

Generally there is no strict need to execute all steps in the order I gave. Most of the things are pretty independent of each other. I just listed the steps in the order I executed them. If there are dependencies that I am aware of, I tried to list them.

Required Hardware

In order to get started you at least need the following hardware:

  • beagle board. rev B is assumed, with a 5V power brick
  • empty SD card, 1GB or larger
  • serial connection to your beagle
  • USB OTG cable
  • A USB hub. The beagle is not powerful enough to power most USB devices.
  • USB network interface to your beagle (wired is recommended, but if you know what you are doing you can

also use a wireless adapter. Setting up a wireless dongle is outside the scope of this document. The USB network interface is connected to the hub

  • a working internet connection.

Getting Started

The simplest way to get started is by using a pre-generated image. For that download the files http://amethyst.openembedded.net/~koen/beaglecontest/james-image-beagleboard-sd.img.gz and http://amethyst.openembedded.net/~koen/beaglecontest/james-image-beagleboard.tar.bz2 and skip the next paragraph on making your own image.

If the links above are not available any more or if you want to be in full control, generate yor own image using Koen's image builder at http://amethyst.openembedded.net/~koen/narcissus/. To do so perform the following steps (not neededif you use the pre-generated image) In the machine section select beagleboard. From the options select: Base system: extended, X11 window managers: Enlightenment. Development packages: Busybox replacements, Additional packages: All kernel modules, alsa utils, apache, ntpdate. If you want more packages to be installed you can select those too. (e.g. if you have a WiFi dongle you might want to select wireleess-tools). mplayer might also be handy but can always be installed later on through the command opkg install mplayer
Give the image a name (let's take james in this example, but you must pick your own name, choose whatever you want or whatever is generated for you). hit "build me" and wait (could be a few minutes) for the image to be generated. If you miss a package that is also not that dramatic, as it is always possible to install things later on. After that

  • download the james image for beagleboard (this will give you a file James-image-beagleboard.tar.bz2)
  • downlaod the raw SD card image.(this will give you a file James-image-beagleboard-sd.img.gz).


With your image either generated or the pregenerated one, perform the following steps:

  • insert an empty SD card (at least 1GB) into a card reader in your linux desktop system
  • do a dmesg | tail to find out the name of the device. In the subsequent lines I will assume it is

/dev/sdf, but it will probably be different for you. Use the name from dmesg |tail and NOT /dev/sdf when entering the commands.

  • gunzip james-image-beagleboard-sd.img.gz
  • sudo dd if=james-image-beagleboard-sd.img of=/dev/sdf bs=1M
  • grab a coffee as the command above will take some time. How much depends on the speed of your card. For me it took 3 minutes.
  • sudo mount /dev/sdf2 /mnt
  • cd /mnt
  • sudo tar xvfj .../james-image-beagleboard.tar.bz2
  • here ... is the path to your James-image-beagleboard.tar.bz2 file. Grab a second cup of coffee as this

again takes some time. Only difference is that at least this time you'll see progress. When done continue with:

  • cd /
  • sudo umount /dev/sdf2 (this again takes some time)
  • sync (just to be safe)
  • and to be safer: verify that the light of your SD card writer is not indicating any more that it is

writing and perhaps wait one more minute. If booting the image fails often the case is that not all data is present on the SD card

  • insert the card in your beagle and power the beagle.
  • if you want to you can interrupt u-boot by pressing space and set the videomode (e.g by issueing the commands 'setenv optargs omapfb.video_mode=1280x720MR-24@60' and "saveenv' (without the quotes)
  • have you had enough coffee? if not, grab another cup. All kind of things will be installed. This takes

quite some time. Especially the loading of the kernel modules takes lots of time.You can follow the progress on your serial port. Note that this only occurs one (on first use). Later boots will be at normal speed (less than a minute).

BTW: when booting error messages like "uncorrectable error : <3>end_request: I/O error, dev mtdblock0, sector 0" can be ignored.

Configuring the image

I have a pegasus based USB to ethernet dongle. In the kernel the driver for a pegasus dongle is a module. And for some reason the dongle does not get an IP address while booting. Unplugging and replugging the dongle works, but is not very convenient. If you also have a pegasus based USB to ethernet dongle you can avoid this by issueing the following commands on a console on your beagle:

  • echo pegasus >/etc/modutils/pegasus
  • /usr/sbin/update-modules

After that the module will be loaded before the IP addresses are assigned and the dongle will get an IP address during bootup. You might want to reboot if your dongle requires that you issue the previous two lines.

Next you want to create a /media directory and optionally populate it with some multimedia content. Creating the directory is dony by:

  • mkdir /media/content

And update your package list by issueing the command:

  • opkg update

Optionally: give your Beagleboard a fixed IP address

For James the beagle will also act as a server. For that it is very convenient if the beagle has a fixed address (or you have to use something like dyndns or configure a DHCP reservation in your router).

In order to give the Beagle a fixed IP address you should edit the file /etc/network/interfaces and replace the line:

iface eth0 inet dhcp

with something like:

iface eth0 inet static
       address 192.168.1.230
       netmask 255.255.255.0
       network 192.168.1.0
       gateway 192.168.1.1

Also in order to have DNS working create/edit the file /etc/resolv.conf. You should add lines like:

nameserver 192.168.1.1

You can have several lines specifying name servers in the file. Of course you should use the addresses of whatever DNS server your use.

Optionally: install Synergy

If you are like me and do not want to clutter your desk with multiple keyboards it is a good idea to install Synergy. Synergy is a software application that can be used to share the keyboard and mouse between multiple computers.

Let us assume that your keyboard is connected to your linux system and that you want to use that keyboard also with your beagle. The linux system then acts as the server system, and the beagle system is the client system. Both systems require that X11 is running and must be connected to the ethernet. Let us assume that both systems have their own display and that the linux display is at the left side and the beagle display is located to the right.

In order to share the keyboard you need to install synergy on both systems. For beagle synergy is in the feeds and can be installed with 'opkg install synergy'. For your unix system your milage may vary. It may be that your distribution supports synergy. If not you need to download it from http://synergy2.sourceforge.net/ and install it yourself. There is one potential caveat. Synergy does not out of the box compile with gcc 4.3. If your system has gcc 4.3 you can patch the synergy sources with this patch.

To get things running you need to create a file synergy.conf. Assuming the host names of your systems are linux and beagle, the file looks like:

   section: screens
      linux:
      beagle:
   end
   section: links
      linux:
          right = beagle
      beagle:
          left = linux
   end

Of course if the names of your systems are different or if the location of your monitors is different, you need to change the file.

Store this file under the name 'synergy.conf' on the server system. Then on the server system run:

synergys -f --config synergy.conf

and on the client system run:

synergyc -f server-host-name

If the server host name is not available you can also use the server IP address.
If on the beagle you get an error that it cannot open the display try as command:

DISPLAY=:0.0 synergyc -f server-host-name

After doing so, if you move the cursor to the right of the linux screen it will automagically appear at the left side of your beagle screen, and of course if you them move to the left again your cursor will go to the linux screen. Keys will also be redirected to the screen in which the cursor is.

(for the technically interested: what happens is that the server detects that the mouse is on the edge of the screen and if that happens it will pass the mouse events and key presses to the client at that side over TCP/IP).

If you want to autostart xynergyc when starting your system you can create a file /etc/X11/Xinit.d/99Synergy with contents:

#!/bin/sh
/usr/bin/synergyc server-hostname

After that do a 'chmod 755/etc/X11/Xinit.d/99Synergy' to make the file executable.

Performing an automated install

It is possible to install all James packages automatically. If that is what you want you should perform the steps mentioned in this section and skip the subsequent installation sections (although you might want to read them to learn how to configure and control the software that is installed). If you prefer to stay in control though, you want to skip this section and cherry-pick whatever parts you prefer from the subsequent sections.

Beware that the automated installer is still a work in progress. At this moment you still need to do some things manually. Also the installer script does not configure most programs for automatically starting. I haven't decided yet if this should be added in the installer or by the package itself. Some packages like mpd do automatically startup on boot though.

For the automatic install issue the following steps:

  • create and boot a kernel as explained above. Use a storage device of at least 1GB and make sure your beagle is onnected to internet
  • login into your beagle
  • wget http://www.dse.nl/~meulenbr/james/james-install
  • optionally review the file james-install to see if you agree with the contents and to verify that it does not do anything you do not want
  • sh james-install

Now the installation starts. You'll see the various packages being downloaded and installed. This will take a substantial time. The actual time depends on your download speed an on how busy the package server is. As you've probably had enough coffee by now, you might want to grab something else :-) Of course you can also spent the time waiting on reading the remainder of this page.

If the automated install fails for some reason you have to interrupt it or it stalls for a long time, it should be safe to stop the install and restart it.

After doing the automated install you can:

  • connect your ptp digital camera; the beagle will then automatically transfer the pictures on it (no erasing of pictures)
  • manually control your camera and even remotely take pictures using gphoto2
  • After editing /etc/mpd.conf: play music that is on the beagle using mpd, running gmpc on the beagle or another pc on your network
  • manually rip CDs using cdstatus. See the section on cdstatus for more info.
  • set up automated ripping of CDs. See the section on automated ripping using ivman
  • manually encode wav files to mp3's using lame (see lame section on details)
  • downloading files using rtorrent
  • share media content on your beagle to any DLNA/UPnP client device (e.g. a Nokia N810 mobile phone, or a hardware digital media adapter or UPnP audio client using mediatomb
  • share media content on your beagle or external flickr photos, youtube video's, lolcats, internet radio etc etc using the Coherence UPnP server
  • use a wiimote to control your X11 cursor (requires wii, sensor bar and bluetooth dongle, see wiimote /cwiid section on configuration
  • use a remote control in your own apps or bind them to specific actions. See section on lirc.
  • use w3cat to capture pictures from your webcam
  • use motion to set up motion detection. Note that this did not work too well on my OTG port. I suspect a MUSB driver issue.
  • play with the PVR demo. You can do so by browsing to your beagle. A description of the design of the PVR and instructions to operate the demo can be found at: http://www.dse.nl/~meulenbr/pvr/pvr.html

Note: if you have connected a monitor to your beagle it is also possible to show the PVR demo locally. Select a good display resolution (e.g. 1280x720MR-24@60) in u-boot and after booting start the midori web browser from enlightenment using

Or if you want to start from your serial port or an ssh session you can start midori with:

Additional things that you can play with because they are installed, but that are not covered into this document are:

  • asterisk
  • ekiga

NOTE: the preinstalled image is only updated at irregular intervals, so recent changes might not be in the preinstalled image yet.

Sharing your data: NFS

Of course it is nice to access the multimedia content of your beagle on another PC. There are two ways to do so. The first one is through NFS and is handled in this section. The second one is through Samba (SMB) and is covered in the next section.

In order to get NFS running on your BeagleBoard you need a recent kernel (2.6.28 and 2.6.29 kernels from after march 4, 2009 probably qualify). Apart from that you need to install the following packages:

  • opkg install kernel-module-exportfs kernel-module-nfs-acl kernel-module-nfsd nfs-utils

You might need to insert the modules exportfs.ko, nfs_acl.ko, nfsd.ko. These live in /lib/modules. For 2.6.28 the commands to do so would be:

  • insmod /lib/modules/2.6.29-omap1/kernel/fs/exportfs/exportfs.ko
  • insmod /lib/modules/2.6.29-omap1/kernel/fs/nfs_common/nfs_acl.ko
  • insmod /lib/modules/2.6.29-omap1/kernel/fs/nfsd/nfsd.ko
  • depmod -a

Then reboot

Apart from that you need to make a file /etc/exports which contains the filesystem(s) to be exported. A very simple example would be:

  • /home 192.168.1.0/255.255.255.0(rw)

This will export /home to all systems on the network 192.168.1.0.

See a good nfs document for a description on options on how to further configure nfs exports. (or man exportfs on a linux box).

If you modify /etc/exports, you do not need to reboot to adapt to that settings. Just issue the command:

  • exportfs -a

and your /etc/exports file will be reparsed and nfsd will update accordingly.

Accessing an external NFS share on your BeagleBoard

If you want to access an external NFS share (e.g. on your linux PC) you need to install nfs-utils-client using the command

  • opkg install nfs-utils-client

After that you can mount a share exported by an external nfs server. E.g. if your server is 192.168.1.5 and the share is /home and you want to mount on /mnt on the beagle issue the command:

  • mount -t nfs 1921.68.1.5:/home /mnt

Of course you can also use the name of the server instead of the IP address.

For automatically mounting the share above when your system boots you can add a line similar to the following one in /etc/fstab:

  • 192.168.1.5:/home /mnt nfs rsize=8192,wsize=8192,timeo=14,intr

Sharing your data: Samba

In order to install samba you need to

  • opkg install samba

The samba configuration is in /etc/samba/smb.conf. You probably want to review this file and modify it as you see fit. Use a good samba tutorial to help you with this (e.g. http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/ )

E.g. if you want to give readonly access to /media/content with a sharename of media you need to add:

[media]
  path = /media/content
  guest ok = yes
  writable = no

A more user-friendly way to manage your samba configuration is through SWAT (the Samba Web Administration Tool). In order to have swat installed you need to do the following:

  • opkg install xinetd
  • opkg install swat
  • create a file /etc/xinetd.d/swat with the following content:
# default: off
# description: SWAT is the Samba Web Admin Tool. Use swat \
#              to configure your Samba server. To use SWAT, \
#              connect to port 901 with your favorite web browser.
service swat
{
       port    = 901
       socket_type     = stream
       wait    = no
       only_from = localhost
       user    = root
       server  = /usr/sbin/swat
       log_on_failure  += USERID
       disable = no
}

If you want remote access you need to modify or comment out the only_from line.

After installing swat you can manage your samba configuration through port 901. (http://localhost:901 on your slug; http://<beagle ip address>:901 if you want remote access. Note that you need to log in into swat and that you cannot log in with an empty password.

See http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/SWAT.html for info on swat.

Note that if you change the samba settings you need to restart the server for the settings to take effect.

Apart from installing samba, you might want to register the users that are allowed to use samba. This is done by

  • smbpasswd -a user

where user is the user you want to add. It prompts for the password for that user. Note that this password can be different from the linux password.

Accessing your samba share from windows

To be written

Accessing your samba share from linux

In order to access your samba share under linux your PC running linux need to have smbclient installed. How this is done depends on your distribution and is outside the scope of this page.

After installing smbclient you can access your share with

  • smbclient -U root //192.168.1.230/media

This assumes that you want to access the data as user root. Also it assumes that your beagle is at 192.168.1.230.

Another, more convenient way is by using your web browser. Just browse to smb://192.168.1.230 (or whatever the IP address of your beagle is)

Mounting of a share can be done through:

  • mount -t cifs //server-ip/sharename /mnt -o username=user,password=pass

user here is the name of a user that you added before with smbpasswd (and pass is the associated password). /mnt is the directory where you want to mount to.

If you want to mount the samba share upon startup add the following to your /etc/fstab (on your client system, not on the beagle):

  • //server-ip/sharename /mnt smbfs username=user,password=pass 0 0

again substituting the right credentials, addresses and paths.

Note: the first two methods (browsing and smbclient) can also be done if you allow anonymous access. I could not get mount to work with anonymous access.

Btw: if you want to access an external samba share *from* your beagle board (e.g. on your windows PC) of course you can use the same commands.

Accessing a samba share on your BeagleBoard

Technically accessing a samba share on your BeatleBoard is similar as explained in the previous section. However you need to install two packages.

For getting smbclient you need:

  • opkg install samba

And for mount.cifs you need:

  • opkg install cifs

After that proceed as explained in the previous section.

Accessing data on your BeagleBoard using sshfs

Yet another way to access data on your beagleboard is through sshfs. This is a filesystem that uses ssh. The nice thing is that ssh is already present on your beagle and no changes on the beagle are needed, and that you can even access the filesystem securely from an external location. Disadvantage is that sshfs is somewhat limited w.r.t. security. If you have ssh access, sshfs will give you access to all files you have access to, whereas with nfs and samba you can decide which directories you want to export.

sshfs does require some software to be installed on your host system (the system from which you want to access the beagle fs) though.

On OpenSuse:

  • sudo zypper install sshfs

On Ubuntu and Debian:

  • sudo apt-get install sshfs

On Fedora Core and Red Hat:

After installing sshfs you can mount your beagle filesystem through e.g.:

  • sshfs root@192.168.1.230:/ /mnt

Where 192.168.1.230 is your beagle. Of course you can also use other paths and users!

Adding WiFi support

The modules for the WiFi dongles that are supported by Linux are already present in the system. However, most likely the firwmware is still missing. This firmware need to be placed in /lib/firmware before you can use your WiFi dongle.

For ZD1211 based dongles the firmware can be found at http://sourceforge.net/project/showfiles.php?group_id=129083 This firmware supports the following wifi dongles: http://www.linuxwireless.org/en/users/Drivers/zd1211rw/devices.

For prism54 based dongles the firmware can be found at http://wireless.kernel.org/en/users/Drivers/p54#firmware. This firmware supports the following devices: http://wireless.kernel.org/en/users/Devices/USB

Configuring your wifi is outside the scope of this document.

Adding WiiMote support

Using a WiiMote as a mouse replacement is easy. You need a bluetooth dongle, a wiimote and a sensor bar (you can use the one from your wii, but I just used a noname wireless sensor bar bought on Ebay. (Actually such a sensor bar is nothing more than a piece of plastic with a few IR leds, a switch, a battery compartment and maybe a few resistors.)

Just perform the following actions:

  • opkg install cwiid
  • insert the bluetooth dongle
  • hciconfig hci0 up
  • wminput -c ir_ptr

now follow the instructions to connect your wiimote to the dongle and use your wiimote as a mouse pointer. (do not forget to point in the direction of the sensor bar).

For more information on how to configure wminput see http://abstrakraft.org/cwiid/wiki/wminput

(btw: wminput assumes that the uinput driver is loaded, but if you use the standard kernel this is the case. If uinput is not there you need to load it using insmod uinput (probably after building it)).

Adding support for a remote control

  • opkg install lirc

To be updated

Using a webcam

I have connected a Philips PCVC680K (Vesta Pro) USB webcam to my beagle. If the module pwc is present it will be loaded when you plug in the cam. The moudule will be there if you have chosen "all kernel modules" in the image builder. If not you can still get it by issueing the command 'opkg install kernel-module-pwc'

After doing so I was able to play the video on a monitor connected to the beagle by issuing the command
DISPLAY=:0.0 mplayer -tv width=320:height=240:driver=v4l2 -fps 15 tv://
on the serial console (if you are running from a terminal you can omit the DISPLAY=0:0 part.
Note that I connected the webcam on the OTG port. This resulted in a picture with some colored striping. Apparently some data gets corrupted somewhere. As the same setup works flawless on various systems (x68, nslu2) with a regular usb host interface, I guess there is a bug in the OTG driver or a glitch in the hardware.

Other webcams can be used in a similar fashion, but you probably need to adjust the width, height and fps commands for mplayer.

vidcat

It is also possible to capture individual pictures from your webcam. You can use the program vidcat to do so. This program is part of the package w3cam and can be installed with 'opkg install w3cam'.

vidcat is a little bit picky on its arguments. For my PCVC680K the command 'vidcat -p y -s 640x480 > test.jpg' did the job for me. If you get a message like:

VIDIOCMCAPTURE: Invalid argument
args: width=320 height=240 palette=4
Error: Can't get image

your parameters are probably incorrect.
Btw you can use vidcat --help to get a list of possible options to vidcat.

motion

Another application that is proven to work is motion (install with 'opkg install motion'. This does support motion detection by taking a picture at regular intervals and comparing that picture with the previous one. If the differences between the pictures exceed a user-defined treshold the pictures are stored. That way the cam can be used to detect intruders.
Unfortunately due to the random color stripes, this is not useful yet on Beagle revB hardware.
More information on motion and how to configure it can be found at: http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome

Audio playback: mpd

Mpd is a daemon process that can play audio. It is a daemon only and it can be controlled remotely by a mpd client (e.g. gmpc). This client can run locally on the beagle but also remotely on another system. Actually you can even set things up in such a way that your audio player can be controlled over the internet.

Installation of mpd can be done with:

  • opkg install mpd

Note: the latest version of MPD is not on the feed yet. For now you may download http://www.dse.nl/~meulenbr/james/mpd_0.14.2-r3.1_armv7a.ipk and install it manually (opkg install mpd_0.14.2-r3.1_armv7a.ipk)

Installation of the gmpc client can be done with

  • opkg install gmpc

Before starting the client be sure to review and edit the file /etc/mpd.conf Especially you want to modify the line starting with music_directory as this points to the location where your audio files are. Also if your beagle has a public IP address you might want to restrict access by modifying the bind_to_address line, which specifies what systems have access and/or install a password.

More info on mpd can be found at: http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki

Grabbing photos from a PTP enabled camera

If you have a PTP enabled digital photocamera, it is possible to automate the extraction of photos from that camera. In order to do so perform the following steps:

  • opkg install gphoto2

Create a script photoripper. My script looks like:

#!/bin/sh

test "x$ACTION" != "xadd" && exit 0
test "x$SUBSYSTEM" != "xusb_device" && exit 0

if test -e "$DEVNAME"
then
  # SUBSYSTEM == "usb_device" implies that DEVNAME == "/dev/bus/usb/123/456"
  # Determine device ID and bus ID.
  dev="$(basename "$DEVNAME")"
  bus="$(basename "$(dirname "$DEVNAME")")"

  cd /home/root  # change this line if you want to download to a different directory.
  /usr/bin/gphoto2 --port usb:${bus},${dev} --get-all-files
else
  echo "photoripper: Given device named $DEVNAME not found." >>/tmp/photoripper.log
  exit 1
fi

Place this script in a directory of your choice. I've used /usr/local/bin (which need to be created first), but you can put it in another location. Just adapt the path in the next two commands.

  • chmod 755 /usr/local/bin/photoripper
  • /usr/lib/libgphoto2/print-camera-list udev-rules version 0.98 script /usr/local/bin/photoripper > /etc/udev/rules.d/90-libgphoto2.rules

This will start the photoripper script whenever you connect the camera to your system.

Of course the script above is just my version. If desired you can use other gphoto2 options. E.g. you can add the option --new to the gphoto2 command so only new files are downloaded. And if you are brave you can even automatically remove the pictures from your camera after downloading them by adding a gphoto2 command with the option --delete-all-files. Note that you do this completely at your own responsibility. Don't blame me if for wahtever reason you loose pictures!

Ripping an audio CD

If you have an USB CD or DVD drive you can use it to rip audio CD's. James does that by using cdstatus. Advantage of cdstatus is that it can interface with CDDB.

You can install cdstatus through:

  • opkg install cdstatus

Ripping a CD can be done through the command:

  • cdstatus --cddb --drive /dev/sr0 --rip

Note that this command rips to wav files. cdstatus has some more options (e.g. specifying the destination directory). Issue 'cdstatus --help' to learn about them.

The speed to rip a CD depends mostly on the audio extraction speed of your drive.

Automatically ripping a CD using ivman

It might be that you desire to automatically rip a CD when you insert it in the drive. This can be done by using the program ivman. In order to do so you should first install ivman:

  • opkg install ivman

Note: at the time of writing ivman is not yet in the feeds. If the command above fails please manually install and download the following files in the order given:
http://www.dse.nl/~meulenbr/james/pmount_0.9.18-r0.1_armv7a.ipk
http://www.dse.nl/~meulenbr/james/pmount-hal_0.9.18-r0.1_armv7a.ipk
http://www.dse.nl/~meulenbr/james/ivman_0.6.14-r1.1_armv7a.ipk

After that edit the file /etc/ivman/IvmConfigActions.xml. Add the following text near the end (just above the tag </ivm:ActionsConfig>

   <ivm:Match name="hal.volume.disc.type" value="cd_rom">
       <ivm:Match name="hal.volume.disc.has_audio" value="true">
           <ivm:Match name="hal.volume.disc.has_data" value="false">
       <ivm:Option name="exec" value="cd /media/content >&gt /usr/bin/cdstatus --cddb --drive '$hal.block.device$' --rip " />
           </ivm:Match>
       </ivm:Match>
   </ivm:Match>

Of course you can replace /media/content with the path of your choice.

You also might want to change IvmConfigBase.xml. There is a line there saying

   <ivm:Option name="user" value="ivman" />

This specifies the user under which all ivman commands are run. In order to get things working you need to perform one of the following steps:

  1. make sure /media/content is writable by user ivman and /dev/scd0 is readable by user ivman
  2. reolace the line with: <ivm:Option name="user" value="root" /> causing the code to run as root
  3. make cdstatus setuid root by issueing the command chmod 4711 /usr/bin/cdstatus

Then start ivman. After doing so if you insert an audio CD it will be ripped automatically to /media/content (or your directory if you changed it.
Remember that cdstatus rips to wav files, so ripping a CD may give you up to 700 MB of data (so do not do this on an SD card that is almost full).

Note: on my beagle ripping a CD brings the rest of the system almost to a halt. Apparently a lot of time is used in I/O actions.

Note2: ivman can also be very useful doing all kind of other things on device insertion/removal. See the file /etc/ivman/IvmConfigActions.xml for some examples.

Transcoding a wav file to mp3

Cdstatus gives wav files but probably you want mp3 files. This is easily being done by lame.

You can install lampe through:

  • opkg install lame

Then you can encode a file using the command:

  • lame -h input.wav output.mp3

Handy trick:
if you want to convert all files in a directory you can simply issue the command:

  • for i in *.wav;do lame -h $i `basename $i .wav`.mp3; done

And if you want to remove the wav file after that you can say:

  • for i in *.wav;do lame -h $i `basename $i .wav`.mp3 && rm $i; done

Lame has options to control the bitrate, set mp3 tags etc. Use

  • lame --longhelp

to get an extensive list.

Lame does not retrieve mp3 tags or so from CDDB
Speed of lame is about twice the time of the track when ripping with -h and 128 kbit/s on an otherwise unused Beagle, so it would be nice to be able to use the DSP to transcode wav files.

UPnP server: mediatomb

If you have a UPnP client device like a TV with an embedded UPnP client, or a Digital Media Adapter or a UPnP audio client, or a phone with UPnP client functionality build in you are probably interested in having a UPnP server on your Beagle.
As UPnP server James supports mediatomb. This is a server with a web based UI.

Installation of mediatomb is done in the usual way:

  • opkg install mediatomb

After that you can run mediatomb on your beagle. You might want to check out the options of mediatomb (use mediatomb --help). E.g. you might want to fix the port that mediatomb uses. The default port is the first port after 49151 so most often 49152.
Configuration settings can also be specified in ~/.mediatomb/config.xml
See http://mediatomb.cc/ for information on the syntax of config.xml and on general usage information.

After mediatomb is running you can configure what contents is shared through the web interface. Just use a web browser and browse to the IP address:port number of your beagle (e.g. 192.168.0.10:49152 if 192.168.0.10 is the address of your beagle).

Note: I have never tried the transcoding features of mediatomb.

Another UPnP server: Coherence

When selecting a UPnP server there is another interesting candidate: Coherence. It does not have a fancy UI yet,but it has a very nice feature: it supports a variety of backends which make external (web) content available through UPnP. E.g. there is a backend to serve internet radio (iRadio). Yet another backend will serve FLickR pictures, while yet another one serves Youtube. And if you are a cat lover you definitely want to check out Lolcats!

Installation is done through:

  • opkg install python-coherence

Beware: this will drag in a lot of other packages.

Coherence configuration is stored in ~/.coherence. Info on Coherence and its configuration can be found at http://coherence.beebits.net/

Downloading torrents

The beagle, being a low power device is of course also a nice system to download torrents. rtorrent is a small and efficient tool to download torrents.

Installation of rtorrent is done through:

  • opkg install rtorrent rtorrent-doc

In order to be able to suspend rtorrent and disconnect your terminal (especially useful when connecting to yur system using ssh) it is recommended also to install screen with:

  • opkg install screen screen-doc

Screen is a very nice application that will keep on running whenever you detach from the terminal. If you want to start rtorrent under screen you can type:

  • screen rtorrent

After that you can start whatever torrent you want to.

It is a good idea to first read the manpage for rtorrent. Leaving rtorrent can be done with ctrl-Q. Exiting screen can be done with ctrl-D, and if you want to detach from screen but keep rtorrent and screen running type ctrl-A d or ctrl-A ctrl-D. Further info on the key bindings of screen can be obtained by ctrl-A ?

PVR demo

Work is in progress to implement a personal video recorder (pvr) on the beagle. This code is already running on NSLU2, and has been ported to Beagle. However, unfortunatly my Beagle does not want to work with my Hauppauge USB TV card through the OTG port. Therefore the only thing available is the UI part. This can be downloaded and installed using

Note that pvr.tar.gz contains absolute paths and will overwrite things like httpd.conf.

A description of the design of the PVR and instructions to operate the demo can be found at: http://www.dse.nl/~meulenbr/pvr/pvr.html

Note: if you have connected a monitor to your beagle it is also possible to show the UI locally. Select a good display resolution (e.g. 1280x720MR-24@60) in u-boot and after booting start midori from enlightenment using

Or if you want to start from your serial port or an ssh session you can start midori with:

Packages that are present but still need some work

  • asterisk (IP pbx): still need to look at how to integrate/use it
  • ekiga (SIP client): requires testing
  • LCD4Linux: works as expected, but it is not used yet to display James info.
  • rtorrent: works, needs to be more automated to download torrents
  • cups: haven't played with it yet
  • gpsd and gps-utils: these are a little bit off-topic, but I would love to use the beagle with my bluetooth gps, need to peek into this.

Things to do

In no particular order:

  • More automated/user friendly install script
  • newsreader/leechere (probably nzb based)
  • better UI (perhaps using Wt)
  • ampache?
  • xmltv ?
  • upnp client (gstreamer?
  • automatic import from mass storage
  • fle manager ? (phpexplorer?)
  • photo slideshow application
  • cd recording; I've made a package for cdrkit, but that has some issues and I have not had the time to find out what it is
  • improve PVR and use remote control and/or move to mythtv.
  • improve documentation and add sections for samba, nfs, ekiga and asterisk.
  • work on optimisation. e.g. I would like to use e.g thpptd instead of apache. and maybe move to LXDE)
  • support tux (www.kysoh.com)
  • text to speech

Infrequently Asked Questions

Where are the frequently asked questions

LOL, there are no frequently asked questions. This is so new that any question is infrequently asked (or not at all). This section is here to give answers to some of the things that might pop up while reading this.

Great! Where can I download this? When is this available?

This is work in progress. For now you can reproduce things using the steps outlined above.

Is this feasible? It looks very ambitious

It is definitely ambitious. Then again a bit of ambition does not hurt.
And feasible: I think it is, but only time will tell. A lot of the software is available in the open source domain. I have quite some experience porting software, and a lot of things I did before on NSLU2 where I am eFfeM

But... in the end only time will tell!

Cool, but it would be cooler if you add function XXX

Could be. Feel free to bring XXX to my attention. If there is open source software to support this function, please mention it. Depending on the amount of effort needed and the potential benefit for others, I might pick it up earlier or later.

Can you support hardware device YYY

Depends. I try to make use of existing software as much as possible and try to be device independent, so it might be supported already (perhaps with a little effort).
Then again this also depends on what kind of hardware it is. If it is something nice I'd want myself, I might buy it. If not I might still support it if someone borrows or donates me a piece of hardware to allow testing, if I consider it to be of general use. Then again if your problem is very specific you are probably on your own (although of course I am willing to give some advice).

This project sounds good! Can I help?

Depends on your skills, competences and time.
If you have hardware skills you could probably come up with a prototype for an expansion board, instead of the hodge-podge of USB devices that I am undoubtedly going to make.
If you have mechanical skills you could come up with a casing proposal (otherwise it'll probably be a shoe box project).
If you are graphically skilled you could help defining the UI (I am graphically challenged :-) ).
And if you are a programmer you could port and test some of the packages mentioned above.

Unanswered questions, suggestions, remarks etc

If you have other questions, suggestions, remarks etc. feel free to add them below. I'll try to come up with answers.