OpenWrt Forum Archive

Topic: shairport on openwrt

The content of this topic has been archived between 2 Sep 2014 and 25 Apr 2018. Unfortunately there are posts – most likely complete pages – missing.

I've been trying to install a C version of shairport for a few days now, without success. Could anyone give a short summary of steps of what I need to do in order to install it on a fresh openwrt install (TP-LINK WR1043ND)?
The Perl version seemed to need too many installed packages for the only 4 MB's available.

mdevries wrote:

I've been trying to install a C version of shairport for a few days now, without success. Could anyone give a short summary of steps of what I need to do in order to install it on a fresh openwrt install (TP-LINK WR1043ND)?
The Perl version seemed to need too many installed packages for the only 4 MB's available.

How are you trying to build shairport?  Are you building your own firmware image?  The only additional steps to build shairport should be adding the feed to feeds.conf then:

./scripts/feeds update -a
./scripts/feeds install shairport
make menuconfig

shairport will be in the Sound menu.

jlars wrote:
mdevries wrote:

I've been trying to install a C version of shairport for a few days now, without success. Could anyone give a short summary of steps of what I need to do in order to install it on a fresh openwrt install (TP-LINK WR1043ND)?
The Perl version seemed to need too many installed packages for the only 4 MB's available.

How are you trying to build shairport?  Are you building your own firmware image?  The only additional steps to build shairport should be adding the feed to feeds.conf then:

./scripts/feeds update -a
./scripts/feeds install shairport
make menuconfig

shairport will be in the Sound menu.

No, I was trying to install it on an existing build. I'll try to build my own firmware then. Thanks!

mdevries wrote:

No, I was trying to install it on an existing build. I'll try to build my own firmware then. Thanks!

At minimum you would have also needed to install an updated libao, however a recent shairport commit is supposed to provide compatibility with older versiosn of libao which should make it more straightforward to add shairport to an existing build.  You would still have to cross compile shairport for your target, but all of the other required packages should be available.

I will update the Makefile in my feed once I get a chance to test it, but it should be trivial to update the package version if anyone else wants to try it first.

jlars wrote:

How are you trying to build shairport?  Are you building your own firmware image?  The only additional steps to build shairport should be adding the feed to feeds.conf then:

./scripts/feeds update -a
./scripts/feeds install shairport
make menuconfig

shairport will be in the Sound menu.

That worked brilliantly, thank you!

Off-topic: I'm amazed at what this budget router can do. Shairport, a DVB tuner card and still doing a good job at being an AP. OpenWRT rocks!

what is the role/purpose of hairtunes binary?
hairtunes
FATAL: Must supply AES key and IV!

ratbug wrote:

what is the role/purpose of hairtunes binary?
hairtunes
FATAL: Must supply AES key and IV!

shairport just initiates the connection then passes the port, key, etc. to hairtunes for streaming/playback.  The key is included in shairport, and is needed to decrypt the stream.

I see.
My ubuntu build worked the first time and then it never works again. Streaming audio from iphone to ubuntu worked.
Now my iphone (4.2.1) does not see shairport anymore even after multiple reboots. Shairport port is open and telnet to port 5000 shows that it can receive connections.
Same issue with my openwrt build.
Seems to be an issue with the phone.

Solution
Found out the problem is with the router. Rebooting the router got me the airplay icon back

(Last edited by ratbug on 25 May 2011, 04:12)

I wish you would use polarssl instead, I don't think a fullblown openssl is needed for shairport.

... or CyaSSL smile

arokh wrote:

I wish you would use polarssl instead, I don't think a fullblown openssl is needed for shairport.

There is a similar utility (same concept) using polarssl by a french guy on neufbox4. But his version is not working at all for me neither ubuntu nor openwrt.

stevo wrote:

I get following error when trying to run the server:


perl /usr/bin/shairport.pl
**************************************
* IO::Socket::INET6 not present!     *
* Install this if iTunes won't play. *
**************************************

Failed to create client object: Daemon not running
died
died
Avahi publishing failed! Do you have avahi-publish-service on your PATH? at /usr/bin/shairport.pl line 97, <DATA> line 23.


is special configuration of the avahi-daemon required?


edit:
avahi-daemon
Found user 'nobody' (UID 65534) and group 'nogroup' (GID 65534).
Successfully dropped root privileges.
avahi-daemon 0.6.30 starting up.
WARNING: No NSS support for mDNS detected, consider installing nss-mdns!
dbus_bus_request_name(): Connection ":1.2" is not allowed to own the service "org.freedesktop.Avahi" due to security policies in the configuration file
WARNING: Failed to contact D-Bus daemon.
avahi-daemon 0.6.30 exiting.

Any ideas?

Got it to work by adding a policy for avahi in the dbus configuration.

Hi, what did you add specifically? I've run into the same problem and tried two different approaches, neither of which worked.

First, I tried to run Shairport and got

"root@OpenWrt:/# shairport
LogLevel: 1
AirName: ShairPort
HWID: KWo.X.
HWID_Hex(12): 004B576F2E58
Failed to create client object: Daemon not running

