User Tools

Site Tools


usbsound

Booting from USB key with USB sound support and Music Player Daemon

Introduction

Based on Boot a LaCie NAS (Kirkwood based) from an USB key this document intends to provide further information on how to use USB sound card and Music Player Daemon on LaCie Network Space 2. The setup works reasonably well using a cheap 4-port USB hub, but beware that booting from USB fails if USB sound card is turned on during the bootup. The sound card used in this setup was Cambridge Audio DacMagic but any other USB card will do.

Preparing USB key and booting

1. Setup USB key with raw image ftp://ftp.lacie-nas.org/images/usb_boot_kw_sid_arm-usbsound.img.gz

      sudo chmod 666 /dev/sdX
      zcat usb_boot_kw_sid_arm-usbsound.img.gz > /dev/sdX

Be sure to check your USB disk's correct path with dmesg|tail first.

3. Using GParted or other partitioning software of your like resize the second partition larger, for example:

      sudo gparted /dev/sdX
      right-click on /dev/sdX2 partition, select 'Unmount' and 'Resize/Move'
      write changes to disk

4. Boot from USB key following steps in Boot a LaCie NAS (Kirkwood based) from an USB key

Troubleshooting

There are issues with certain USB keys (for instance Kingston 2 GB didn't work for me, http://3ecomputer.com/shop/images/dt2.jpg), so if you don't succeed first, try another USB key. Also, keep your USB sound card turned off during the boot, it can mess 'usb reset' stage in u-Boot.

Configuring USB sound

After bootup, plug in your USB card. If everything goes fine you'll see success in lsmod output:

      Module                  Size  Used by
      snd_usb_audio          67546  0
      snd_pcm                59748  1 snd_usb_audio
      snd_timer              16832  1 snd_pcm
      snd_page_alloc          4539  1 snd_pcm
      snd_hwdep               4779  1 snd_usb_audio
      snd_usbmidi_lib        16013  1 snd_usb_audio
      snd_rawmidi            15473  1 snd_usbmidi_lib
      snd                    33602  6 snd_usb_audio,snd_pcm,snd_timer,snd_hwdep,snd_usbmidi_lib,snd_rawmidi
      soundcore                678  1 snd

In this project USB sound card is forced to be the first (default) sound card in /etc/modprobe.d/alsa-base.conf (options snd-usb-audio index=0). If however alsamixer doesn't start, you might want to double-check alsa-base.conf and run alsa reload.

Installing and configuring Music Player Daemon

UPDATE: MPD has been updated to version 0.16.1 in Debian Sid repository. Installing MPD should be as easy as running apt-get install mpd.

Edit /etc/mpd.conf and make the following changes:

      music_directory         "/path/to/your/music"
      audio_output {
              type "alsa"
              name "my ALSA device"
              device "hw:0,0"
              mixer_type "disabled"
              auto_resample "no"
      }

Run /etc/init.d/mpd restart

Compiling Music Player Daemon from sources (optional)

1. Install needed packages (you can leave some out if you don't for instance need MPC support):

apt-get install gcc make libglib2.0-dev libasound2-dev libcue-dev libcurl4-openssl-dev libflac-dev libogg-dev 
libshout3-dev libmpg123-dev libmad0-dev libid3tag0-dev libmpcdec-dev libfaad-dev libvorbisidec-dev libmodplug-dev 
libsndfile1-dev libaudiofile-dev libwavpack-dev

2. Download the latest MPD sources from http://sourceforge.net/projects/musicpd/files/mpd/0.16.1/ and compile with:

tar zxvf mpd-0.16.1.tar.gz
cd mpd-0.16.1
sh configure --with-tremor; make; make install
usbsound.txt · Last modified: 2011/02/05 16:05 by 80.186.36.216