Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F110618033
D49024.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D49024.diff
View Options
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
@@ -330,28 +330,32 @@
return (err);
}
-static u_int8_t
-pcm_mode_init(struct snddev_info *d)
+static int
+sysctl_dev_pcm_mode(SYSCTL_HANDLER_ARGS)
{
- u_int8_t mode = 0;
+ struct snddev_info *d;
+ int mode = 0;
+ d = oidp->oid_arg1;
+ if (!PCM_REGISTERED(d))
+ return (ENODEV);
+
+ PCM_LOCK(d);
if (d->playcount > 0)
mode |= PCM_MODE_PLAY;
if (d->reccount > 0)
mode |= PCM_MODE_REC;
if (d->mixer_dev != NULL)
mode |= PCM_MODE_MIXER;
+ PCM_UNLOCK(d);
- return (mode);
+ return (sysctl_handle_int(oidp, &mode, 0, req));
}
static void
pcm_sysinit(device_t dev)
{
struct snddev_info *d = device_get_softc(dev);
- u_int8_t mode;
-
- mode = pcm_mode_init(d);
sysctl_ctx_init(&d->play_sysctl_ctx);
d->play_sysctl_tree = SYSCTL_ADD_NODE(&d->play_sysctl_ctx,
@@ -372,9 +376,10 @@
"bitperfect", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 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,
+ SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+ SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+ "mode", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, d, sizeof(d),
+ sysctl_dev_pcm_mode, "I",
"mode (1=mixer, 2=play, 4=rec. The values are OR'ed if more than "
"one mode is supported)");
vchan_initsys(dev);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 21, 11:43 PM (2 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16674845
Default Alt Text
D49024.diff (1 KB)
Attached To
Mode
D49024: sound: Make dev.pcm.X.mode dynamic
Attached
Detach File
Event Timeline
Log In to Comment