How to support Airplay on Linux system.

Post Reply
User avatar
xbmc
Site Admin
Posts: 342
Joined: Wed May 14, 2014 11:51 am

How to support Airplay on Linux system.

Post by xbmc » Mon Jul 10, 2017 11:42 pm

This time, We will install a package that receives sound output of IOS device through shairport to U5PVR.
We are not an IOS user, so we do not have an accurate understanding of the function.

It looks like this feature is called AirPlay.

Once installed, We will try to use it.

Let's see how to simplify routing with Linux firmware installed.

Open shell and access to u5pvr box.
Execute the following command.

** Routing must be enabled by default. exactly!!!!
In case of a server failure, We attached the root file(u5pvr-root_1.0.deb)

root@u5pvr-debian:~# wget http://u5pvr.djjproject.com/u5pvr-root-android.deb
converted 'http://download.djjproject.com/u5pvr/u5 ... ndroid.deb' (ANSI_X3.4-1968) -> 'http://download.djjproject.com/u5pvr/u5 ... ndroid.deb' (UTF-8)
--2017-05-12 06:53:43-- http://download.djjproject.com/u5pvr/u5 ... ndroid.deb
Resolving download.djjproject.com (download.djjproject.com)... 1.226.113.222
Connecting to download.djjproject.com (download.djjproject.com)|1.226.113.222|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2450168 (2.3M) [application/x-debian-package]
Saving to: 'u5pvr-root-android.deb'

u5pvr-root-android.deb 100%[======================================>] 2.34M 5.74MB/s in 0.4s

2017-05-12 06:53:44 (5.74 MB/s) - 'u5pvr-root-android.deb' saved [2450168/2450168]


root@u5pvr-debian:~# dpkg -i u5pvr-root-android.deb
Selecting previously unselected package u5pvr-root-android.
(Reading database ... 117271 files and directories currently installed.)
Preparing to unpack u5pvr-root-android.deb ...
Unpacking u5pvr-root-android (1.0-djjproject) ...
Setting up u5pvr-root-android (1.0-djjproject) ...
* daemon not running. starting it now on port 5038 *
* daemon started successfully *

root@u5pvr-debian:~# reboot

Download -> Install -> Reboot .

Check that is rooting

Image

Image

Image

Image

Image

Well Done..


1. Installing alsamixer

Install alsamixer with the following command.

root@u5pvr-debian:~# apt-get install alsa-base alsa-oss alsa-utils libasound2-dev libpulse-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libasound2 libasound2-data libsamplerate0
Suggested packages:
libasound2-plugins
The following NEW packages will be installed:
alsa-base alsa-oss alsa-utils libasound2 libasound2-data libsamplerate0
0 upgraded, 6 newly installed, 0 to remove and 29 not upgraded.
Need to get 2374 kB of archives.
After this operation, 4811 kB of additional disk space will be used.
Do you want to continue? [Y/n]


Check the device with the following command.

root@u5pvr-debian:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: HISIAIAO [HISI-AIAO], device 0: Playback aiao-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

root@u5pvr-debian:~#


2. Installing the shairport

Install the dependency package first.


root@u5pvr-debian:~# apt-get install avahi-utils build-essential chkconfig git libao-dev libavahi-client-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libssl-dev libwww-perl pkg-config
Reading package lists... Done
Building dependency tree
Reading state information... Done
libmodule-build-perl is already the newest version.
libmodule-build-perl set to manually installed.
The following extra packages will be installed:
avahi-daemon bind9-host geoip-database git-man libao-common libao4 libauthen-sasl-perl
libavahi-core7 libbind9-90 libc-dev-bin libc6 libc6-dev libcrypt-openssl-bignum-perl libdaemon0
libdns100 libencode-locale-perl liberror-perl libfile-listing-perl libfont-afm-perl libgeoip1
libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl
libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
libhttp-negotiate-perl libio-html-perl libio-socket-ssl-perl libisc95 libisccc90 libisccfg90
liblwp-mediatypes-perl liblwp-protocol-https-perl liblwres90 libmailtools-perl libnet-http-perl
libnet-smtp-ssl-perl libnet-ssleay-perl libnss-mdns libsocket6-perl libssl-doc libssl1.0.0
libtimedate-perl liburi-perl libwww-robotrules-perl linux-libc-dev manpages-dev patch rsync
zlib1g-dev
Suggested packages:
avahi-autoipd gettext-base git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui gitk
gitweb git-arch git-cvs git-mediawiki git-svn libaudio2 libesd0 libesd-alsa0 libpulse0
libdigest-hmac-perl libgssapi-perl glibc-doc geoip-bin libdata-dump-perl libcrypt-ssleay-perl
libauthen-ntlm-perl ed diffutils-doc
The following NEW packages will be installed:
avahi-daemon avahi-utils bind9-host geoip-database git git-man libao-common libao-dev libao4
libauthen-sasl-perl libavahi-core7 libbind9-90 libc-dev-bin libc6-dev libcrypt-openssl-bignum-perl
libcrypt-openssl-rsa-perl libdaemon0 libdns100 libencode-locale-perl liberror-perl
libfile-listing-perl libfont-afm-perl libgeoip1 libhtml-form-perl libhtml-format-perl
libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl
libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl libio-html-perl
libio-socket-inet6-perl libio-socket-ssl-perl libisc95 libisccc90 libisccfg90
liblwp-mediatypes-perl liblwp-protocol-https-perl liblwres90 libmailtools-perl libnet-http-perl
libnet-smtp-ssl-perl libnet-ssleay-perl libnss-mdns libsocket6-perl libssl-dev libssl-doc
libtimedate-perl liburi-perl libwww-perl libwww-robotrules-perl linux-libc-dev manpages-dev patch
rsync zlib1g-dev
The following packages will be upgraded:
libc6 libssl1.0.0
2 upgraded, 59 newly installed, 0 to remove and 27 not upgraded.
Need to get 21.6 MB of archives.
After this operation, 51.4 MB of additional disk space will be used.
Do you want to continue? [Y/n]


