3

With the help of the book "Embedded Android" by Karim Yaghmour I managed to learn enough about Android's build process last fall. With enough fiddling around and Google'ing I learned a sufficient amount of *nix commands with just enough Bash scripting to make myself a little CM-10.1 ROM, which mounts a Linux .img file during boot.

My laptop recently became inoperable after a batched Windows install, so this little ROM has become my only source of sufficient computing power.

History aside, I have been messing around with some command-line utilities such as nvlc and stagefright. stagefright works to no surprise as it is a "native" Android application.

Using the following command:

stagefright -ao test.mp3

I can launch a song and listen to it, while ssh'ed into my device. I generally use terminal emulator to use CM's su to get the glibc sshd running like so:

su -c '/bin/su'
service ssh start

Then I ssh in from my ancient tower, which has a keyboard and a large screen. Since I am sshing into the glibc based ssh server, it uses PAM's unix2 module to authenticate with /etc/passwd and /etc/shadow. This is nice, since I can configure it like I am used to.

From there though, say I want to launch nvlc to jam out, it won't work. And well, stagefright isn't as nice as nvlc in my opinion.

This is some output of what I have done so far:

root@Flubber:/sdcard/Music$ lspci
pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.

root@Flubber:/etc/init.d# aplay --list-devices
**** List of PLAYBACK Hardware Devices ****
card 0: msm8960sndcard [msm8960-snd-card], device 0: MultiMedia1 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 1: MultiMedia2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 2: CS-Voice (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 3: VoIP (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 4: LPA (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 5: SLIMBUS_0 Hostless (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 6: INT_FM Hostless (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 7: AFE-PROXY RX msm-stub-rx-7 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 9: COMPR (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 10: AUXPCM Hostless (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 11: HDMI_RX_HOSTLESS (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 12: VoLTE (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 13: Voice2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 14: MultiMedia5 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 15: (Internal BT-SCO Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 17: (Internal FM Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 19: (HDMI Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 20: (AFE Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 22: (AUX PCM Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 24: (Voice Farend Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 27: (Primary I2S Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

root@Flubber:/etc/init.d# ./alsa-utils start 0
[ ok ] Setting up ALSA card 0...done.

brainard@Flubber:/sdcard/Music$ cvlc SlipKnoT\ -\ Spit\ It\ Out\ \[DUBSTEP\ REMIX\ by\ Elysium\]\ \*with\ musicvideo\*\ \[HD\ \].mp3 
VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
[0x92c0c8] inhibit interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[0x92c0c8] main interface error: no suitable interface module
[0x8b4b80] main interface error: no suitable interface module
[0x8943e8] main libvlc error: interface "globalhotkeys,none" initialization failed
[0x8b4b80] dummy interface: using the dummy interface module...
shm_open() failed: Permission denied
[0x8b5448] pulse audio output error: PulseAudio server connection failure: Connection refused
shm_open() failed: Permission denied
[0x8b5448] alsa audio output error: cannot open ALSA device "default": Invalid argument
[0x8b5448] main audio output error: Audio output failed
[0x8b5448] main audio output error: The audio device "default" could not be used:
Invalid argument.
[0x8b5448] oss audio output error: cannot open audio device (/dev/dsp)
[0x8b5448] main audio output error: no suitable audio output module
[0x8b7f80] main decoder error: failed to create audio output
[0x9200b0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 300 ms)
[0x9200b0] main input error: ES_OUT_RESET_PCR called
^C

I have installed the alsa-utils as you can see, as well as pulseaudio and assigned my user to the audio group of GID 1005, because that's the GID of audio on Android.

I'm not sure if this is a configuration issue, a driver issue, or something else. I've never had to configure audio before, it's always just worked on Linux.

Since this is on an Android device, I didn't expect it to work, but then again other things work like network access and writing to sdcards do. I had to create groups and add my user to them though to gain permission from Android.

  • Is there anything I can do?
  • Is the way audio works on Android just too different?

As far as I know, Android uses tiny-alsa sometimes, and may use HAL but at that point, its a bit over my head.

What would be a good source of info?

I don't really want to spend a whole lot of time on this, a week or two tops, bad info has wasted a lot of my time in the past which can be really frustrating.


Update

I stumbled across a thread at the Gentoo forums while Google'ing some of the errors I have been getting and it turns out tmpfs actually has to get mounted to /run/shm.

So I put this in my /etc/fstab file , as per the thread at Gentoo forums:

none    /dev/shm        tmpfs   nodev,nosuid,noexec     0       0

and then executed sudo mount /dev/shm. Then I did:

brainard@Flubber:/sdcard/Music$ aplay -vv Track_1.wav 
**aplay: main:682: audio open error: Invalid argument**

and got that output: no failure to open shared memory.

Also, in /proc/asound :

brainard@Flubber:/proc/asound$ ls
card0  cards  devices  hwdep  msm8960sndcard  pcm  timers  version

brainard@Flubber:/proc/asound$ cat version 
Advanced Linux Sound Architecture Driver Version 1.0.25.

And the speaker-test :

brainard@Flubber:/proc/asound/card0$ speaker-test -Ddefault:0 -twav
speaker-test 1.0.25

Playback device is default:0
Stream parameters are 48000Hz, S16_LE, 1 channels
WAV file(s)
Playback open error: -22,Invalid argument

Hopefully that might help someone help me, and thank you in advance. If you need any more info, just ask, I'll be happy to.

Update 2

I popped open alsamixer and discovered well over 300 different "items" (more like 400+, I stopped counting at 300) related to this single card. Some of them have to do with HDMI, others with VoIP, some with VoLTE, most are muted, off, or at zero and I have no idea what they are for. I suppose if someone knew what they were doing and got this working, it could be rather powerful.

I ran this: alsactl init

root@Flubber:/etc/init.d# alsactl init
Found hardware: "msm8960-snd-car" "" "" "" ""
Hardware is initialized using a generic method

And it seems after all this, stagefright doesn't work any more. It just returns segfault I guess thats my fault ;) Hopefully a reboot fixes it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.