https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246206
Bug ID: 246206 Summary: dev/sound: SNDCTL_SYSINFO does not report PCM_CAP_VIRTUAL Product: Base System Version: 12.1-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: b...@freebsd.org Reporter: kevinz5...@gmail.com Attachment #214136 text/plain mime type: Created attachment 214136 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=214136&action=edit Demonstration of issue In sys/soundcard.h, PCM_CAP_VIRTUAL is documented as "Virtual device": # define PCM_CAP_VIRTUAL 0x00040000 /* Virtual device */ When SNDCTL_AUDIOINFO is called on /dev/mixer, no virtual devices have have PCM_CAP_VIRTUAL set. This means, apart from being smart, consumers of the OSS4 API can't tell virtual devices from real devices. This leads to a confusing choice in, say, audio programs that allow selection of vchans. A short example program that demonstrates the issue is attached. Example output on my computer is: $ clang vpctest.c -o vpctest $ ./vpctest dev /dev/dsp0.p0 virtual 0 dev /dev/dsp0.vp0 virtual 0 dev /dev/dsp0.vp1 virtual 0 dev /dev/dsp0.r0 virtual 0 dev /dev/dsp0.vr0 virtual 0 dev /dev/dsp0.vr1 virtual 0 The vp* and vr* devices are virtual, but PCM_CAP_VIRTUAL is not set. The root cause of this issue appears to be in dev/sound/pcm/dsp.c: ai->caps = PCM_CAP_REALTIME | PCM_CAP_MMAP | PCM_CAP_TRIGGER | CHANNEL_GETCAPS(ch) ((ch->direction == PCMDIR_PLAY) ? PCM_CAP_OUTPUT : PCM_CAP_INPUT); Most notably, PCM_CAP_VIRTUAL is never set. Further, the channel capabilities queried earlier: caps = chn_getcaps(ch); Do not appear to be used, either. I suggest that virtual channels return PCM_CAP_VIRTUAL in vchan_getcaps() (dev/sound/pcm/vchan.c), and then channel capabilities get OR'ed into ai->caps. -- You are receiving this mail because: You are the assignee for the bug. _______________________________________________ freebsd-bugs@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"