Next you will get the perl-net-sdp source. I'll just take it to the root folder.
Then proceed to compile.


root@u5pvr-debian:~# apt-get install git libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils libmodule-build-perl make libavahi-client-dev libasound2-dev build-essential pkg-config alsa-utils alsa-base alsa-oss

root@u5pvr-debian:~# git clone https://github.com/njh/perl-net-sdp.git
Cloning into 'perl-net-sdp'...
remote: Counting objects: 193, done.
remote: Total 193 (delta 0), reused 0 (delta 0), pack-reused 193
Receiving objects: 100% (193/193), 40.48 KiB | 0 bytes/s, done.
Resolving deltas: 100% (83/83), done.
Checking connectivity... done.

root@u5pvr-debian:~# cd perl-net-sdp/
root@u5pvr-debian:~/perl-net-sdp# ls
Build.PL Changes MANIFEST README examples lib t

root@u5pvr-debian:~/perl-net-sdp# perl Build.PL
WARNING: the following files are missing in your kit:
Makefile.PL
META.yml
Please inform the author.

Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Net-SDP' version '0.07'


root@u5pvr-debian:~/perl-net-sdp# ./Build
Building Net-SDP

# 정상적인지 체크를 합니다.
root@u5pvr-debian:~/perl-net-sdp# ./Build test
t/00use.t ....... ok
t/10generate.t .. ok
t/10parse.t ..... ok
t/20repeat.t .... ok
t/30asstring.t .. ok
All tests successful.
Files=5, Tests=69, 1 wallclock secs ( 0.13 usr 0.03 sys + 0.56 cusr 0.05 csys = 0.77 CPU)
Result: PASS


root@u5pvr-debian:~/perl-net-sdp# ./Build install
Building Net-SDP
Installing /usr/local/man/man1/sdp2rat.1p
Installing /usr/local/share/perl/5.20.2/Net/SDP.pm
Installing /usr/local/share/perl/5.20.2/Net/SDP/Time.pm
Installing /usr/local/share/perl/5.20.2/Net/SDP/Media.pm
Installing /usr/local/man/man3/Net::SDP::Time.3pm
Installing /usr/local/man/man3/Net::SDP::Media.3pm
Installing /usr/local/man/man3/Net::SDP.3pm
Installing /usr/local/bin/sdp2rat
root@u5pvr-debian:~/perl-net-sdp#


Next, you receive and install the shairport source.

root@u5pvr-debian:~# git clone https://github.com/abrasive/shairport.git
Cloning into 'shairport'...
remote: Counting objects: 1635, done.
remote: Total 1635 (delta 0), reused 0 (delta 0), pack-reused 1635
Receiving objects: 100% (1635/1635), 431.72 KiB | 84.00 KiB/s, done.
Resolving deltas: 100% (959/959), done.
Checking connectivity... done.


root@u5pvr-debian:~# cd shairport/

root@u5pvr-debian:~/shairport# ./configure
Configuring Shairport
OpenSSL found
libao found
PulseAudio found
ALSA found
Avahi client found
getopt.h found
CFLAGS: -D_REENTRANT -I/usr/include/alsa -D_REENTRANT
LDFLAGS: -lm -lpthread -lssl -lcrypto -lao -lpulse-simple -lpulse -lasound -lavahi-common -lavahi-client
Configure successful. You may now build with 'make'


