From 114bd3cd639b66e90165b9daea9f2f7ed9f114a6 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 10 Apr 2021 17:37:35 +0200 Subject: [PATCH] =?utf8?q?add=20patch=20for=20recent=20PulseAudio=20(by=20?= =?utf8?q?S=C3=A9bastien=20Noel)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- debian/changelog | 10 + debian/patches/GIT-fix-adsp_se.patch | 24 ++ .../patches/GIT-fix-compiler-warnings.patch | 251 ++++++++++++++++++ .../Hack-to-work-with-modern-PulseAudio.patch | 37 +++ debian/patches/series | 3 + 5 files changed, 325 insertions(+) create mode 100644 debian/patches/GIT-fix-adsp_se.patch create mode 100644 debian/patches/GIT-fix-compiler-warnings.patch create mode 100644 debian/patches/Hack-to-work-with-modern-PulseAudio.patch diff --git a/debian/changelog b/debian/changelog index c412732..4a8cab9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +osspd (1.3.2-12) UNRELEASED; urgency=low + + * cherrypick 2 commits from upstream GIT: + + d/p/GIT-fix-adsp_se.patch + + d/p/GIT-fix-compiler-warnings.patch + * Add workaround for pulseaudio >= 13 + d/p/Hack-to-work-with-modern-PulseAudio.patch + + -- Sébastien Noel Thu, 08 Apr 2021 09:01:51 +0200 + osspd (1.3.2-11) unstable; urgency=medium * Update Standards-Version to 4.3.0. No changes needed. diff --git a/debian/patches/GIT-fix-adsp_se.patch b/debian/patches/GIT-fix-adsp_se.patch new file mode 100644 index 0000000..7316f9c --- /dev/null +++ b/debian/patches/GIT-fix-adsp_se.patch @@ -0,0 +1,24 @@ +From 4c6161d951daa98f6463904f76b3fa2ce7216194 Mon Sep 17 00:00:00 2001 +From: Tejun Heo +Date: Mon, 21 Feb 2011 11:54:06 +0100 +Subject: [PATCH] adsp_se was incorrectly created with dsp_ops. Create it with + adsp_ops. + +Reported-by: Aaron +--- + osspd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/osspd.c b/osspd.c +index 37c9b35..df1cfc4 100644 +--- a/osspd.c ++++ b/osspd.c +@@ -2253,7 +2253,7 @@ int main(int argc, char **argv) + param.mixer_major, param.mixer_minor, + args.argc, args.argv); + if (strlen(param.adsp_name)) +- adsp_se = setup_ossp_cuse(&dsp_ops, param.adsp_name, ++ adsp_se = setup_ossp_cuse(&adsp_ops, param.adsp_name, + param.adsp_major, param.adsp_minor, + args.argc, args.argv); + diff --git a/debian/patches/GIT-fix-compiler-warnings.patch b/debian/patches/GIT-fix-compiler-warnings.patch new file mode 100644 index 0000000..1424b2b --- /dev/null +++ b/debian/patches/GIT-fix-compiler-warnings.patch @@ -0,0 +1,251 @@ +From 37eb730a452f0ded2ed1c174feb438e3df041581 Mon Sep 17 00:00:00 2001 +From: Miklos Szeredi +Date: Fri, 11 Nov 2011 14:19:32 +0100 +Subject: [PATCH] fix compiler warnings + +--- + ossp-padsp.c | 3 --- + osspd.c | 75 ++++++++++++++++++++++++++++++---------------------- + 2 files changed, 44 insertions(+), 34 deletions(-) + +diff --git a/ossp-padsp.c b/ossp-padsp.c +index 1871f5b..3143960 100644 +--- a/ossp-padsp.c ++++ b/ossp-padsp.c +@@ -972,16 +972,13 @@ static void do_mmap_read(size_t bytes) + + static void stream_rw_callback(pa_stream *s, size_t length, void *userdata) + { +- int dir; + size_t size; + + if (s == stream[PLAY]) { +- dir = PLAY; + size = pa_stream_writable_size(s); + if (mmap_map[PLAY]) + do_mmap_write(size); + } else if (s == stream[REC]) { +- dir = REC; + size = pa_stream_readable_size(s); + if (mmap_map[REC]) + do_mmap_read(size); +diff --git a/osspd.c b/osspd.c +index df1cfc4..4be1ad5 100644 +--- a/osspd.c ++++ b/osspd.c +@@ -469,15 +469,6 @@ static int ioctl_prep_uarg(fuse_req_t req, void *in, size_t in_sz, void *out, + return; \ + } while (0) + +-#define IOCTL_RETURN(result, outp) do { \ +- if ((outp) != NULL) \ +- fuse_reply_ioctl(req, result, (outp), sizeof(*(outp))); \ +- else \ +- fuse_reply_ioctl(req, result, NULL, 0); \ +- return; \ +-} while (0) +- +- + /*************************************************************************** + * Mixer implementation + */ +@@ -709,7 +700,8 @@ static void mixer_simple_ioctl(fuse_req_t req, struct ossp_mixer *mixer, + strncpy(info.id, id, sizeof(info.id) - 1); + strncpy(info.name, name, sizeof(info.name) - 1); + info.modify_counter = mixer->modify_counter; +- IOCTL_RETURN(0, &info); ++ fuse_reply_ioctl(req, 0, &info, sizeof(info)); ++ break; + } + + case SOUND_OLD_MIXER_INFO: { +@@ -718,7 +710,8 @@ static void mixer_simple_ioctl(fuse_req_t req, struct ossp_mixer *mixer, + PREP_UARG(NULL, &info); + strncpy(info.id, id, sizeof(info.id) - 1); + strncpy(info.name, name, sizeof(info.name) - 1); +- IOCTL_RETURN(0, &info); ++ fuse_reply_ioctl(req, 0, &info, sizeof(info)); ++ break; + } + + case OSS_GETVERSION: +@@ -737,16 +730,16 @@ static void mixer_simple_ioctl(fuse_req_t req, struct ossp_mixer *mixer, + goto puti; + puti: + PREP_UARG(NULL, &i); +- IOCTL_RETURN(0, &i); ++ fuse_reply_ioctl(req, 0, &i, sizeof(i)); ++ break; + + case SOUND_MIXER_WRITE_RECSRC: +- IOCTL_RETURN(0, NULL); ++ fuse_reply_ioctl(req, 0, NULL, 0); ++ break; + + default: + *not_minep = 1; +- return; + } +- assert(0); + } + + static void mixer_do_ioctl(fuse_req_t req, struct ossp_mixer *mixer, +@@ -787,7 +780,8 @@ static void mixer_do_ioctl(fuse_req_t req, struct ossp_mixer *mixer, + break; + default: + i = 0; +- IOCTL_RETURN(0, &i); ++ fuse_reply_ioctl(req, 0, &i, sizeof(i)); ++ return; + } + + init_mixer_cmd(&mxcmd, mixer); +@@ -837,7 +831,12 @@ static void mixer_do_ioctl(fuse_req_t req, struct ossp_mixer *mixer, + finish_mixer_cmd(&mxcmd); + free(osa); + +- IOCTL_RETURN(0, out_bufsz ? &mxcmd.rvol : NULL); ++ if (out_bufsz) ++ fuse_reply_ioctl(req, 0, &mxcmd.rvol, sizeof(mxcmd.rvol)); ++ else ++ fuse_reply_ioctl(req, 0, NULL, 0); ++ ++ return; + + err: + fuse_reply_err(req, -rc); +@@ -1510,7 +1509,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg, + case OSS_GETVERSION: + i = SNDRV_OSS_VERSION; + PREP_UARG(NULL, &i); +- IOCTL_RETURN(0, &i); ++ fuse_reply_ioctl(req, 0, &i, sizeof(i)); ++ break; + + case SNDCTL_DSP_GETCAPS: + i = DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | +@@ -1519,12 +1519,14 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg, + #endif + DSP_CAP_MULTI; + PREP_UARG(NULL, &i); +- IOCTL_RETURN(0, &i); ++ fuse_reply_ioctl(req, 0, &i, sizeof(i)); ++ break; + + case SNDCTL_DSP_NONBLOCK: + dsps->nonblock = 1; + ret = 0; +- IOCTL_RETURN(0, NULL); ++ fuse_reply_ioctl(req, 0, NULL, 0); ++ break; + + case SNDCTL_DSP_RESET: op = OSSP_DSP_RESET; goto nd; + case SNDCTL_DSP_SYNC: op = OSSP_DSP_SYNC; goto nd; +@@ -1533,7 +1535,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg, + ret = exec_simple_cmd(&dsps->os, op, NULL, NULL); + if (ret) + goto err; +- IOCTL_RETURN(0, NULL); ++ fuse_reply_ioctl(req, 0, NULL, 0); ++ break; + + case SOUND_PCM_READ_RATE: op = OSSP_DSP_GET_RATE; goto ri; + case SOUND_PCM_READ_BITS: op = OSSP_DSP_GET_FORMAT; goto ri; +@@ -1546,7 +1549,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg, + ret = exec_simple_cmd(&dsps->os, op, NULL, &i); + if (ret) + goto err; +- IOCTL_RETURN(0, &i); ++ fuse_reply_ioctl(req, 0, &i, sizeof(i)); ++ break; + + case SNDCTL_DSP_SPEED: op = OSSP_DSP_SET_RATE; goto wi; + case SNDCTL_DSP_SETFMT: op = OSSP_DSP_SET_FORMAT; goto wi; +@@ -1557,7 +1561,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg, + ret = exec_simple_cmd(&dsps->os, op, &i, &i); + if (ret) + goto err; +- IOCTL_RETURN(0, &i); ++ fuse_reply_ioctl(req, 0, &i, sizeof(i)); ++ break; + + case SNDCTL_DSP_STEREO: + PREP_UARG(NULL, &i); +@@ -1566,7 +1571,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg, + i--; + if (ret) + goto err; +- IOCTL_RETURN(0, &i); ++ fuse_reply_ioctl(req, 0, &i, sizeof(i)); ++ break; + + case SNDCTL_DSP_SETFRAGMENT: + PREP_UARG(&i, NULL); +@@ -1574,7 +1580,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg, + OSSP_DSP_SET_FRAGMENT, &i, NULL); + if (ret) + goto err; +- IOCTL_RETURN(0, NULL); ++ fuse_reply_ioctl(req, 0, NULL, 0); ++ break; + + case SNDCTL_DSP_SETTRIGGER: + PREP_UARG(&i, NULL); +@@ -1582,7 +1589,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg, + OSSP_DSP_SET_TRIGGER, &i, NULL); + if (ret) + goto err; +- IOCTL_RETURN(0, NULL); ++ fuse_reply_ioctl(req, 0, NULL, 0); ++ break; + + case SNDCTL_DSP_GETOSPACE: + case SNDCTL_DSP_GETISPACE: { +@@ -1603,7 +1611,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg, + ret = exec_simple_cmd(&dsps->os, op, NULL, &info); + if (ret) + goto err; +- IOCTL_RETURN(0, &info); ++ fuse_reply_ioctl(req, 0, &info, sizeof(info)); ++ break; + } + + case SNDCTL_DSP_GETOPTR: +@@ -1616,14 +1625,16 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg, + ret = exec_simple_cmd(&dsps->os, op, NULL, &info); + if (ret) + goto err; +- IOCTL_RETURN(0, &info); ++ fuse_reply_ioctl(req, 0, &info, sizeof(info)); ++ break; + } + + case SNDCTL_DSP_GETODELAY: + PREP_UARG(NULL, &i); + i = 0; + ret = exec_simple_cmd(&dsps->os, OSSP_DSP_GET_ODELAY, NULL, &i); +- IOCTL_RETURN(ret, &i); /* always copy out result, 0 on err */ ++ fuse_reply_ioctl(req, ret, &i, sizeof(i)); /* always copy out result, 0 on err */ ++ break; + + case SOUND_PCM_WRITE_FILTER: + case SOUND_PCM_READ_FILTER: +@@ -1638,14 +1649,16 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg, + case SNDCTL_DSP_SETSYNCRO: + case SNDCTL_DSP_SETDUPLEX: + case SNDCTL_DSP_PROFILE: +- IOCTL_RETURN(0, NULL); ++ fuse_reply_ioctl(req, 0, NULL, 0); ++ break; + + default: + warn_os(os, "unknown ioctl 0x%x", cmd); + ret = -EINVAL; + goto err; + } +- assert(0); /* control shouldn't reach here */ ++ return; ++ + err: + fuse_reply_err(req, -ret); + } diff --git a/debian/patches/Hack-to-work-with-modern-PulseAudio.patch b/debian/patches/Hack-to-work-with-modern-PulseAudio.patch new file mode 100644 index 0000000..25996cc --- /dev/null +++ b/debian/patches/Hack-to-work-with-modern-PulseAudio.patch @@ -0,0 +1,37 @@ +From: "Jan Alexander Steffens (heftig)" +Date: Fri, 18 Dec 2020 23:17:36 +0000 +Subject: [PATCH] Hack to work with modern PulseAudio + +--- + ossp-padsp.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/ossp-padsp.c b/ossp-padsp.c +index c505b57..b4ac097 100644 +--- a/ossp-padsp.c ++++ b/ossp-padsp.c +@@ -22,6 +22,8 @@ + #include + #include + #include ++#include ++#include + + #include + #include +@@ -1478,9 +1480,15 @@ static void action_post(void) + int main(int argc, char **argv) + { + int rc; ++ static char runtime_dir[PATH_MAX]; + + ossp_slave_init(argc, argv); + ++ snprintf(runtime_dir, sizeof runtime_dir, "/run/user/%llu", ++ (long long unsigned) getuid()); ++ if (access(runtime_dir, R_OK | X_OK) == 0) ++ setenv("XDG_RUNTIME_DIR", runtime_dir, 0); ++ + page_size = sysconf(_SC_PAGE_SIZE); + + mainloop = pa_threaded_mainloop_new(); diff --git a/debian/patches/series b/debian/patches/series index 521cc6b..03f1d68 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -5,3 +5,6 @@ 0005-Add-pthread-compiler-and-linker-flag.patch 0006-fix-build-on-MIPS.patch 0007-cross.patch +GIT-fix-adsp_se.patch +GIT-fix-compiler-warnings.patch +Hack-to-work-with-modern-PulseAudio.patch -- 2.30.2