Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 480 lines (384 sloc) 17.664 kb
87686d7 Vincent Bernat New article on XBMC
authored
1 ---
2 title: "XBMC Eden on Debian Wheezy"
3 keywords: "xbmc, media center, eden, debian, wheeze, logitech harmony, imon, zotac"
4 uuid: ad787bd1-9bcc-4730-bc73-6ce694763ad1
45b2372 Vincent Bernat article: local apt repositories
authored
5 tags:
6 - debian
87686d7 Vincent Bernat New article on XBMC
authored
7 ---
8
9 I bought some HTPC a few years ago to run [XBMC][], a neat media
10 center solution. At the time, to avoid any problems, I installed it on
11 top of a minimal Ubuntu Lucid installation with the official packages
12 from the team XBMC. Recently, [XBMC Eden has been released][eden] and
13 [XBMC has landed into Debian unstable][xbmc-debian]. It was a good
14 occasion to make the switch.
15
16 ![Unofficial XBMC logo for Eden][xbmc-logo]
17 [xbmc-logo]: [[!!images/xbmc-eden-logo.jpg]] "XBMC Media Center: Eden. Logo by FiroPyro. CC BY-NC 3.0"
18
19 **TL;DR**: Installing XBMC on Debian Wheezy is quite easy: it almost
20 works out of the box. The big difficulty is the configuration of the
21 remote control: either it works as you expect or you will have to
22 scratch your head over the pile of layers needed to work with a remote
23 control.
24
25 The configuration of my HTPC is as follows:
26
27 - an [Antec Micro Fusion 350 housing][antec] featuring a SoundGraph
28 iMON IR receiver and LCD screen[^lcd],
29 - a Zotac ION-ITX-D-E motherboard with an Intel Atom 330 CPU and an
30 nVidia ION chipset,
31 - some Onkyo AV receiver connected through HDMI,
32 - a [Logitech Harmony 555][555] as remote control.
33
34 [^lcd]: The readibility of the LCD screen is very bad. You should look
35 at the VFD version. The IR receiver reception is poor. The
36 provided remote control is a joke.
37
38 [TOC]
39
40 # Installation
41
42 ## Installing Debian Wheezy
43
44 Installing Debian Wheezy[^wheezy] is pretty easy. Nowadays, getting a
45 bootable USB key from a
46 [_netinst_ image of Debian Installer for Wheezy][debian-installer] is
47 simplified:
48
49 ::console
50 $ sudo dd if=debian-testing-i386-netinst.iso \
51 > of=/dev/disk/by-id/usb...
52
53 [^wheezy]: Debian Wheezy is not yet released. If you are unfamiliar
54 with Debian, it may be cumbersome to maintain it until the
55 freeze happens in a few months.
56
57 The installation was smooth with the exception of GRUB which was
58 unable to install itself on the disk. This is a
59 [known bug][#662086] when dealing with LVM and it comes with a
60 simple workaround. I hope it will be corrected in time for Wheezy
61 release.
62
63 While this has little to do with the installation of XBMC, I wanted to
64 test [systemd][] which may become the default _init_ in Debian (at
65 least in Debian GNU/Linux). From `README.Debian`:
66
67 > `systemd` can be installed alongside `sysvinit` and will not change
68 > the behaviour of the system out of the box. This is intentional.
69 > To test `systemd`, add `init=/bin/systemd` to the kernel command
70 > line and then rebooting, or install the `systemd-sysv` package.
71
72 The final system boots in about 15 seconds.
73
74 ## Configuring X
75
76 Because [video decoding in _nouveau_ driver][video-nouveau] is still a
77 work in progress, the use of the proprietary NVIDIA drivers is
78 mandatory to be able to watch high resolution videos. Therefore,
79 `/etc/apt/sources.list` should be completed with `contrib` and
80 `non-free` repository. Then, you can install the appropriate packages:
81 `xserver-xorg-video-nvidia`, `nvidia-vdpau-driver` and `xserver-xorg`.
82
83 Here is my `/etc/X11/xorg.conf.d/nvidia.conf`:
84
85 ::
86 Section "Device"
87 Identifier "NVidia ION"
88 Driver "nvidia"
89 VendorName "NVIDIA Corporation"
90 Option "HWCursor" "False"
91 Option "NoFlip" "False"
92 Option "FlatPanelProperties" "Scaling = Native"
93 Option "DynamicTwinView" "False"
94 Option "ConnectedMonitor" "DFP-1"
95 Option "CustomEDID" "DFP-1:/etc/X11/edid.bin"
96 Option "NoLogo" "True"
97 EndSection
98
99 Section "Extensions"
100 Option "Composite" "false"
101 EndSection
102
103 The `CustomEDID` option allows the driver to get an appropriate EDID
104 even when the AV receiver is off. You can get yours, free of charge,
105 with `get-edid` from `read-edid` package.
106
107 ## Installing XBMC
108
109 Thanks to the work of Andrés Mejía, XBMC is now available in Debian
110 Wheezy. To install it, just type `aptitude install xbmc`. I have
111 dropped the following `xbmc.service` in `/etc/systemd/system`
112 directory:
113
114 ::
115 [Unit]
116 Description = XBMC media center
117 After = syslog.target
118
119 [Service]
120 User = xbmc
121 Group = xbmc
122 Type = simple
123 ExecStart = /usr/bin/xinit /usr/bin/xbmc-standalone -- :0
124 Restart = on-failure
125
126 [Install]
127 WantedBy = multi-user.target
128
129 Enable this service on boot with `systemctl enable xbmc.service`. You
130 need to allow `xbmc` user to run X. The simplest way is to run
131 `dpkg-reconfigure -plow x11-common` and to allow anybody to run
132 X. `sudo` may be an alternative.
133
134 # Configuration
135
136 ## Sound
137
138 While I wanted to use PulseAudio, I want the AV receiver to be
139 able to upmix stereo streams itself. With PulseAudio, it would always
140 receive a 6-channel signal. Therefore, I directly use ALSA.
141
142 First, unmute the appropriate outputs:
143
144 ::console
145 $ amixer scontrols | grep IEC958
146 Simple mixer control 'IEC958',0
147 Simple mixer control 'IEC958 Default PCM',0
148 Simple mixer control 'IEC958',1
149 $ amixer sset 'IEC958',0 unmute
150 $ amixer sset 'IEC958 Default PCM',0 unmute
151 $ amixer sset 'IEC958',1 unmute
152 $ sudo systemctl stop alsa-utils.service
153
154 The order of channels is incorrect. With the following
155 `/etc/asound.conf`, we declare a new output, `hdmi2`, with a different
156 mapping:
157
158 ::
159 pcm.hdmi2 {
160 type asym
161 playback.pcm {
162 type plug
163 slave.pcm "remap-surround51"
164 }
165 }
166
167 pcm.!remap-surround51 {
168 type route
169 slave.pcm "hdmi"
170 ttable {
171 0.0= 1
172 1.1= 1
173 2.4= 1
174 3.5= 1
175 4.2= 1
176 5.3= 1
177 }
178 }
179
180 In XBMC, this output should be used instead of the default one. `hdmi`
181 should still be used for passthrough. To check if each speaker is
182 mapped correctly, one can use `speaker-test -D hdmi2 -c 6`.
183
184 ## LCD display
185
186 The LCD display integrated into the SoundGraph iMON is supported by
187 the `imon` kernel module and the `lcdproc` package. I have only
188 modified a few lines of `/etc/LCDd.conf` to make it work:
189
190 ::
191 [server]
192 Driver=imonlcd
193 ServerScreen=off
194
195 [imonlcd]
196 Protocol=1
197 OnExit=2
198 Contrast=400
199
841f4a6 Vincent Bernat article: update XBMC article with a note about LCD screen
authored
200 **UPDATED:** The use of the LCD screen triggers various bugs
201 including segfaults of `ir-keytable` and freezes. Since its
202 readibility is less than ideal, I don't use it any more. I have
203 uninstalled `lcdproc` and I am using this simple script to switch it
204 off on start:
205
206 ::python
207 #!/usr/bin/python
208
209 import struct
210 open("/dev/lcd0", "w").write(struct.pack("Q",0x8800000000000008))
211
212 This script is triggered by the following rule for `udev`:
213
214 ::
215 # Disable LCD screen
216 ACTION=="add", NAME=="lcd0",
217 RUN+="/usr/local/bin/disable_lcd"
218
87686d7 Vincent Bernat New article on XBMC
authored
219 ## Remote control
220
221 This is the most difficult part. I have a Logitech Harmony remote
222 which is a great universal remote. Its support in Linux is acceptable:
223 you can configure through [Logitech website][harmony] and use
224 [congruity][] to push the new configuration.
225
226 ### Remote controls and Linux
227
228 **Before Linux 2.6.36**, most remote controls would need LIRC to work:
229
230 - The driver receives the signal from the IR receiver and make it
231 available through `/dev/lirc`.
232 - `lircd`, with the help of a configuration file describing the
233 protocol used by the remote control, will read the signal and turn
234 it into the appropriate LIRC code.
235 - XBMC connects to `lircd` and receives incoming LIRC codes. It will
236 translate them to an XBMC command. This translation is specified in
237 `Lircmap.xml`.
238 - XBMC maps each command to an action (like `Play`, `Fullscreen`,
239 ...) using a _keymap_. This keymap can handle commands received by
240 a remote control, but also by a keyboard, a mouse or a joystick.
241
242 **Since Linux 2.6.36**, remote controls will be mapped as a generic
243 input device (just like a keyboard):
244
245 - The driver receives the signal from the IR receiver.
246 - The signal will be handled by a decoder. The configuration of this
247 decoder is done in userland by `ir-keytable`. The decoder will
248 turn the signal into the appropriate event (usually, some
249 keypress).
250 - X will listen to those events and turn them into X key events.
251 - XBMC will receive them and use the appropriate _keymap_ to turn
252 them into actions.
253
254 And to add more complexity to the mix, in this last case, you can
255 still use LIRC: `lircd` will listen to events generated by the kernel
256 and turn them into LIRC codes. This can be very confusing.
257
258 Moreover, the SoundGraph iMON IR receiver accepts two IR protocols:
259 the iMON protocol and the RC-6 one. The Linux driver accepts both of
260 them but uses the first one by default. The RC-6 protocol is the
261 protocol used by many MCE remote controls.
262
263 I hope you are still with me here.
264
265 ### The easy way
266
267 To get a reasonable configuration out of the box, here is how to
268 configure each layer:
269
270 Logitech Harmony remote
271 : Configure it as a _Microsoft_ branded _Media Center PC_: _Windows
272 Media Center SE_.
273
274 iMON IR receiver
275 : It must use RC-6 protocol. See below for more details.
276
277 LIRC
278 : In `/etc/lirc/hardware.conf`, put
279 `DEVICE=/dev/input/by-id/usb-15c2_0038-event-if00` and
280 `DRIVER=devinput`. In `/etc/lirc/lircd.conf`, just put `include
281 "/usr/share/lirc/remotes/devinput/lircd.conf.devinput"`.
282
283 XBMC
284 : With the previous bits done, it should just work out of the box.
285
286 To switch to RC-6 protocol, install the `ir-keytable` package and use
287 the following commands:
288
289 ::console
290 $ sudo modprobe rc-imon-mce
291 $ sudo ir-keytable -s rc0 -p rc-6 -c -w /lib/udev/rc_keymaps/imon_mce
292 Read imon_mce table
293 Old keytable cleared
294 Wrote 77 keycode(s) to driver
295 Protocols changed to RC-6
296
297 To make the change permanent, add the `rc-imon-mce` module to
298 `/etc/modules` and create `/etc/udev/rules.d/90-imon.rules` with the
299 following content:
300
301 ::
302 # Override the keytable for iMON
303 ACTION=="add|change", SUBSYSTEM=="rc", DRV_NAME="imon", \
304 RUN+="/usr/bin/ir-keytable -s $name -p rc-6 -c -w /lib/udev/rc_keymaps/imon_mce"
305
306 ### The hard way
307
308 Now, you may want to bind custom actions to some (physical or virtual)
309 buttons. Basically, you are left with two solutions:
310
311 1. Start from the basic configuration with LIRC and add more buttons
312 at each levels (there are five of them!).
313 2. Remove LIRC and start with the Logitech Harmony acting as a
314 Microsoft MCE keyboard.
315
316 The first option can be quite difficult. You need to find an unused
317 code for the Logitech Harmony. You can try to make it learn a new code
318 if you have some RC-6 remote control. Then, you need to ensure that
319 this code will be present in the keytable used by `ir-keytable`. If
320 not, you need to add it. That's not easy since you need a
321 [to enable some debug stuff in the kernel][prdebug] to find the
322 appropriate scancode. After that, the code needs to be translated in
323 `lircd.conf`. You will then have to translate it again in
324 `Lircmap.xml`. At least, you need to add it to a keymap in XBMC.
325
326 The other way is not ideal but seems less cumbersome. The first step
327 is to configure the Logitech Harmony as a _Microsoft MCE keyboard_: it
328 has a lot of available keys. Because of the lack of multimedia keys,
329 let's match the keyboard configuration of XBMC:
330
331 Button | Command | Button | Command
332 ------------ | ------------------ | ------------ | ----------
333 Channel Down | `PageDown` | Stop | `X`
334 Channel Up | `PageUp` | Skip back | `Comma`
335 Prev | `Backspace` | Skip forward | `.`
336 Up | `DirectionUp` | Play | `P`
337 Down | `DirectionDown` | Rewind | `R`
338 Left | `DirectionLeft` | Fast forward | `F`
339 Right | `DirectionRight` | Star | `Delete`
340 OK | `Enter` | Pound | `W`
341 Menu | `C` | Red | `F1`
342 Exit | `Esc` | Green | `F2`
343 Guide | `Tab` | Yellow | `F3`
344 Info | `I` | Blue | `F4`
345
346 Unfortunately, the keytables provided with `ir-keytable` are not
347 complete enough. I have built a
348 [more complete table][imon_mce][^missing]. With this table and the
349 bindings described above, most functions will work out of the box
350 without LIRC.
351
352 [^missing]: Some keys are missing from the provided table. For
353 example, there is no exclamation mark. While there is a
354 scan code for such a key in RC-6 protocol, there is no
355 appropriate key code to translate to: on a QWERTY
356 keyboard, the exclamation mark is on the same key as the
357 number 1. It is possible to map it to some other key code,
358 but the mapping would have been difficult to use.
359
360 Additional keys can be configured in a dedicated keymap[^keymap]. Here
361 is an excerpt of [mine][keymap]:
362
363 ::xml
364 <keymap>
365 <global>
366 <keyboard>
367 <end>XBMC.ShutDown()</end>
368 <f1>XBMC.ActivateWindow(MusicLibrary)</f1>
369 <f2>XBMC.ActivateWindow(Videos,TvShowTitles)</f2>
370 <f3>XBMC.ActivateWindow(Videos,MovieTitles)</f3>
371 <f4>XBMC.ActivateWindow(Weather)</f4>
372 </keyboard>
373 </global>
374 <FullscreenVideo>
375 <keyboard>
376 <opensquarebracket>SubtitleDelayMinus</opensquarebracket>
377 <closesquarebracket>SubtitleDelayPlus</closesquarebracket>
378 <f6>xbmc.runscript(script.xbmc.subtitles)</f6>
379 </keyboard>
380 </FullscreenVideo>
381 </keymap>
382
383 [^keymap]: For example, in `~/.xbmc/userdata/keymaps/harmony.xml`.
384
385 ## FTP
386
387 Instead of using SSH, I prefer to drop new files with anonymous
388 FTP. _vsftpd_ fits this purpose. Here is my configuration file:
389
390 ::
391 listen=YES
392 xferlog_enable=YES
393 use_localtime=YES
394 setproctitle_enable=YES
395
396 secure_chroot_dir=/var/run/vsftpd/empty
397 nopriv_user=ftp
398 ftpd_banner=XBMC
399 hide_ids=YES
400
401 ftp_username=xbmc
402 anon_umask=022
403 anon_root=/home/xbmc/media
404 anonymous_enable=YES
405 write_enable=YES
406 anon_upload_enable=YES
407 anon_world_readable_only=YES
408
409 It is currently not compatible with _systemd_ (see bug [#670308][]). I
410 have removed the symlink in `/etc/rc2.d` and I have used the following
411 unit file:
412
413 ::
414 [Unit]
415 Description=Vsftpd ftp daemon
416 After=syslog.target network.target
417
418 [Service]
419 Type=simple
420 ExecStart=/usr/sbin/vsftpd /etc/vsftpd.conf
421 ExecReload=/bin/kill -HUP $MAINPID
422 ExecStartPre=-/bin/mkdir -p /var/run/vsftpd/empty
423
424 [Install]
425 WantedBy=multi-user.target
426
427
428 ## Miscellaneous
429
430 1. In `/etc/default/grub`, reduce `TIMEOUT` to 0 to shorten the boot
431 time.
432
433 2. Enabling [dirty regions][dirtyregions] can help speed up XBMC.
434
435 3. `aptitude install upower pm-utils` to be able to shutdown/suspend
436 from XBMC. Since XBMC was configured to be started outside any
437 session, you need to explicitely give the appropriate rights by
438 creating the following
439 `/var/lib/polkit-1/localauthority/50-local.d/xbmc.pkla`:
440
441 ::
442 [Actions for xbmc user]
443 Identity=unix-user:xbmc
444 Action=org.freedesktop.upower.*;org.freedesktop.consolekit.system.*
445 ResultAny=yes
446 ResultInactive=yes
447 ResultActive=yes
448
449 *[MCE]: Media Center Edition
450 *[HTPC]: Home Theather Personal Computer
451 *[GRUB]: GRand Unified Bootloader
452 *[EDID]: Extended Display Identification Data
453 *[LIRC]: Linux Infrared Remote Control
454 *[ALSA]: Advanced Linux Sound Architecture
455 *[AV]: Audio Video
456 *[IR]: Infrared
457
458 [prdebug]: http://www.kernel.org/doc/local/pr_debug.txt "Enabling debug output in some Linux module"
459 [antec]: http://store.antec.com/Product/enclosure-veris_media/micro-fusion-remote-350/0-761345-15737-7.aspx "Antec Micro Fusion Remote 350 housing"
460 [555]: http://www.logitech.com/en-roeu/440/376 "Logitech Harmony® 555 Advanced Universal Remote"
461 [XBMC]: http://xbmc.org/ "XBMC Media Center"
462 [eden]: http://xbmc.org/natethomas/2012/03/24/xbmc-11-0-eden/ "XBMC 11.0: Eden"
463 [dirtyregions]: http://wiki.xbmc.org/index.php?title=Dirty_regions "Enabling dirty regions in XBMC Eden"
464 [xbmc-debian]: http://xbmc.org/theuni/2012/04/10/xbmc-accepted-into-debian/ "XBMC accepted into Debian"
465 [imon_mce]: https://gist.github.com/2466098#file_imon_mce "Keytable for iMON IR receiver with MCE keyboard"
466 [keymap]: https://gist.github.com/2466098#file_harmony.xml "Additional keymap for my setup with an Harmony remote control"
467 [congruity]: http://sourceforge.net/projects/congruity/ "GUI application to program your Logitech Harmony"
468 [harmony]: http://members.harmonyremote.com/ "Configure your Logitech Harmony"
469 [xbmc-keynames]: http://wiki.xbmc.org/index.php?title=List_of_XBMC_keynames "XBMC wiki: List of XBMC keynames"
470 [systemd]: http://www.freedesktop.org/wiki/Software/systemd "systemd, a system and service manager for Linux"
471 [video-nouveau]: http://nouveau.freedesktop.org/wiki/VideoDecoding "Video decoding support for nouveau driver"
472 [debian-installer]: http://www.debian.org/devel/debian-installer/ "Development version of the Debian Installer"
473 [#662086]: http://bugs.debian.org/662086 "Bug #662086: grub-install failed with raid+lvm"
474 [#670308]: http://bugs.debian.org/670308 "Bug #670308: vsftpd and systemd"
475
476 {# Local Variables: #}
477 {# mode: markdown #}
478 {# indent-tabs-mode: nil #}
479 {# End: #}
Something went wrong with that request. Please try again.