Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152924672
D31320.id92917.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D31320.id92917.diff
View Options
diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h
--- a/sys/dev/sound/pcm/sound.h
+++ b/sys/dev/sound/pcm/sound.h
@@ -411,6 +411,10 @@
void sound_oss_sysinfo(oss_sysinfo *);
int sound_oss_card_info(oss_card_info *);
+#define PCM_MODE_NONE 0x01
+#define PCM_MODE_PLAY 0x02
+#define PCM_MODE_REC 0x04
+
#define PCM_LOCKOWNED(d) mtx_owned((d)->lock)
#define PCM_LOCK(d) mtx_lock((d)->lock)
#define PCM_UNLOCK(d) mtx_unlock((d)->lock)
diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -1012,12 +1012,30 @@
"global clone garbage collector");
#endif
+static u_int8_t
+pcm_mode_init(struct snddev_info *d)
+{
+ u_int8_t mode = 0;
+
+ if (d->playcount > 0)
+ mode |= PCM_MODE_PLAY;
+ if (d->reccount > 0)
+ mode |= PCM_MODE_REC;
+ if (d->playcount == 0 && d->reccount == 0)
+ mode = PCM_MODE_NONE;
+
+ return (mode);
+}
+
static void
pcm_sysinit(device_t dev)
{
struct snddev_info *d = device_get_softc(dev);
+ u_int8_t mode;
+
+ mode = pcm_mode_init(d);
- /* XXX: an user should be able to set this with a control tool, the
+ /* XXX: a user should be able to set this with a control tool, the
sysadmin then needs min+max sysctls for this */
SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
@@ -1027,6 +1045,10 @@
"bitperfect", CTLTYPE_INT | CTLFLAG_RWTUN, d, sizeof(d),
sysctl_dev_pcm_bitperfect, "I",
"bit-perfect playback/recording (0=disable, 1=enable)");
+ SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
+ SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+ OID_AUTO, "mode", CTLFLAG_RD, NULL, mode,
+ "mode (1=none, 2=play, 4=rec, 6=play+rec)");
#ifdef SND_DEBUG
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
@@ -1130,7 +1152,7 @@
sysctl_ctx_init(&d->rec_sysctl_ctx);
d->rec_sysctl_tree = SYSCTL_ADD_NODE(&d->rec_sysctl_ctx,
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "rec",
- CTLFLAG_RD, 0, "record channels node");
+ CTLFLAG_RD, 0, "recording channels node");
if (numplay > 0 || numrec > 0)
d->flags |= SD_F_AUTOVCHAN;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 2:34 AM (16 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31742907
Default Alt Text
D31320.id92917.diff (2 KB)
Attached To
Mode
D31320: sound(4): implement playback/recording mode sysctl
Attached
Detach File
Event Timeline
Log In to Comment