Submit #2682

Fix for uaudio driver, so it can be used on DragonFly

Added by shamaz about 2 years ago. Updated over 1 year ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:profmakx% Done:


Target version:3.9.x


Hello. A new uaudio driver for usb4bsd (sys/bus/u4b/audio) needs some care
and love. Currently it can only probe audio devices, that is all. So I
propose a patch which makes this driver useful.

What works: playback with different audio formats and sample rates (8/16
bit pcm, 44.1kHz, 8kHz and so on). Up to 2 channels (what most people need
;). Module loading/unloading.
What does not: multichannel environments, mixer master output level ("vol")
affects only left channel, I really do not know why.
What was not tested: recording

Is it good enough to be committed?

With best regards, Vasily.

uaudio.patch Magnifier (3.47 KB) shamaz, 06/08/2014 11:19 AM

uaudio.patch Magnifier (7.07 KB) shamaz, 06/09/2014 10:02 AM

uaudio.patch Magnifier (6.33 KB) shamaz, 07/02/2014 09:37 AM


#1 Updated by profmakx about 2 years ago

Can you please make sure that the mixer is properly protected using snd_mtxlock/snd_mtxunlock when modifying it?

#2 Updated by profmakx about 2 years ago

I also get the following errors when I try building with the patch applied:

/home/makx/src/sys/bus/u4b/audio/uaudio_pcm.c:76:1: error: 'ua_chan_setfragments' defined but not used [-Werror=unused-function]
/home/makx/src/sys/bus/u4b/audio/uaudio_pcm.c:107:1: error: 'ua_chan_getmatrix' defined but not used [-Werror=unused-function]
cc1: all warnings being treated as errors
*** [uaudio_pcm.o] Error code 1

#3 Updated by profmakx about 2 years ago

  • Assignee set to profmakx

#4 Updated by shamaz about 2 years ago

Here is the new patch. It fixes mixer problem (so you can control volume of both channels). Please note, that it affects both pcm (sound) and uaudio drivers. Also, MIXER_UNINIT is called with mixer lock released now, as it is in FreeBSD. Is it ok? Or maybe do I need to release/unsetup usb transfer/acquire mixer lock in mixer_uninit method explicitly?

#5 Updated by jorisgio about 2 years ago

  • Tracker changed from Bug to Submit
  • Category set to Kernel
  • Target version set to 3.9.x

#6 Updated by shamaz about 2 years ago

This is a variation I use now, if someone is still interested. I moved new functionality from pcm driver to uaudio (only round_bufdz in dev/sound/pcm/channel.c was left modified to accept any values of min and max, not just power of 2). Now I am sure it will not break anything else.

#7 Updated by profmakx about 2 years ago


I haven't forgotten about your patch, I am just rather busy fumbling with other issues at the moment. I'll integrate it this weekend. Cheers for submitting!

#8 Updated by profmakx almost 2 years ago

  • Status changed from New to Feedback

I applied your patch to master.

#9 Updated by dragonflybsd1 over 1 year ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF