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