Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170660808
D31320.id92793.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.id92793.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_STATUS_NONE 0x00
+#define PCM_STATUS_PLAY 0x01
+#define PCM_STATUS_REC 0x02
+
#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,28 @@
"global clone garbage collector");
#endif
+static u_int8_t
+pcm_status_init(struct snddev_info *d)
+{
+ u_int8_t status = PCM_STATUS_NONE;
+
+ if (d->playcount > 0)
+ status |= PCM_STATUS_PLAY;
+ if (d->reccount > 0)
+ status |= PCM_STATUS_REC;
+
+ return (status);
+}
+
static void
pcm_sysinit(device_t dev)
{
struct snddev_info *d = device_get_softc(dev);
+ u_int8_t status;
+
+ status = pcm_status_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 +1043,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, "status", CTLFLAG_RD, NULL, status,
+ "playback/recording status (0=none, 1=play, 2=rec, 3=play+rec)");
#ifdef SND_DEBUG
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
@@ -1130,7 +1150,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, Sep 6, 9:13 PM (1 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38369235
Default Alt Text
D31320.id92793.diff (2 KB)
Attached To
Mode
D31320: sound(4): implement playback/recording mode sysctl
Attached
Detach File
Event Timeline
Log In to Comment