Support mixer_idx with OSS
Patch status: superseded
Patch by Baptiste Daroussin
To apply this patch, use:
curl http://cr.i3wm.org/patch/92/raw.patch | git am
b/src/print_volume.c
| 13 |
@@ -175,12 +175,16 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char * |
| 14 |
} |
| 15 |
#endif |
| 16 |
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) |
| 17 |
- char mixerpath[] = "/dev/mixer"; |
| 18 |
+ char *mixerpath; |
| 19 |
int mixfd, vol, devmask = 0; |
| 20 |
pbval = 1; |
| 21 |
|
| 22 |
+ asprintf(&mixerpath, "/dev/mixer%d", mixer_idx); |
| 23 |
+ |
| 24 |
if ((mixfd = open(mixerpath, O_RDWR)) < 0) |
| 25 |
return; |
| 26 |
+ |
| 27 |
+ free(mixerpath); |
| 28 |
if (ioctl(mixfd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) |
| 29 |
return; |
| 30 |
if (ioctl(mixfd, MIXER_READ(0),&vol) == -1) |