diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -99,7 +99,6 @@ static int dsp_oss_setlabel(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_label_t *label); static int dsp_oss_getsong(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_longname_t *song); static int dsp_oss_setsong(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_longname_t *song); -static int dsp_oss_setname(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_longname_t *name); #endif static uint32_t @@ -1873,6 +1872,30 @@ case SNDCTL_DSP_BIND_CHANNEL: /* XXX what?!? */ ret = EINVAL; break; + case SNDCTL_SETNAME: + { + char *s; + size_t len; + + s = *(oss_longname_t *)arg; + len = strnlen(s, sizeof(oss_longname_t)); + if (s[len] != '\0') + ret = EINVAL; + else { + for (len--; len; len--) { + if (!isprint(s[len])) { + ret = EINVAL; + break; + } + } + } + if (ret == 0) { + PCM_ACQUIRE_QUICK(d); + device_set_desc_copy(d->dev, s); + PCM_RELEASE_QUICK(d); + } + } + break; #ifdef OSSV4_EXPERIMENT /* * XXX The following ioctls are not yet supported and just return @@ -1915,9 +1938,6 @@ case SNDCTL_SETSONG: ret = dsp_oss_setsong(wrch, rdch, (oss_longname_t *)arg); break; - case SNDCTL_SETNAME: - ret = dsp_oss_setname(wrch, rdch, (oss_longname_t *)arg); - break; #if 0 /** * @note The S/PDIF interface ioctls, @c SNDCTL_DSP_READCTL and @@ -2975,33 +2995,4 @@ { return (EINVAL); } - -/** - * @brief Rename a device - * - * This is a handler for the @c SNDCTL_SETNAME ioctl. - * - * See @c http://manuals.opensound.com/developer/SNDCTL_SETNAME.html for - * more details. - * - * From Hannu@4Front: "This call is used to change the device name - * reported in /dev/sndstat and ossinfo. So instead of using some generic - * 'OSS loopback audio (MIDI) driver' the device may be given a meaningfull - * name depending on the current context (for example 'OSS virtual wave table - * synth' or 'VoIP link to London')." - * - * @note As the ioctl definition is still under construction, FreeBSD - * does not currently support SNDCTL_SETNAME. - * - * @param wrch playback channel (optional; may be NULL) - * @param rdch recording channel (optional; may be NULL) - * @param name new device name gets copied from here - * - * @retval EINVAL Operation not yet supported. - */ -static int -dsp_oss_setname(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_longname_t *name) -{ - return (EINVAL); -} #endif /* !OSSV4_EXPERIMENT */