pc-speaker: add SND_SILENT
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Stas Sergeev
[ adding LKML to CC and removing akpm as this went into a discussion phase apparently ]
Quoted 3 lines · Dmitry Torokhov
Quoted 3 lines
Well, the main reason behind that change, is that there is a PC-Speaker PCM driver/emulator, snd-pcsp, pending in an ALSA CVS. I can't get it included in kernel before there is a way to disable the pcspkr driver.
Quoted 6 lines
Quoted 1 line
Why can't you? We have ALSA and OSS together in the kernel just fine.
But the pcspkr driver is not an OSS, it is an "input" driver.
Quoted 2 lines
If you are concerned about both modules baing active at the same time do not let user compile pcspkr if
snd_pcspis selected for now.The problem is that the snd-pcsp doesn't replace pcspkr.
If that's the problem, create a minimal input driver that will signal the snd-pcsp to beep, and change the original pcspkr to include "(Non-ALSA)". Obviously both drivers will exclude each other, but that should be fine, and users who prefer "music" over beeps will be fine, too.
And as a bonus, you might upload a custom PC beep ... but if you do, a userspace notifyer combined with a beep-daemon might be preferable (uinput? I know it exists ...).
Off cause I might be suggesting exactly what you did, since I didn't see the patch.
Signature · 2 lines
Ich danke GMX dafür, die Verwendung meiner Adressen mittels per SPF verbreiteten Lügen zu sabotieren.
Hello.
Quoted 3 lines · Bodo Eggert
Quoted 1 line
The problem is that the snd-pcsp doesn't replace pcspkr.
If that's the problem, create a minimal input driver that will signal the snd-pcsp to beep, and change the original pcspkr to include "(Non-ALSA)".
Yes, making snd-pcsp to produce the console beeps and making it mutually exclusive with pcspkr is possible. But I think it is undesireable. People that don't like the console beeps (myself included) simply do not load the pcspkr module right now. If snd-pcsp is to produce the beeps, then not loading pcspkr will not get the desired effect any more, and the only possibility would be to, probably, add the separate mixer control for the beeps. I find this counter-intuitive: some people will be able to disable the beeps by simply not loading pcspkr, while for others this will suddenly magically stop working. This may lead to a few unnecessary bug reports and confusions.
I think I'd better try to code up the grabbing capability in the input layer, since Dmitry didn't seem to object to that.
Quoted 6 lines · Stas Sergeev
Quoted 3 lines · Bodo Eggert
Quoted 1 line
The problem is that the snd-pcsp doesn't replace pcspkr.
If that's the problem, create a minimal input driver that will signal the snd-pcsp to beep, and change the original pcspkr to include "(Non-ALSA)".
Quoted 8 lines
Yes, making snd-pcsp to produce the console beeps and making it mutually exclusive with pcspkr is possible. But I think it is undesireable. People that don't like the console beeps (myself included) simply do not load the pcspkr module right now. If snd-pcsp is to produce the beeps, then not loading pcspkr will not get the desired effect any more, and the only possibility would be to, probably, add the separate mixer control for the beeps.
I asumed the input driver would be an extra module. Otherwise it should at least be a runtime option (off cause).
Signature · 1 line
Microwave: Signal from a friendly micro...
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
The problem is that the snd-pcsp doesn't replace pcspkr.
If that's the problem, create a minimal input driver that will signal the snd-pcsp to beep, and change the original pcspkr to include "(Non-ALSA)".
Yes, making snd-pcsp to produce the console beeps and making it mutually exclusive with pcspkr is possible. But I think it is undesireable. People that don't like the console beeps (myself included) simply do not load
I like the current approach, that is, load pcspkr to get a beep, load pcspkr+snd-pcsp to get the full blow.
On some servers, I need a mixture of when to allow a beep and when not. In these, I patched the oops and panic functions to make a sound, which implies that pcspkr.ko must be loaded. In turn, I modified vt.c to have the default bell time = 0 to shut /bin/*sh up. Works good.
Jan Engelhardt
Quoted 3 lines · Jan Engelhardt
I like the current approach, that is, load pcspkr to get a beep, load pcspkr+snd-pcsp to get the full blow.
On some servers, I need a mixture of when to allow a beep and when not. In these, I patched the oops and panic functions to make a sound, which implies that pcspkr.ko must be loaded. In turn, I modified
vt.cto have the default bell time = 0 to shut/bin/*shup. Works good.
In a lab I used to run we had a bunch of Linux workstations where some users tended to abuse the console beeper. Our solution was a small kernel patch to add a CAP_VT_BEEP which was checked in the various console functions before generating a sound or modifying the default beep settings. This allowed our automated hourly chimes to run without interference (run from cron as root), while preventing users not in the audio group from making sounds (/usr/bin/beep was root:audio 04750).
Cheers,
Kyle Moffett
Dmitry Torokhov
maintainerQuoted 4 lines · Stas Sergeev
I think I'd better try to code up the grabbing capability in the input layer, since Dmitry didn't seem to object to that.
I was pondering over implications of "grabbing" events over the weekend and I am not entirely happy with it either. The problem with grabbing is that your driver does not have any knowledge of how the events would be processed if left untouched. Right now you assume that all bells are handled by pcspkr but we could really have alternative bell implementations. For example we could have "visual" bell that could flash framebuffer or a bell that is routed through ALSA, etc, etc. All these alternative bells would not disrupt operation of your snd_pcsp module but it still would disable the bell because it does not know better.
--
Dmitry
Hi.
Quoted 12 lines · Dmitry Torokhov
Quoted 2 lines
I think I'd better try to code up the grabbing capability in the input layer, since Dmitry didn't seem to object to that.
I was pondering over implications of "grabbing" events over the weekend and I am not entirely happy with it either. The problem with grabbing is that your driver does not have any knowledge of how the events would be processed if left untouched. Right now you assume that all bells are handled by pcspkr but we could really have alternative bell implementations. For example we could have "visual" bell that could flash framebuffer or a bell that is routed through ALSA, etc, etc. All these alternative bells would not disrupt operation of your
snd_pcspmodule but it still would disable the bell because it does not know better.
Why not? I can check dev.id.bustype and dev.phys to find out what exactly resources it allocates. This all is present in "struct input_dev" AFAICS. And since they are here, I don't agree using the input subsystem on that layer is completely wrong.
Well, I can also add the hack to snd-pcsp to always reprogram PIT chan 2 to proper mode in an inthandler to make it tolerant to whatever pcspkr does. But this is quite an evil hack, and an unnecessary code pollution which I'd like to avoid.
Adding a dummy input driver, as per Bodo Eggert, doesn't look very good to me either. If nothing else then at least because it won't be called pcspkr, so the confusion is still unavoidable.
Adding a few ALSA guys to CC, who used to help with the snd-pcsp in the past.
Hi.
Quoted 3 lines · Dmitry Torokhov
etc. All these alternative bells would not disrupt operation of your
snd_pcspmodule but it still would disable the bell because it does not know better.
OK, I now used INPUT_DEVICE_ID_MATCH_BUS, and, with something like the attached patch, it seems to work. So essentially my driver has enough of the knowledge about the device in question, and this seems to be possible exactly only with the input subsystem. (which makes me confident again that using the input subsystem was exactly the right choice :)
What do you think about that approach?
include/linux/input.h +3 -1
@@ -862,7 +862,7 @@struct pt_regs *regs;int state; - +int enabled;int sync;int abs[ABS_MAX +1 ];
@@ -1019,6 +1019,8 @@int input_open_device (struct input_handle *);void input_close_device (struct input_handle *); +void input_enable_device (struct input_handle *handle,int enab); +int input_accept_process (struct input_handle *handle,struct file *file);int input_flush_device (struct input_handle * handle,struct file * file);
drivers/input/input.c +8 -1
@@ -36,6 +36,7 @@EXPORT_SYMBOL (input_release_device);EXPORT_SYMBOL (input_open_device);EXPORT_SYMBOL (input_close_device); +EXPORT_SYMBOL (input_enable_device);EXPORT_SYMBOL (input_accept_process);EXPORT_SYMBOL (input_flush_device);EXPORT_SYMBOL (input_event);
@@ -52,7 +53,7 @@ {struct input_handle *handle; -if (type >EV_MAX || !test_bit (type, dev->evbit)) +if (type >EV_MAX || !test_bit (type, dev->evbit) || !dev->enabled)return ;add_input_randomness (type, code, value);
@@ -265,6 +266,11 @@up (&dev->sem); } +void input_enable_device (struct input_handle *handle,int enab) +{ + handle->dev->enabled = enab; +} +static void input_link_handle (struct input_handle *handle) {list_add_tail (&handle->d_node, &handle->dev->h_list);
@@ -712,6 +718,7 @@class_device_initialize (&dev->cdev);INIT_LIST_HEAD (&dev->h_list);INIT_LIST_HEAD (&dev->node); + dev->enabled =1 ; }return dev;
Quoted 7 lines · Stas Sergeev
Quoted 5 lines · Bodo Eggert
Quoted 1 line
The problem is that the snd-pcsp doesn't replace pcspkr.
If that's the problem, create a minimal input driver that will signal the snd-pcsp to beep, and change the original pcspkr to include "(Non-ALSA)".
Quoted 12 lines
Yes, making snd-pcsp to produce the console beeps and making it mutually exclusive with pcspkr is possible. But I think it is undesireable. People that don't like the console beeps (myself included) simply do not load the pcspkr module right now. If snd-pcsp is to produce the beeps, then not loading pcspkr will not get the desired effect any more, and the only possibility would be to, probably, add the separate mixer control for the beeps. I find this counter-intuitive: some people will be able to disable the beeps by simply not loading pcspkr, while for others this will suddenly magically stop working. This may lead to a few unnecessary bug reports and confusions.
My laptop already has such a mixer control (and it works too,
though it does depend on pcspkr being loaded). Have there been bug reports about PC speakers that don't work because the PC speaker mixer control was not unmuted? Well, probably, but it's not a new situation.
It doesn't seem unreasonable to me to expect users to configure
their PC speaker beep preference through the ALSA mixer when configuring the PC speaker to be an audio device.
I would think the ideal situation would be to make every ALSA
device capable of acting as the console bell (defaulting to muted, like every other ALSA mixer control). Then only pcspkr would be the odd case (though maybe a common one).
I dunno if there's a reasonably easy way to do that (without
changing every ALSA driver) though.
--
Joseph Fannin
[email protected]
"That's all I have to say about that." -- Forrest Gump.
Quoted 7 lines · Joseph Fannin
I would think the ideal situation would be to make every ALSA
device capable of acting as the console bell (defaulting to muted, like every other ALSA mixer control). Then only pcspkr would be the odd case (though maybe a common one).I dunno if there's a reasonably easy way to do that (without
changing every ALSA driver) though.
I think that should be done using a userspace input device if possible.
Signature · 3 lines
A man inserted an advertisement in the classified: Wife Wanted." The next day he received a hundred letters. They all said the same thing: "You can have mine."
Quoted 11 lines · Bodo Eggert
Quoted 7 lines · Joseph Fannin
I would think the ideal situation would be to make every ALSA
device capable of acting as the console bell (defaulting to muted, like every other ALSA mixer control). Then only pcspkr would be the odd case (though maybe a common one).I dunno if there's a reasonably easy way to do that (without
changing every ALSA driver) though.I think that should be done using a userspace input device if possible.
It certainly is. That way configuring the exact sound it makes would also possible. The latency might be a problem, though.
Signature · 2 lines
Vojtech Pavlik Director SuSE Labs
Quoted 9 lines · Vojtech Pavlik
Quoted 7 lines · Bodo Eggert
Quoted 5 lines · Joseph Fannin
I would think the ideal situation would be to make every ALSA
device capable of acting as the console bell (defaulting to muted, like every other ALSA mixer control). Then only pcspkr would be the odd case (though maybe a common one).
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
I dunno if there's a reasonably easy way to do that (without
changing every ALSA driver) though.I think that should be done using a userspace input device if possible.
It certainly is. That way configuring the exact sound it makes would also possible. The latency might be a problem, though.
Latency is no problem. I'm using a userspace daemon to emulate the console beeper for about 6 months now and it work's very well.
The daemon listens on /dev/input/eventX and when receiving a SND_TONE it opens /dev/dspY (a cheap USB-speaker), produces its bing and closes the audio dev after some seconds with no SND_TONE.
Latency isn't noticable and memory footprint is small.
Sure, if ALSA could emit console beeps on any audio device even if it is in use I would definitely use it and trash the USB-speaker. But the userspace daemon is OK...
Ciao, ET.
PS:
<rant>
It would have been even better if Shuttle had connected the beeper output of the IT87 to the beeper input of the ALC650 in the first place. But no, this thing is totally silent - no piezo beeper, no routing to the sound codec, no POST-beeps, nothing.
Why are manufacturers doing such silly things?
</rant>
Quoted 15 lines · Edgar Toernig
Quoted 14 lines · Vojtech Pavlik
Quoted 11 lines · Bodo Eggert
Quoted 7 lines · Joseph Fannin
I would think the ideal situation would be to make every ALSA
device capable of acting as the console bell (defaulting to muted, like every other ALSA mixer control). Then only pcspkr would be the odd case (though maybe a common one).I dunno if there's a reasonably easy way to do that (without
changing every ALSA driver) though.I think that should be done using a userspace input device if possible.
Quoted 7 lines
Quoted 2 lines
It certainly is. That way configuring the exact sound it makes would also possible. The latency might be a problem, though.
Latency is no problem. I'm using a userspace daemon to emulate the console beeper for about 6 months now and it work's very well.
The daemon listens on
/dev/input/eventXand when receiving a
It needs to use /dev/input/uinput, not eventX. SND_TONE events are not sent to the event devices.
Quoted 4 lines
SND_TONEit opens/dev/dspY(a cheap USB-speaker), produces its bing and closes the audio dev after some seconds with noSND_TONE.Latency isn't noticable and memory footprint is small.
It needs to have the sample ready in memory and not swapped out. Then the latency will be OK, but if it needs to read it in from the disk, it may be very noticeable.
Quoted 10 lines
Sure, if ALSA could emit console beeps on any audio device even if it is in use I would definitely use it and trash the USB-speaker. But the userspace daemon is OK...
PS:
<rant>
It would have been even better if Shuttle had connected the beeper output of the IT87 to the beeper input of the ALC650 in the first place. But no, this thing is totally silent - no piezo beeper, no routing to the sound codec, no POST-beeps, nothing.
Pretty common nowadays.
Quoted 2 lines
Why are manufacturers doing such silly things?
</rant>
Signature · 2 lines
Vojtech Pavlik Director SuSE Labs
Quoted 10 lines · Vojtech Pavlik
Quoted 5 lines · Edgar Toernig
Latency is no problem. I'm using a userspace daemon to emulate the console beeper for about 6 months now and it work's very well.
The daemon listens on
/dev/input/eventXand when receiving aIt needs to use
/dev/input/uinput, not eventX.SND_TONEevents are not sent to the event devices.
Well, I get them - stock 2.6.16.
Quoted 5 lines
Quoted 1 line
Latency isn't noticable and memory footprint is small.
It needs to have the sample ready in memory and not swapped out. Then the latency will be OK, but if it needs to read it in from the disk, it may be very noticeable.
Yeah, if one ever cares one could mlock the samples, or (as I do) run without swap. Fixing the 'air' latency of 3ms/m is harder though *g*
Ciao, ET.
Quoted 7 lines · Edgar Toernig
Quoted 6 lines · Vojtech Pavlik
Quoted 4 lines · Edgar Toernig
Latency is no problem. I'm using a userspace daemon to emulate the console beeper for about 6 months now and it work's very well.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
The daemon listens on
/dev/input/eventXand when receiving aIt needs to use
/dev/input/uinput, not eventX.SND_TONEevents are not sent to the event devices.Well, I get them - stock 2.6.16.
Oh, yes, you're right. But still, this will only work if a speaker device is present, so uinput is the right way to do it.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Latency isn't noticable and memory footprint is small.
It needs to have the sample ready in memory and not swapped out. Then the latency will be OK, but if it needs to read it in from the disk, it may be very noticeable.
Yeah, if one ever cares one could mlock the samples, or (as I do) run without swap. Fixing the 'air' latency of 3ms/m is harder though *g*
Signature · 2 lines
Vojtech Pavlik Director SuSE Labs