summaryrefslogtreecommitdiff
path: root/setmixer
diff options
context:
space:
mode:
Diffstat (limited to 'setmixer')
-rw-r--r--setmixer/devfs.patch25
-rw-r--r--setmixer/setmixer.patch78
2 files changed, 103 insertions, 0 deletions
diff --git a/setmixer/devfs.patch b/setmixer/devfs.patch
index e69de29bb2..d2b5c82df8 100644
--- a/setmixer/devfs.patch
+++ b/setmixer/devfs.patch
@@ -0,0 +1,25 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- setmixer-27DEC94.orig/setmixer.c~devfs
++++ setmixer-27DEC94.orig/setmixer.c
+@@ -27,7 +27,7 @@
+ #include <sys/ioctl.h>
+ #include <sys/soundcard.h>
+
+-#define MIXER "/dev/mixer"
++#define MIXER "/dev/sound/mixer"
+
+ const char * dname[] = SOUND_DEVICE_NAMES;
+
+@@ -65,7 +65,7 @@
+ }
+
+ if ((mixer_fd = open(MIXER, O_RDWR)) < 0) {
+- fprintf(stderr, "Error opening /dev/mixer.");
++ fprintf(stderr, "Error opening /dev/sound/mixer.");
+ exit(1);
+ }
+ if (ioctl(mixer_fd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) {
diff --git a/setmixer/setmixer.patch b/setmixer/setmixer.patch
index e69de29bb2..535ba3b082 100644
--- a/setmixer/setmixer.patch
+++ b/setmixer/setmixer.patch
@@ -0,0 +1,78 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- setmixer-27DEC94.orig/Makefile~setmixer
++++ setmixer-27DEC94.orig/Makefile
+@@ -1,8 +1,8 @@
+ DESTDIR =
+ INSTALL = install
+ CC=gcc
+-CFLAGS= -O6 -fomit-frame-pointer -Wall -pipe -m486
+-LDFLAGS= -Xlinker -N -s
++CFLAGS= -O2 -fomit-frame-pointer -Wall -pipe
++#LDFLAGS= -Xlinker -N -s
+ PROG=setmixer
+
+ $(PROG): setmixer.o
+--- setmixer-27DEC94.orig/setmixer.c~setmixer
++++ setmixer-27DEC94.orig/setmixer.c
+@@ -36,7 +36,7 @@
+
+ int devmask, stereod, i, d;
+ int mixer_fd;
+- int lcval,rcval;
++ int lcval,rcval,oldlcval,oldrcval,val;
+ int verbose = 0;
+ size_t len;
+ char *endptr;
+@@ -52,9 +52,9 @@
+ }
+ }
+
+- if (!verbose && ((argc <= 0) || (argc & 1))) {
++ if ((!verbose && ((argc <= 0) || (argc & 1))) || (verbose && argc % 2)) {
+ fprintf(stderr, "usage: %s [-V] cntrl val [cntrl val ....]\n"
+- "where val is in 0-100 range and 'cntrl' is one of the following:\n\t",
++ "where val is in [+-]0-100 range and 'cntrl' is one of the following:\n\t",
+ prog);
+ for (i = 0; i < SOUND_MIXER_NRDEVICES; i++)
+ fprintf(stderr, "%s ", dname[i]);
+@@ -84,16 +84,36 @@
+
+ while (argc) {
+ cntrl = *argv++;
++ oldlcval = (('+' == **argv) || ('-' == **argv));
+ lcval = strtol(*argv++, &endptr, 0);
+ if (',' == *endptr) {
+ endptr += 1;
++ oldrcval = (('+' == *endptr) || ('-' == *endptr));
+ rcval = strtol((const char *)endptr, 0, 0);
+ }
+ else {
+ rcval = lcval;
++ oldrcval = oldlcval;
+ }
+ argc -= 2;
+ len = strlen(cntrl);
++ if (oldlcval || oldrcval) {
++ for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
++ if (0 == strncmp(dname[i], cntrl, len)) {
++ d = (1 << i);
++ if (0 != (devmask & d)) {
++ if (-1 == ioctl(mixer_fd, MIXER_READ(i), &val)) {
++ perror("MIXER_READ");
++ }
++ else {
++ lcval += oldlcval ? (val & 0x7f) : 0;
++ rcval += oldrcval ? ((val >> 8) & 0x7f) : 0;
++ }
++ }
++ break;
++ }
++ }
++ }
+ for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
+ if (0 == strncmp(dname[i], cntrl, len)) {
+ d = (1 << i);