Ikke's Blog

Category: Networks

Jun 14
Maemo/Nokia 770 sound streaming

As I'm not allowed to code last days (studies >:() I tried to get something working I wanted for a long time: be able to run my favorite media player on my desktop (I must confess that's Amarok), and playback the music using a hifi chain in another room.

As currently I don't have a wifi network at home, I can't do "the real thing" yet, but testing can be done using usbnet (little howto on how to set up that might follow later).

After lots of searching and great help on several IRC channels, I got things working fine now.

Let's start with a little overview of the setup.
Desktop:

  • Music player: Amarok using the Xine backend, using alsa
  • Streaming server: Icecast2
  • Icecast source: gst-launch using the shout2cast sink

770:

  • Just the standard audio player

Here's how to set up things correctly:

  • Install icecast2 on your system (this is distribution dependant)
  • Configure the server. You can run icecast as a system service, or as a normal user. I chose to run it as a normal user:
    • Copy /etc/icecast2/icecast.xml to some directory
    • Change "logdir" to some directory you got write permissions for
    • Start the server: icecast -c icecast.xml (add -b to daemonize)
  • Start some media player
  • Now we got to get the media player's output to our icecast server. As the 770 cannot playback ogg/vorbis, but can handle mp3, we'll use mp3 here. I know that might be non-free etc, but let's be pragmatic.

    To get the alsa sound to the server, one might use DarkIce, but I could not get this working, so I used a simple gstreamer pipeline instead:gst-launch-0.10 alsasrc device=plughw:0,0 ! audioconvert ! lame ! shout2send mount=amarok

    You might need to change the "device" parameter, you can change the "mount" parameter of shout2send too (although you'll have to adjust the URI used later too, of course). I'm using the default password ("hackme") in this setup, if you don't, or want to set other options, see gst-inspect-0.10 shout2send for more info.

  • When that's running fine, open a browser, and go to http://localhost:8000. If all goes well, the "amarok" mount should be listed there. Do not open the stream, as this'd create a loop!
  • Finally, launch the audio player on your 770 device, open the menu, "Playlist -> Add Stream...", and enter here the URI of the stream. In my setup, this is http://192.168.2.1:8000/amarok. Now start playback.
  • The 770 should buffer some data, then start playback.

Currently, I stream my Amarok's output to my device using usbnet, and got my normal computer speaker connected to the jack output. Works fine :-)

If you're using Amarok too, take a look at the "Web Control" script. When running this script, you can open the 770's browser, and browse to http://192.168.2.1:4774 (adjust the IP). Now you're able to control Amarok from your device, and look at the current playlist. No need to walk to your desktop. The web interface might need some love though.

That's about it, have fun!

May 9
Good old messaging

Davyd talked about integrating good old messaging systems like talk, wall, write and even WinPopup into the GNOME desktop. As it looked like a fun thing to do, I got my hands down on it today.

I still couldn't figure out how to catch wall and other pty-based messages, but I'm sure I will be able to get them working too.

At the moment, WinPopup messages work:

Maybe in-time one should be able to click the message popup and get a simple window allowing the user to reply on the incoming message, but thats to be done later on, first I want to get wall and talk requests working fine.

A little change to smb.conf is needed for this (the "message command" line should be set, I'm using a Python script to send the messages), and one file in the D-BUS system.d to allow the user Samba uses to spawn the message command ("nobody" on my system) to send messages on the system bus.
Obviously pty-based messages shouldn't need a callout anywhere.

Current code isn't ready for release yet (at all), I'll try to get what I got into good shape asap.

Dec 2
gotroot.com mod_security rules update script

Lately I've been working on the new webserver machine for VTK. Today I configured mod_security for Apache2, partially by using the rules one can find on gotroot.com.
On the site a little script is provided to update the rules automagicly (in a cronjob or something alike), but when I started using the script I didn't like it for several reasons.
So I decided to rewrite it to suit my needs. You can find my enhanced version here.

The machine now also runs PHP4 and PHP5 side by side thanks to this great documentation (and the Gentoo PHP herd developers, obviously). PHP4 as an Apache module (because this is the "default", so it must run as efficient as possible), PHP5 using the CGI interface for all .php5 files.
We can't make "the big switch" to a PHP5-only server due to our bloody PhpBB forum which is not PHP5 compatible. And as our forum is one of the biggest PHP consumers on the server, I don't want to run PHP4 as CGI and only run the forum this way.

[edit]
I enhanced the script a little more, here's a diff:

--- update_mod_security_rules.sh        2005-12-02 14:46:02.000000000 +0100
+++ update_rules_v2.sh  2005-12-04 14:34:33.000000000 +0100
@@ -15,6 +15,7 @@
 APACHESTART="/etc/init.d/apache2 restart"
 MODSECPATH="/etc/modsecurity"
 APACHEPID="/var/run/apache2.pid"
+APACHECTL="/usr/sbin/apache2ctl"

 #Modules
 #If you want the "exclude" rules, they should be the first entry in the list
@@ -59,10 +60,21 @@

 echo "Make sure you got \"Include ${MODSECPATH}/all.conf\" somewhere in your Apache config"

+${APACHECTL} configtest > /dev/null 2>&1
+if [ ! "x$?" = "x0" ]; then
+        echo
+        echo "There's something wrong in Apache's configuration:"
+        echo
+        ${APACHECTL} configtest
+        echo
+        echo "Exiting, not restarting Apache"
+        exit 1
+fi
+
 # try restart
 if [ "$UPDATED" -gt "0" ]; then
         echo -n "Restarting apache: "
-        /bin/kill -HUP ${PID} 2>/dev/null
+        ${APACHECTL} graceful
         # did it work?
         if `/bin/kill -CHLD ${PID} >/dev/null 2>&1`; then
                 echo "ok."

The script

Nov 5
Maemo and mDNS

Porting Avahi to the Maemo platform seems to be quite hard (if not impossible) because of the DBUS version conflict (Avahi needs DBUS >= 0.34, whilst the Maemo platform is still based on DBUS 0.2x). There's a DBUS 0.3x branch in Maemo's SVN repository, but that's not stable yet, and will only be used in the InternetTablet2006 releases, so I gave up on Avahi for now :oops:.
Instead, I'm trying to create a good package of Howl now (I know, I don't like the Howl API either), then I'll attempt to build a small (Hildon?) application on top of it, just as a test case for "the real thing" ;-)

*edit*
It works inside my scratchbox (i386) :-)
Built an arm deb package too, installed it on my "real" device, the software runs (no ld errors), but I couldnt test it yet as I don't have a wireless network at home, and didn't manage to get USB networking working yet :-(

Oct 27
770 and UGent VPN

So, I just got my Nokia 770 connected to the UGent VPN nerwork, which means I can connect to the internet when I'm near one of the access points. It wasn't too easy, and editting long texts on the device is fairly boring, so I'll stop here. More news when I'm near a "real" computer ;-)

Cheers!

:: Next Page >>

Categories

Who's Online?

  • Guest Users: 24

Misc

XML Feeds

What is RSS?