root@u5pvr-debian:~/shairport# make && make install
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT shairport.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT daemon.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT rtsp.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT mdns.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT mdns_external.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT mdns_tinysvcmdns.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT common.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT rtp.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT metadata.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT player.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT alac.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT audio.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT audio_dummy.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT audio_pipe.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT tinysvcmdns.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT audio_ao.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT audio_pulse.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT audio_alsa.c
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT mdns_avahi.c
cc shairport.o daemon.o rtsp.o mdns.o mdns_external.o mdns_tinysvcmdns.o common.o rtp.o metadata.o player.o alac.o audio.o audio_dummy.o audio_pipe.o tinysvcmdns.o audio_ao.o audio_pulse.o audio_alsa.o mdns_avahi.o -lm -lpthread -lssl -lcrypto -lao -lpulse-simple -lpulse -lasound -lavahi-common -lavahi-client -o shairport
cc -c -O2 -Wall -D_REENTRANT -I/usr/include/alsa -D_REENTRANT shairport.c
cc shairport.o daemon.o rtsp.o mdns.o mdns_external.o mdns_tinysvcmdns.o common.o rtp.o metadata.o player.o alac.o audio.o audio_dummy.o audio_pipe.o tinysvcmdns.o audio_ao.o audio_pulse.o audio_alsa.o mdns_avahi.o -lm -lpthread -lssl -lcrypto -lao -lpulse-simple -lpulse -lasound -lavahi-common -lavahi-client -o shairport
install -m 755 -d /usr/local/bin
install -m 755 shairport /usr/local/bin/shairport


Installation is complete.


3. Running avahi-daemon

root@u5pvr-debian:~# adduser avahi aid_inet
The user `avahi' is already a member of `aid_inet'.
root@u5pvr-debian:~# service avahi-daemon restart
[ ok ] Restarting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
root@u5pvr-debian:~#


Avahi-daemon log

Jun 25 18:53:36 localhost avahi-daemon[7544]: Found user 'avahi' (UID 109) and group 'avahi' (GID 113).
Jun 25 18:53:36 localhost avahi-daemon[7544]: Successfully dropped root privileges.
Jun 25 18:53:36 localhost avahi-daemon[7544]: avahi-daemon 0.6.31 starting up.
Jun 25 18:53:36 localhost avahi-daemon[7544]: Successfully called chroot().
Jun 25 18:53:36 localhost avahi-daemon[7544]: Successfully dropped remaining capabilities.
Jun 25 18:53:36 localhost avahi-daemon[7544]: No service file found in /etc/avahi/services.
Jun 25 18:53:36 localhost avahi-daemon[7544]: *** WARNING: Detected another IPv4 mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended. ***
Jun 25 18:53:36 localhost avahi-daemon[7544]: *** WARNING: Detected another IPv6 mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended. ***
Jun 25 18:53:36 localhost avahi-daemon[7544]: Joining mDNS multicast group on interface eth0.IPv6 with address fe80::1856:1aff:fee8:4b8b.
Jun 25 18:53:36 localhost avahi-daemon[7544]: New relevant interface eth0.IPv6 for mDNS.
Jun 25 18:53:36 localhost avahi-daemon[7544]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.0.11.
Jun 25 18:53:36 localhost avahi-daemon[7544]: New relevant interface eth0.IPv4 for mDNS.
Jun 25 18:53:36 localhost rsyslogd-2007: action 'action 17' suspended, next retry is Sun Jun 25 18:54:06 2017 [try http://www.rsyslog.com/e/2007 ]
Jun 25 18:53:36 localhost avahi-daemon[7544]: Network interface enumeration completed.
Jun 25 18:53:36 localhost avahi-daemon[7544]: Registering new address record for fe80::1856:1aff:fee8:4b8b on eth0.*.
Jun 25 18:53:36 localhost avahi-daemon[7544]: Registering new address record for 192.168.0.11 on eth0.IPv4.
Jun 25 18:53:36 localhost avahi-daemon[7544]: Registering HINFO record with values 'ARMV7L'/'LINUX'.
Jun 25 18:53:37 localhost avahi-daemon[7544]: Server startup complete. Host name is u5pvr-debian.local. Local service cookie is 1143526822.





root@u5pvr-debian:~# ./alsamixer
- Check the execution of the mixer

Image

** Once you have aimed to be on the RCA jack without TV, insert the 3.5-pin jack and plug it into the speaker
Connect.
3.5 Pie You can not hear the sound directly. Copper cable + 2rca female -> 3.5 male and male voice comes out.

Edit /usr/share/alsa/alsa.conf File
With nano /usr/share/alsa/alsa.conf
Find pcm.front cards.pcm.front and Edit from pcm.front cards.pcm.front to pcm.front cards.pcm.default and save file.

root@u5pvr-debian: ./speaker-test -t sine
- If you hear a beep from the connected speaker, the speaker connection is successful.

make

root@u5pvr-debian: ./adduser avahi aid_inet
The user `avahi' is already a member of `aid_inet'.
service avahi-daemon restart
[ ok ] Restarting Avahi mDNS/DNS-SD Daemon: avahi-daemon.

root@u5pvr-debian: ././shairport -a u5pvr-AirP
- shairport 를 태스트 합니다. AirPlay 이름은 u5pvr-AirP 입니다.

Image

Image

- confirmed that the connection was made.the sound comes out well.

Ctrl + C
- Test ends.

root@u5pvr-debian: make install

cd /etc/init.d
chmod a+x shairport
update-rc.d shairport defaults
nano shairport
Edit : DAEMON_ARGS="-w $PIDFILE -a u5pvr-AirP" #"u5pvr-AirP" 부분은 편하신대로 바꾸면 됩니다.
Save and Exit

service shairport restart

Post Reply

Return to “Linux Part”