Skip to content

Instantly share code, notes, and snippets.

Created February 18, 2017 14:56
Show Gist options
  • Save anonymous/546cd3e47908668f0f255a9ed04805c2 to your computer and use it in GitHub Desktop.
Save anonymous/546cd3e47908668f0f255a9ed04805c2 to your computer and use it in GitHub Desktop.
_pkgname="pulseaudio"
pkgname="$_pkgname-hfp"
pkgdesc="A featureful, general-purpose sound server"
pkgver=tanuk.8367.af043266
pkgrel=1
arch=("i686" "x86_64" "armv7h")
url="http://pulseaudio.org/"
license=("GPL" "LGPL")
depends=("rtkit" "libltdl" "speex" "tdb" "systemd" "fftw" "orc" "libsamplerate"
"webrtc-audio-processing" "sbc" "libasyncns" "libxtst" "libsm" "libsndfile" "json-c")
makedepends=("git" "attr" "avahi" "bluez" "gconf" "intltool" "openssl" "bluez-libs")
optdepends=("alsa-plugins: ALSA support"
"avahi: zeroconf support"
"bluez: bluetooth support"
"gconf: configuration through gconf"
"jack: jack support"
"lirc-utils: infra-red support"
"openssl: RAOP support"
"python-pyqt4: Equalizer GUI (qpaeq)")
backup=(etc/pulse/{daemon.conf,default.pa,system.pa,client.conf})
provides=("pulseaudio" "libpulse" "pulseaudio-zeroconf" "pulseaudio-gconf" "pulseaudio-equalizer" "pulseaudio-bluetooth" "pulseaudio-jack" "pulseaudio-xen" "pulseaudio-lirc")
conflicts=("pulseaudio" "libpulse" "pulseaudio-zeroconf" "pulseaudio-gconf" "pulseaudio-equalizer" "pulseaudio-bluetooth" "pulseaudio-jack" "pulseaudio-xen" "pulseaudio-lirc")
replaces=("pulseaudio" "libpulse" "pulseaudio-zeroconf" "pulseaudio-gconf" "pulseaudio-equalizer" "pulseaudio-bluetooth" "pulseaudio-jack" "pulseaudio-xen" "pulseaudio-lirc")
options=(!emptydirs)
source=("git://people.freedesktop.org/~tanuk/pulseaudio#branch=hfp")
sha256sums=("SKIP")
pkgver() {
cd "$srcdir/$_pkgname"
# git describe --always | sed "s/-/./g"
printf "%s.%s.%s" "tanuk" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
build() {
cd "$srcdir/$_pkgname"
GIT_DESCRIBE_FOR_BUILD="$pkgver" ./autogen.sh --prefix=/usr \
--sysconfdir=/etc \
--libexecdir=/usr/lib \
--localstatedir=/var \
--with-udev-rules-dir=/usr/lib/udev/rules.d \
--with-database=tdb \
--disable-hal-compat \
--disable-tcpwrap \
--disable-bluez4 \
--disable-rpath \
--disable-default-build-tests
make
}
package() {
cd "$srcdir/$_pkgname"
make DESTDIR="$pkgdir" install bashcompletiondir=/usr/share/bash-completion/completions
# Speed up pulseaudio shutdown so that it exits immediately with
# the last user session (module-systemd-login keeps it alive)
sed -e "/exit-idle-time/iexit-idle-time=0" -i "$pkgdir/etc/pulse/daemon.conf"
# Disable cork-request module, can result in e.g. media players unpausing
# when there"s a Skype call incoming
sed -e "s|/usr/bin/pactl load-module module-x11-cork-request|#&|" -i "$pkgdir/usr/bin/start-pulseaudio-x11"
rm "$pkgdir/etc/dbus-1/system.d/pulseaudio-system.conf"
install -Dm644 shell-completion/zsh/_pulseaudio "$pkgdir/usr/share/zsh/site-functions/_pulseaudio"
}
@Lyle-Tafoya
Copy link

I'm getting build errors. First one was a static definition of a non-statically declared method:

./pulsecore/memfd-wrappers.h:36:19: error: static declaration of ‘memfd_create’ follows non-static declaration
 static inline int memfd_create(const char *name, unsigned int flags) {

I fixed this by removing the keyword "static", but then ended up with the following error

modules/raop/raop_client.c:167:8: error: dereferencing pointer to incomplete type ‘RSA’ {aka ‘struct rsa_st’}
     rsa->n = BN_bin2bn(modules, size, NULL);

Trying desparately to get the mic working on my Plantronics Beatback Pro 2. It used to work fine, but I haven't managed to get it working for at least a year. Was hoping this would do the trick.

@tigerjack
Copy link

Same problem of @Lyle-Tafoya here.

@7nik
Copy link

7nik commented Mar 20, 2021

I could build the package after adding the following lines:

export PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig
export CFLAGS="-Wno-error"

prepare() {
    cd "$srcdir/$_pkgname"
    patch --strip=1 --input=../../memfd_create.patch
    patch --strip=1 --input=../../raop_client.patch
}

and pathes memfd_create.patch and raop_client.patch:

Subject: [PATCH] raop_client: now n and e props are private so use the setter
---
 modules/raop/raop_client.c     | 1 ++-
 1 file changed,  insertions(+), 3 deletions(-)

diff --git a/src/modules/raop/raop_client.c b/src/modules/raop/raop_client.c
index 3b6c36ec..85e4c18e 100644
--- a/src/modules/raop/raop_client.c
+++ b/src/modules/raop/raop_client.c
@@ -159,14 +159,13 @@ static int rsa_encrypt(uint8_t *text, int len, uint8_t *res) {
     const char e[] = "AQAB";
     uint8_t modules[256];
     uint8_t exponent[8];
-    int size;
+    int size, size2;
     RSA *rsa;

     rsa = RSA_new();
     size = pa_base64_decode(n, modules);
-    rsa->n = BN_bin2bn(modules, size, NULL);
-    size = pa_base64_decode(e, exponent);
-    rsa->e = BN_bin2bn(exponent, size, NULL);
+    size2 = pa_base64_decode(e, exponent);
+    RSA_set0_key(rsa, BN_bin2bn(modules, size, NULL), BN_bin2bn(exponent, size2, NULL), NULL);

     size = RSA_public_encrypt(len, text, res, rsa, RSA_PKCS1_OAEP_PADDING);
     RSA_free(rsa);

To install this package, I had to remove the original libpulse, pulseaudio, and pulseaudio-* packages and a bunch of packages that used them.

After rebooting I was able to pair my headset via HSP/HFP protocol only and use a microphone. But the sound quality was awful and built-in audio wasn't available anymore so I reversed all changes.

For some reason, now I can choose between A2DP and HSP/HFP protocols.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment