1 | <?xml version='1.0' encoding='UTF-8'?>
|
---|
2 | <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
|
---|
3 | <topic xml:lang="en-us" id="pcspeaker_passthrough">
|
---|
4 | <title>PC Speaker Passthrough</title>
|
---|
5 |
|
---|
6 | <body>
|
---|
7 | <p>
|
---|
8 | As an experimental feature, primarily due to being limited to
|
---|
9 | Linux host only and unknown Linux distribution coverage,
|
---|
10 | <ph conkeyref="vbox-conkeyref-phrases/product-name"/> supports passing through the PC speaker to the
|
---|
11 | host. The PC speaker, sometimes called the system speaker, is a
|
---|
12 | way to produce audible feedback such as beeps without the need for
|
---|
13 | regular audio and sound card support.
|
---|
14 | </p>
|
---|
15 | <p>
|
---|
16 | The PC speaker passthrough feature in <ph conkeyref="vbox-conkeyref-phrases/product-name"/> handles beeps
|
---|
17 | only. Advanced PC speaker use by the VM, such as PCM audio, will
|
---|
18 | not work, resulting in undefined host behavior.
|
---|
19 | </p>
|
---|
20 | <p>
|
---|
21 | Producing beeps on Linux is a very complex topic. <ph conkeyref="vbox-conkeyref-phrases/product-name"/>
|
---|
22 | offers a collection of options, in an attempt to make this work
|
---|
23 | deterministically and reliably on as many Linux distributions and
|
---|
24 | system configurations as possible. These are summarized in the
|
---|
25 | following table.
|
---|
26 | </p>
|
---|
27 | <table id="table-pcspeaker-config">
|
---|
28 | <title>PC Speaker Configuration Options</title>
|
---|
29 | <desc>PC Speaker Configuration Options</desc>
|
---|
30 | <tgroup cols="3">
|
---|
31 | <thead>
|
---|
32 | <row>
|
---|
33 | <entry>
|
---|
34 | <p>
|
---|
35 | <b outputclass="bold">Code</b>
|
---|
36 | </p>
|
---|
37 | </entry>
|
---|
38 | <entry>
|
---|
39 | <p>
|
---|
40 | <b outputclass="bold">Device</b>
|
---|
41 | </p>
|
---|
42 | </entry>
|
---|
43 | <entry>
|
---|
44 | <p>
|
---|
45 | <b outputclass="bold">Notes</b>
|
---|
46 | </p>
|
---|
47 | </entry>
|
---|
48 | </row>
|
---|
49 | </thead>
|
---|
50 | <tbody>
|
---|
51 | <row>
|
---|
52 | <entry>
|
---|
53 | <p>
|
---|
54 | 1
|
---|
55 | </p>
|
---|
56 | </entry>
|
---|
57 | <entry>
|
---|
58 | <p>
|
---|
59 | <filepath>/dev/input/by-path/platform-pcspkr-event-spkr</filepath>
|
---|
60 | </p>
|
---|
61 | </entry>
|
---|
62 | <entry>
|
---|
63 | <p>
|
---|
64 | Direct host PC speaker use.
|
---|
65 | </p>
|
---|
66 | </entry>
|
---|
67 | </row>
|
---|
68 | <row>
|
---|
69 | <entry>
|
---|
70 | <p>
|
---|
71 | 2
|
---|
72 | </p>
|
---|
73 | </entry>
|
---|
74 | <entry>
|
---|
75 | <filepath>/dev/tty</filepath>
|
---|
76 | </entry>
|
---|
77 | <entry>
|
---|
78 | <p>
|
---|
79 | Uses the terminal association of the VM process. VM
|
---|
80 | needs to be started on a virtual console.
|
---|
81 | </p>
|
---|
82 | </entry>
|
---|
83 | </row>
|
---|
84 | <row>
|
---|
85 | <entry>
|
---|
86 | <p>
|
---|
87 | 3
|
---|
88 | </p>
|
---|
89 | </entry>
|
---|
90 | <entry>
|
---|
91 | <p><filepath>/dev/tty0</filepath> or
|
---|
92 | <filepath>/dev/vc/0</filepath>
|
---|
93 | </p>
|
---|
94 | </entry>
|
---|
95 | <entry>
|
---|
96 | <p>
|
---|
97 | Can only be used by user <codeph>root</codeph> or
|
---|
98 | users with <codeph>cap_sys_tty_config</codeph>
|
---|
99 | capability.
|
---|
100 | </p>
|
---|
101 | </entry>
|
---|
102 | </row>
|
---|
103 | <row>
|
---|
104 | <entry>
|
---|
105 | <p>
|
---|
106 | 9
|
---|
107 | </p>
|
---|
108 | </entry>
|
---|
109 | <entry>
|
---|
110 | <p>
|
---|
111 | A user-specified console or evdev device path.
|
---|
112 | </p>
|
---|
113 | </entry>
|
---|
114 | <entry>
|
---|
115 | <p>
|
---|
116 | As for codes 1 to 3, but with a custom device path.
|
---|
117 | </p>
|
---|
118 | </entry>
|
---|
119 | </row>
|
---|
120 | <row>
|
---|
121 | <entry>
|
---|
122 | <p>
|
---|
123 | 70
|
---|
124 | </p>
|
---|
125 | </entry>
|
---|
126 | <entry>
|
---|
127 | <p>
|
---|
128 | <filepath>/dev/tty</filepath>
|
---|
129 | </p>
|
---|
130 | </entry>
|
---|
131 | <entry>
|
---|
132 | <p>
|
---|
133 | Standard beep only. Loses frequency and length. See code
|
---|
134 | 2.
|
---|
135 | </p>
|
---|
136 | </entry>
|
---|
137 | </row>
|
---|
138 | <row>
|
---|
139 | <entry>
|
---|
140 | <p>
|
---|
141 | 79
|
---|
142 | </p>
|
---|
143 | </entry>
|
---|
144 | <entry>
|
---|
145 | <p>
|
---|
146 | A user-specified terminal device path.
|
---|
147 | </p>
|
---|
148 | </entry>
|
---|
149 | <entry>
|
---|
150 | <p>
|
---|
151 | As for code 70, but with a custom device path.
|
---|
152 | </p>
|
---|
153 | </entry>
|
---|
154 | </row>
|
---|
155 | <row>
|
---|
156 | <entry>
|
---|
157 | <p>
|
---|
158 | 100
|
---|
159 | </p>
|
---|
160 | </entry>
|
---|
161 | <entry>
|
---|
162 | <p>
|
---|
163 | All of the above.
|
---|
164 | </p>
|
---|
165 | </entry>
|
---|
166 | <entry>
|
---|
167 | <p>
|
---|
168 | Tries all the available codes.
|
---|
169 | </p>
|
---|
170 | </entry>
|
---|
171 | </row>
|
---|
172 | </tbody>
|
---|
173 | </tgroup>
|
---|
174 | </table>
|
---|
175 | <p>
|
---|
176 | To enable PC speaker passthrough use the following command:
|
---|
177 | </p>
|
---|
178 | <pre xml:space="preserve">VBoxManage setextradata <varname>VM-name</varname> "VBoxInternal/Devices/i8254/0/Config/PassthroughSpeaker" <varname>N</varname>
|
---|
179 | </pre>
|
---|
180 | <p>
|
---|
181 | Replace <varname>N</varname> with the code representing
|
---|
182 | the case you want to use. Changing this setting takes effect when
|
---|
183 | you next start the VM. It is safe to enable PC speaker passthrough
|
---|
184 | on all host OSes. It will only have an effect on Linux.
|
---|
185 | </p>
|
---|
186 | <p>
|
---|
187 | The VM log file, <filepath>VBox.log</filepath>, contains lines
|
---|
188 | with the prefix <codeph>PIT: speaker:</codeph> showing the PC
|
---|
189 | speaker passthrough setup activities. It gives hints which device
|
---|
190 | it picked or why it failed.
|
---|
191 | </p>
|
---|
192 | <p>
|
---|
193 | Enabling PC speaker passthrough for the VM is usually the simple
|
---|
194 | part. The real difficulty is making sure that <ph conkeyref="vbox-conkeyref-phrases/product-name"/> can
|
---|
195 | access the necessary device, because in a typical Linux install
|
---|
196 | most of them can only be accessed by user <codeph>root</codeph>.
|
---|
197 | You should follow the preferred way to persistently change this,
|
---|
198 | such as by referring to your distribution's documentation. Since
|
---|
199 | there are countless Linux distribution variants, we can only give
|
---|
200 | the general hints that there is often a way to give the X11
|
---|
201 | session user access to additional devices, or you need to find a
|
---|
202 | working solution using a udev configuration file. If everything
|
---|
203 | fails you might try setting the permissions using a script which
|
---|
204 | is run late enough in the host system startup.
|
---|
205 | </p>
|
---|
206 | <p>
|
---|
207 | Sometimes additional rules are applied by the kernel to limit
|
---|
208 | access. For example, that the VM process must have the same
|
---|
209 | controlling terminal as the device configured to be used for
|
---|
210 | beeping, something which is often very difficult to achieve for
|
---|
211 | GUI applications such as <ph conkeyref="vbox-conkeyref-phrases/product-name"/>. The table above contains
|
---|
212 | some hints, but in general refer to the Linux documentation.
|
---|
213 | </p>
|
---|
214 | <p> If you have trouble getting any beeps even if the device permissions are set up and VBox.log
|
---|
215 | confirms that it uses evdev or console for the PC speaker control, check if your system has a
|
---|
216 | PC speaker. Some systems do not have one. Other complications can arise from Linux rerouting
|
---|
217 | the PC speaker output to a sound card. Check if the beeps are audible if you connect speakers
|
---|
218 | to your sound card. Today almost all systems have one. Finally, check if the audio mixer
|
---|
219 | control has a channel named <i>beep</i>, which could be hidden in the mixer settings, and that
|
---|
220 | it is not muted. </p>
|
---|
221 | </body>
|
---|
222 |
|
---|
223 | </topic>
|
---|