I need an idiot's guide on how to get sound out of a QEMU arm emulation. I am not ( a coder, or advanced Linux user).
My own idea was to use my external USB DAC for audio playback. My host is 64bit aptosid install (based on debian unstable) which is configured to use ALSA.
I've only just found this thread, and so have only previously followed this guide using the most recent kernel/initrd files:
The final QEMU command I ended up using was:
QEMU_AUDIO_DRV=alsa qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.32-5-versatile -initrd initrd.img-2.6.32-5-versatile -hda debian_squeeze_armel_standard.qcow2 -append "root=/dev/sda1" -redir tcp:5022::22 -usb -usbdevice host:08bb:2902 -nographic
This allows me to ssh into the arm emulation.
I soon found you get USB errors unless you use the latest version of QEMU, which I compiled from source with this config.
./configure --target-list="arm-softmmu" --enable-sdl --audio-drv-list=alsa,oss
QEMU emulator version 1.0.50, Copyright (c) 2003-2008 Fabrice Bellard
(Hopefully, there was no error there. I checked QEMU ALSA driver was made with: qemu-system-arm -audio-help.)
I did an apt-get for alsa-base, alsa-utils, linux-sound-base and mplayer. Added a normal user and added that user to the audio group. The external USB DAC is recognised.
dmesg | grep usb
[ 10.748371] usbcore: registered new interface driver usbfs
[ 10.801411] usbcore: registered new interface driver hub
[ 10.815537] usbcore: registered new device driver usb
[ 11.531914] usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
[ 11.536095] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 11.544624] usb usb1: Product: OHCI Host Controller
[ 11.549129] usb usb1: Manufacturer: Linux 2.6.32-5-versatile ohci_hcd
[ 11.553912] usb usb1: SerialNumber: 0000:00:0c.0
[ 11.562799] usb usb1: configuration #1 chosen from 1 choice
[ 12.581601] usb 1-1: new full speed USB device using ohci_hcd and address 2
[ 13.306081] usb 1-1: New USB device found, idVendor=08bb, idProduct=2902
[ 13.324955] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 13.330912] usb 1-1: Product: USB Audio CODEC
[ 13.335381] usb 1-1: Manufacturer: Burr-Brown from TI
[ 13.405726] usb 1-1: configuration #1 chosen from 1 choice
[ 14.156187] usbcore: registered new interface driver hiddev
[ 24.255536] generic-usb 0003:08BB:2902.0001: timeout initializing reports
[ 24.310340] input: Burr-Brown from TI USB Audio CODEC as /devices/pci0000:00/0000:00:0c.0/usb1/1-1/1-1:1.3/input/input2
[ 24.421463] generic-usb 0003:08BB:2902.0001: input,hidraw0: USB HID v1.00 Device [Burr-Brown from TI USB Audio CODEC ] on usb-0000:00:0c.0-1/input3
[ 24.591342] usbcore: registered new interface driver usbhid
[ 24.700441] usbhid: v2.6:USB HID core driver
[ 75.451474] usbcore: registered new interface driver snd-usb-audio
And the correct snd modules appear to be loaded:
I copied a working asound.state for the USB DAC file from my host. The commands alsactl init, and aslactl -f /var/lib/alsa/asound.state restore return no errors. But mplayer fails with:
mplayer -ao alsa:device=hw=1.0 test.wav
MPlayer 1.0rc3-4.4.4 (C) 2000-2009 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Audio only file format detected.
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 44100 Hz, 2 ch, s16le, 1411.2 kbit/100.00% (ratio: 176400->176400)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
[AO_ALSA] alsa-lib: pcm_hw.c:326:(snd_pcm_hw_hw_params) SNDRV_PCM_IOCTL_HW_PARAMS failed (-5): Input/output error
[AO_ALSA] Unable to set hw-parameters: Input/output error
Failed to initialize audio driver 'alsa:device=hw=1.0'
and aplay fails with the same type of error. The USB error is reported in dmesg as:
[ 282.158010] 2:1:1: usb_set_interface failed
It's a pity, I would like to have heard some Bach from the arm emulation ...
This lead me to think (a) QEMU may have some USB limitation, and/or (b) my ALSA config is incorrect in some way ( is a speical /etc/asound.conf or ~/.asoundrc needed?), and/or (c) there is something wrong/missing with the kernel and hd file I'm using. I think the correct sound devices have been created.
A trawl of the web didn't show up much, so any help would be much appreciated.