After seeing the post I'm quoting, I checked and avahi-daemon wasn't even running. So I ran it and tried to simply bypass configuring dbus (which I'm clueless about) by running avahi-daemon with the "enable-dbus' setting set to "no", in order to skip it entirely.

That made avahi-daemon run fine, but I still got the same "Daemon not running" error from shairport. So I went back and tried to enable dbus. That let to this error when I ran avahi-daemon:

root@OpenWrt:/etc/avahi# avahi-daemon
Found user 'nobody' (UID 65534) and group 'nogroup' (GID 65534).
Successfully dropped root privileges.
avahi-daemon 0.6.30 starting up.
WARNING: No NSS support for mDNS detected, consider installing nss-mdns!
dbus_bus_get_private(): Failed to connect to socket /var/run/dbus/system_bus_soc
ket: No such file or directory
WARNING: Failed to contact D-Bus daemon.

So... I'm getting the idea that  D-Bus actually has to run. I thought I'd installed it properly, but when I run it, I get

D-Bus Message Bus Daemon 1.2.4.6permissive
Copyright (C) 2002, 2003 Red Hat, Inc., CodeFactory AB, and others
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
URPOSE.
root@OpenWrt:/etc/dbus-1# dbus-daemon --system
Unknown group "netdev" in message bus configuration file
Failed to start message bus: Failed to bind socket "/var/run/dbus/system_bus_soc
ket": No such file or directory
root@OpenWrt:/etc/dbus-1# dbus-daemon
No configuration file specified.

Maybe my brain is just freezing up (after setting up opewrt, compiling and installing everything on my nslu2) and I'm missing something obvious, but can someone point me in the right direction about what to do next?

Is there another package I'm missing to get dbus running? Do I actually need it running, or is the shairport error something else entirely?

Thanks!

I just run "/etc/init.d/dbus start" and have not had to touch any dbus config.

Doh! Thank you very much jlars... up and running perfectly now!

somehow on this version im getting stuttering every 10 minutes or so. The stuttering takes only 2,3 second but it is very disturbing especially when listening on high volume...

Did not have this issue before on Perl version of shairport. Anyone can confirm this issue?
(im running it on asus rt-n16)

hmm I have same issue on wndr3700 and every 5 minutes last time.

jlars, would you mind taking a look at this issue?

I can confirm that I was having the same issue with both the perl and C version so it could be a regression in hairtunes. I have also noted that I get a higher CPU load with both the perl and C versions than I did when there was only a perl version.  Although the C version does have less load for me now than the perl version.

I have just updated the shairport package in my feed to the latest version from github.com/albertz/shairport.  It builds cleanly, but I have not tested it yet so I am not sure if it fixes this issue.  I also removed libao from my feed since it is now updated in the main packages feed.

The current version seems a bit broken... can't get it to work:

root@OpenWrt:~# shairport
LogLevel: 1
AirName: ShairPort
HWID: NCf\>?
HWID_Hex(12): 004E43665C3E
Failed to create ipv6 socket. Trying ipv4: Address family not supported by protocol
Error: Could not bind socket: Address family not supported by protocol
Error setting up server socket on port 5002, try specifying a different port
root@OpenWrt:~# Established under name '004E43665C3E@ShairPort'


It shows in iTunes but cannot connect to it at all... 'ps' shows avahi running but not hairtunes...
Moreover, I tried to change ports... but this does not help.
Running on Rev. r28043.

--- update

interestingly.. I moved to shairport-perl (same system/version, etc)... everything works fine, however the music still skips every a few minutes when using perl version...

(Last edited by gregd72002 on 20 Aug 2011, 01:44)

Hi,

Would someone be able to post me a sample avahi service file that I could use to manually publish the shairport server?

Thanks in advance

(Last edited by ArowanA on 27 Aug 2011, 21:00)

here's what mine looks like:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Airplay Server on %h</name>
<service>
<type>_raop._tcp</type>
<port>5000</port>
<txt-record>txtvers=1</txt-record>
<txt-record>vn=3</txt-record>
<txt-record>pw=false</txt-record>
<txt-record>sr=44100</txt-record>
<txt-record>ss=16</txt-record>
<txt-record>ch=2</txt-record>
<txt-record>cn=0,1</txt-record>
<txt-record>et=0,1</txt-record>
<txt-record>ek=1</txt-record>
<txt-record>sv=false</txt-record>
<txt-record>sm=false</txt-record>
<txt-record>tp=TCP,UDP</txt-record>
</service>
</service-group>

Thanks ratbug, that worked great.

Edit: I had to change the line
<name replace-wildcards="yes">Airplay Server on %h</name>
to include the random? HWID created when starting shairport
<name replace-wildcards="yes">002461244430@Airplay_on_router</name>

(Last edited by ArowanA on 27 Aug 2011, 23:16)

I've got this working on my router and it seems good but I'm having a few problems.
The main one is while it works from my computers itunes to the router, if I try and send music from my iphone it breaks up every few seconds and I get a lot of
requesting resend on 1 packets (port 50075)
requesting resend on 1 packets (port 50075)
underrun.
underrun.

errors showing up, I get these with the wired connection also but they don't seem to cause the pausing.
Also sometime I'll get a shairport: hairtunes.c: 354: alac_decode: Assertion `outsize == (4*frame_size)'
error and everything stops working. Because my router doesn't really have space for the alsa-libs I'm starting shairport with the following command

shairport -o 5000 --ao_driver=oss --ao_devicename=/dev/dsp4 -k 345670

I have also tried using alsa and got the same problems. Does anyone have any ideas where I'm going wrong?
Thanks

I can't find shairport with opkg list, is it available in trunk repositories?