/dev/sound
Now that /dev/sound is gone, should AUDIO_DEV_SOUND be removed from audio.c ? Jan Index: audio.c === RCS file: /cvs/src/sys/dev/audio.c,v retrieving revision 1.161 diff -u -p -r1.161 audio.c --- audio.c 11 Mar 2017 10:12:45 - 1.161 +++ audio.c 26 Mar 2017 11:40:52 - @@ -50,7 +50,6 @@ #define DEVNAME(sc)((sc)->dev.dv_xname) #define AUDIO_UNIT(n) (minor(n) & 0x0f) #define AUDIO_DEV(n) (minor(n) & 0xf0) -#define AUDIO_DEV_SOUND0 /* minor of /dev/sound0 */ #define AUDIO_DEV_MIXER0x10/* minor of /dev/mixer0 */ #define AUDIO_DEV_AUDIO0x80/* minor of /dev/audio0 */ #define AUDIO_DEV_AUDIOCTL 0xc0/* minor of /dev/audioctl */ @@ -1137,7 +1136,6 @@ audio_detach(struct device *self, int fl * close uses device_lookup, it returns EXIO and does nothing */ mn = self->dv_unit; - vdevgone(maj, mn | AUDIO_DEV_SOUND, mn | AUDIO_DEV_SOUND, VCHR); vdevgone(maj, mn | AUDIO_DEV_AUDIO, mn | AUDIO_DEV_AUDIO, VCHR); vdevgone(maj, mn | AUDIO_DEV_AUDIOCTL, mn | AUDIO_DEV_AUDIOCTL, VCHR); vdevgone(maj, mn | AUDIO_DEV_MIXER, mn | AUDIO_DEV_MIXER, VCHR); @@ -1608,7 +1606,6 @@ audioopen(dev_t dev, int flags, int mode error = ENXIO; else { switch (AUDIO_DEV(dev)) { - case AUDIO_DEV_SOUND: case AUDIO_DEV_AUDIO: error = audio_open(sc, flags); break; @@ -1634,7 +1631,6 @@ audioclose(dev_t dev, int flags, int ifm if (sc == NULL) return ENXIO; switch (AUDIO_DEV(dev)) { - case AUDIO_DEV_SOUND: case AUDIO_DEV_AUDIO: error = audio_close(sc); break; @@ -1659,7 +1655,6 @@ audioread(dev_t dev, struct uio *uio, in if (sc == NULL) return ENXIO; switch (AUDIO_DEV(dev)) { - case AUDIO_DEV_SOUND: case AUDIO_DEV_AUDIO: error = audio_read(sc, uio, ioflag); break; @@ -1684,7 +1679,6 @@ audiowrite(dev_t dev, struct uio *uio, i if (sc == NULL) return ENXIO; switch (AUDIO_DEV(dev)) { - case AUDIO_DEV_SOUND: case AUDIO_DEV_AUDIO: error = audio_write(sc, uio, ioflag); break; @@ -1709,7 +1703,6 @@ audioioctl(dev_t dev, u_long cmd, caddr_ if (sc == NULL) return ENXIO; switch (AUDIO_DEV(dev)) { - case AUDIO_DEV_SOUND: case AUDIO_DEV_AUDIO: error = audio_ioctl(sc, cmd, addr); break; @@ -1744,7 +1737,6 @@ audiopoll(dev_t dev, int events, struct if (sc == NULL) return POLLERR; switch (AUDIO_DEV(dev)) { - case AUDIO_DEV_SOUND: case AUDIO_DEV_AUDIO: revents = audio_poll(sc, events, p); break;
Re: remove /dev/sound*
On Thu, Sep 08, 2016 at 08:22:16AM +0100, Stuart Henderson wrote: > On 2016/09/08 13:47, Michael W. Bombardieri wrote: > > Hi Alexandre, > > > > Do you know if any applications in ports use /dev/sound as default audio > > device. > > Maybe they are not smart enough to try /dev/audio if /dev/sound fails. > > Here are search results - there are false positoves from /dev/sound/XX > from Linux, and possibly others from Solaris, so needs further checking. > Thanks for the list; indeed the /dev/sound/xxx don't matter. The one that metter are all false positives as well. > $ ag /dev/sound > ports/x11/mplayer/patches/patch-stream_tvi_bsdbt848_c > 82: priv->dspdev = strdup("/dev/sound"); this one is disabled with #ifdef > u/libmikmod-3.3.8/libmikmod-3.3.8/drivers/drv_sun.c > 83:#define SOUNDDEVICE "/dev/sound" this is the sun backend but we use sndio > u/sidplay-1.0.9/sidplay-base-1.0.9/audio/oss/audiodrv.cpp > 10:const char audioDriver::AUDIODEVICE[] = "/dev/sound"; this is the oss backend, we use sndio > u/soundtracker-0.6.8/soundtracker-0.6.8.gtk2/Makefile.am same here > u/xmp-4.0.10/xmp-4.0.10/src/sound_bsd.c > 39: if ((audio_fd = open("/dev/sound", O_WRONLY)) == -1) same here > u/ptlib-2.12.9/ptlib-2.12.9/plugins/sound_oss/sound_oss.cxx > 220: PDirectory devdir = "/dev/sound"; same here > u/sdl2-2.0.4/SDL2-2.0.4/src/audio/SDL_audiodev.c > 43:#define _PATH_DEV_DSP24 "/dev/sound/dsp" > 92:/* Added support for /dev/sound/\* in Linux 2.4 */ > 93:if (((stat("/dev/sound", ) == 0) && S_ISDIR(sb.st_mode)) same here > u/frotz-2.44/frotz-2.44/Makefile > 51:#SOUND_DEV = /dev/sound uses oss, sound disabled > u/ufoai-2.5-source/ufoai-2.5-source/src/libs/SDL/src/audio/SDL_audiodev.c > 91:if (((stat("/dev/sound", ) == 0) && S_ISDIR(sb.st_mode)) > comes with its own copy of sdl (which contains sndio) > u/uhexen2-1.5.6/hexen2source-1.5.6/engine/h2shared/snd_sun.c > 106: snddev = "/dev/sound"; this is the sun backend, but we use sdl > u/warmux-11.04.1/warmux-11.04/build/android/jni/sdl/src/audio/SDL_audiodev.c > 43:#define _PATH_DEV_DSP24 "/dev/sound/dsp" > 64: /* Added support for /dev/sound/\* in Linux 2.4 */ > 65: if ( ((stat("/dev/sound", ) == 0) && > S_ISDIR(sb.st_mode)) && comes with a copy of sdl for android; we use OpenBSD sdl port > u/mpv-0.17.0/mpv-0.17.0/wscript > 536: defines=['PATH_DEV_DSP="/dev/sound"', this is the script to detect oss, we use sndio > u/arts-1.5.10/arts-1.5.10/flow/audioiooss.cc > 103: "/dev/sound", /* NetBSD*/ this is oss backend, we use sndio > u/mplayer-20160306/mplayer-20160306/configure > 5821: def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/sound"' same here
Re: remove /dev/sound*
On Thu, Sep 08, 2016 at 01:47:02PM +0800, Michael W. Bombardieri wrote: > Hi Alexandre, > > Do you know if any applications in ports use /dev/sound as default audio > device. > Maybe they are not smart enough to try /dev/audio if /dev/sound fails. > Hi, I'm not aware of any port using /dev/sound* or /dev/audio*; all use libsndio, which in turn uses /dev/audio* If you're aware of anything possibly using this, I'm interested.
Re: remove /dev/sound*
On 2016/09/08 13:47, Michael W. Bombardieri wrote: > Hi Alexandre, > > Do you know if any applications in ports use /dev/sound as default audio > device. > Maybe they are not smart enough to try /dev/audio if /dev/sound fails. Here are search results - there are false positoves from /dev/sound/XX from Linux, and possibly others from Solaris, so needs further checking. $ ag /dev/sound ports/x11/mplayer/patches/patch-stream_tvi_bsdbt848_c 82: priv->dspdev = strdup("/dev/sound"); u/akode-2.0.2/akode-2.0.2/akode/plugins/oss_sink/oss_sink.cpp 59:"/dev/sound/dsp0", u/cmus-2.7.1/cmus-2.7.1/mixer_oss.c 131: const char *new_mixer_dev = "/dev/sound/mixer"; u/cmus-2.7.1/cmus-2.7.1/oss.c 145: const char *new_dsp_dev = "/dev/sound/dsp"; u/libao-1.2.0/libao-1.2.0/src/plugins/sun/ao_sun.c 163: sprintf(buf,"/dev/sound/%d",internal->id); u/libao-1.2.0/libao-1.2.0/src/plugins/oss/ao_oss.c 93: sprintf(buf,"/dev/sound/dsp%d",id); 97: if(!(*dev_path = strdup("/dev/sound/dsp"))) u/libmikmod-3.3.8/libmikmod-3.3.8/drivers/drv_oss.c 148: sprintf(sounddevice,"/dev/sound/dsp%d",card); 150: strcpy(sounddevice,"/dev/sound/dsp"); u/libmikmod-3.3.8/libmikmod-3.3.8/drivers/drv_sun.c 83:#define SOUNDDEVICE "/dev/sound" u/libsndfile-1.0.26/libsndfile-1.0.26/ChangeLog 5624:using devfs which used /dev/sound/dsp instead of /dev/dsp. u/libsndfile-1.0.26/libsndfile-1.0.26/programs/sndfile-play.c 437: (fd = open ("/dev/sound/dsp", O_WRONLY, 0)) == -1) u/madplay-0.15.2b/madplay-0.15.2b/audio_oss.c 77:# define AUDIO_DEVICE1"/dev/sound/dsp" u/madplay-0.15.2b/madplay-0.15.2b/CREDITS 135: - Suggested trying /dev/sound/dsp before /dev/dsp. u/mpd-0.19.15/mpd-0.19.15/src/output/plugins/OssOutputPlugin.cxx 127:static const char *default_devices[] = { "/dev/sound/dsp", "/dev/dsp" }; u/mpg123-1.23.4/mpg123-1.23.4/src/libout123/modules/oss.c 171: dev = "/dev/sound/dsp"; u/mpg321-0.3.2/mpg321-0.3.2-orig/mpg321.1 40:(or the default system device) to use for output (i.e. \fB/dev/sound/dsp1\fP). u/schismtracker-20150425/schismtracker-20150425/sys/oss/volume-oss.c 61:ptr = "/dev/sound/mixer"; u/sidplay-1.0.9/sidplay-base-1.0.9/audio/oss/audiodrv.cpp 10:const char audioDriver::AUDIODEVICE[] = "/dev/sound"; u/snack2.2.10/snack2.2.10/unix/jkAudIO_oss.c 433:defaultDeviceName = "/dev/sound/dsp"; 1000: glob("/dev/sound/dsp*", GLOB_APPEND, NULL, ); 1001: glob("/dev/sound/audio*", GLOB_APPEND, NULL, ); 1020: glob("/dev/sound/mixer*", GLOB_APPEND, NULL, ); u/soundtracker-0.6.8/soundtracker-0.6.8.gtk2/Makefile.am 37: cp soundtracker-$(VERSION).tar.gz /home/rawstyle/dev/soundtracker-WWW/dl/v0.6/ 39:# cp soundtracker-$(VERSION)-bin.tar.gz /home/rawstyle/dev/soundtracker-WWW/dl/v0.6/ 40: /home/rawstyle/dev/soundtracker/bin/rpm -tb soundtracker-$(VERSION).tar.gz 41: cp /usr/src/packages/RPMS/i386/soundtracker-$(VERSION)-* /home/rawstyle/dev/soundtracker-WWW/dl/v0.6/ 42: chown -R rawstyle.users /home/rawstyle/dev/soundtracker/* 43: chown -R rawstyle.users /home/rawstyle/dev/soundtracker-WWW/* u/xmms-1.2.11/xmms-1.2.11/Output/solaris/configure.c 116: gchar *devname = g_strdup_printf("/dev/sound/%d", index); u/xmp-4.0.10/xmp-4.0.10/src/sound_bsd.c 39: if ((audio_fd = open("/dev/sound", O_WRONLY)) == -1) u/xmp-4.0.10/xmp-4.0.10/src/sound_oss.c 10: * devfs /dev/sound/dsp support by Dirk Jagdmann 112: static const char *dev_audio[] = { "/dev/dsp", "/dev/sound/dsp" }; u/xmp-4.0.10/xmp-4.0.10/src/sound_netbsd.c 39: if ((audio_fd = open("/dev/sound", O_WRONLY)) == -1) u/jdk-1.7.0.80/openjdk/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_Utils.c 106:// then go through all of the /dev/sound/? devices 108:sprintf(devsound, "/dev/sound/%d", i); u/jdk-1.7.0.80/openjdk/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_Utils.c.orig.u80 106:// then go through all of the /dev/sound/? devices 108:sprintf(devsound, "/dev/sound/%d", i); u/jdk-1.8.0.72/openjdk-8u72b15-bsd-port-20160220/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_Utils.c 106:// then go through all of the /dev/sound/? devices 108:sprintf(devsound, "/dev/sound/%d", i); u/ptlib-2.12.9/ptlib-2.12.9/plugins/sound_oss/sound_oss.cxx 220: PDirectory devdir = "/dev/sound"; 222:CollectSoundDevices("/dev/sound", dsp, mixer, true); // use names (devfs) u/sdl-1.2.15/SDL-1.2.15/src/audio/SDL_audiodev.c 43:#define _PATH_DEV_DSP24 "/dev/sound/dsp" 64: /* Added support for /dev/sound/\* in Linux 2.4 */ 65:
Re: remove /dev/sound*
Hi Alexandre, Do you know if any applications in ports use /dev/sound as default audio device. Maybe they are not smart enough to try /dev/audio if /dev/sound fails. - Michael On Thu, Sep 08, 2016 at 08:12:45AM +0200, Alexandre Ratchov wrote: > As audio(4) manual says "In all respects /dev/audio and /dev/sound > are identical". Only one of them is needed and this diff is to > remove /dev/sound. > > OK? > > Index: etc/MAKEDEV.common > === > RCS file: /cvs/src/etc/MAKEDEV.common,v > retrieving revision 1.91 > diff -u -p -u -p -r1.91 MAKEDEV.common > --- etc/MAKEDEV.common4 Sep 2016 15:38:59 - 1.91 > +++ etc/MAKEDEV.common8 Sep 2016 05:48:20 - > @@ -418,13 +418,11 @@ _mkdev(acpi, acpi*, {-M acpic major_acp > __devitem(pctr, pctr*, PC Performance Tuning Register access device)dnl > _mkdev(pctr, pctr, {-M pctr c major_pctr_c 0 644-})dnl > __devitem(au, audio*, Audio devices,audio)dnl > -_mkdev(au, audio*, {-M sound$U c major_au_c $U > +_mkdev(au, audio*, {-M audio$U c major_au_c $U > M mixer$U c major_au_c Add($U, 16) > - M audio$U c major_au_c Add($U, 128) > M audioctl$Uc major_au_c Add($U, 192) > MKlist[${#MKlist[*]}]=";[ -e audio ] || ln -s audio$U audio" > MKlist[${#MKlist[*]}]=";[ -e mixer ] || ln -s mixer$U mixer" > - MKlist[${#MKlist[*]}]=";[ -e sound ] || ln -s sound$U sound" > MKlist[${#MKlist[*]}]=";[ -e audioctl ] || ln -s audioctl$U > audioctl"-})dnl > __devitem(vi, video*, Video V4L2 devices,video)dnl > _mkdev(vi, video*, {-M video$U c major_vi_c $U 600 > Index: share/man/man4/audio.4 > === > RCS file: /cvs/src/share/man/man4/audio.4,v > retrieving revision 1.74 > diff -u -p -u -p -r1.74 audio.4 > --- share/man/man4/audio.48 Sep 2016 05:18:20 - 1.74 > +++ share/man/man4/audio.48 Sep 2016 05:48:20 - > @@ -53,14 +53,11 @@ underlying hardware configuration suppor > .Pp > There are four device files available for audio operation: > .Pa /dev/audio , > -.Pa /dev/sound , > .Pa /dev/audioctl , > and > .Pa /dev/mixer . > .Pa /dev/audio > -and > -.Pa /dev/sound > -are used for recording or playback of digital samples. > +is used for recording or playback of digital samples. > .Pa /dev/mixer > is used to manipulate volume, recording source, or other audio mixer > functions. > @@ -68,10 +65,10 @@ functions. > accepts the same > .Xr ioctl 2 > operations as > -.Pa /dev/sound , > +.Pa /dev/audio , > but no other operations. > In contrast to > -.Pa /dev/sound , > +.Pa /dev/audio , > which has the exclusive open property, > .Pa /dev/audioctl > can be opened at any time and can be used to read the > @@ -80,18 +77,11 @@ device variables while it is in use. > .Sh SAMPLING DEVICES > When > .Pa /dev/audio > -or > -.Pa /dev/sound > is opened, it attempts to maintain the previous audio sample format and > record/playback mode. > In addition, if it is opened read-only > (write-only) the device is set to half-duplex record (play) mode with > recording (playing) unpaused. > -In all respects > -.Pa /dev/audio > -and > -.Pa /dev/sound > -are identical. > .Pp > Only one process may hold open a sampling device at a given time > (although file descriptors may be shared between processes once the > @@ -514,7 +504,6 @@ string values. > .Bl -tag -width /dev/audioctl -compact > .It Pa /dev/audio > .It Pa /dev/audioctl > -.It Pa /dev/sound > .It Pa /dev/mixer > .El > .Sh SEE ALSO >
remove /dev/sound*
As audio(4) manual says "In all respects /dev/audio and /dev/sound are identical". Only one of them is needed and this diff is to remove /dev/sound. OK? Index: etc/MAKEDEV.common === RCS file: /cvs/src/etc/MAKEDEV.common,v retrieving revision 1.91 diff -u -p -u -p -r1.91 MAKEDEV.common --- etc/MAKEDEV.common 4 Sep 2016 15:38:59 - 1.91 +++ etc/MAKEDEV.common 8 Sep 2016 05:48:20 - @@ -418,13 +418,11 @@ _mkdev(acpi, acpi*, {-M acpi c major_acp __devitem(pctr, pctr*, PC Performance Tuning Register access device)dnl _mkdev(pctr, pctr, {-M pctr c major_pctr_c 0 644-})dnl __devitem(au, audio*, Audio devices,audio)dnl -_mkdev(au, audio*, {-M sound$U c major_au_c $U +_mkdev(au, audio*, {-M audio$U c major_au_c $U M mixer$U c major_au_c Add($U, 16) - M audio$U c major_au_c Add($U, 128) M audioctl$Uc major_au_c Add($U, 192) MKlist[${#MKlist[*]}]=";[ -e audio ] || ln -s audio$U audio" MKlist[${#MKlist[*]}]=";[ -e mixer ] || ln -s mixer$U mixer" - MKlist[${#MKlist[*]}]=";[ -e sound ] || ln -s sound$U sound" MKlist[${#MKlist[*]}]=";[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl __devitem(vi, video*, Video V4L2 devices,video)dnl _mkdev(vi, video*, {-M video$U c major_vi_c $U 600 Index: share/man/man4/audio.4 === RCS file: /cvs/src/share/man/man4/audio.4,v retrieving revision 1.74 diff -u -p -u -p -r1.74 audio.4 --- share/man/man4/audio.4 8 Sep 2016 05:18:20 - 1.74 +++ share/man/man4/audio.4 8 Sep 2016 05:48:20 - @@ -53,14 +53,11 @@ underlying hardware configuration suppor .Pp There are four device files available for audio operation: .Pa /dev/audio , -.Pa /dev/sound , .Pa /dev/audioctl , and .Pa /dev/mixer . .Pa /dev/audio -and -.Pa /dev/sound -are used for recording or playback of digital samples. +is used for recording or playback of digital samples. .Pa /dev/mixer is used to manipulate volume, recording source, or other audio mixer functions. @@ -68,10 +65,10 @@ functions. accepts the same .Xr ioctl 2 operations as -.Pa /dev/sound , +.Pa /dev/audio , but no other operations. In contrast to -.Pa /dev/sound , +.Pa /dev/audio , which has the exclusive open property, .Pa /dev/audioctl can be opened at any time and can be used to read the @@ -80,18 +77,11 @@ device variables while it is in use. .Sh SAMPLING DEVICES When .Pa /dev/audio -or -.Pa /dev/sound is opened, it attempts to maintain the previous audio sample format and record/playback mode. In addition, if it is opened read-only (write-only) the device is set to half-duplex record (play) mode with recording (playing) unpaused. -In all respects -.Pa /dev/audio -and -.Pa /dev/sound -are identical. .Pp Only one process may hold open a sampling device at a given time (although file descriptors may be shared between processes once the @@ -514,7 +504,6 @@ string values. .Bl -tag -width /dev/audioctl -compact .It Pa /dev/audio .It Pa /dev/audioctl -.It Pa /dev/sound .It Pa /dev/mixer .El .Sh SEE ALSO