Introduction
This guide will talk about the specificities of android phones, more specifically qualcomm devices(msm and snapdragoon)
Common to most Android phones
kernel selection
If your device is supported by a cyanogenmod kenrel take it as a starting point.
wakelocks and suspend
Use the android fsousaged plugin for handling suspend resume, note that this plugin depend on a kernel part will tell the userspace the cause of the resume, on the htc dream it's implemented as theses 2 commits: commit1 and commit2
Screen resume
- handle it in the kernel like for the htc dream
- handle it in userspace in the android suspend fsousaged plugin making it run that command when the phone is resumed:
chvt 1;chvt 2
leds instead of backlight
Usually android phones uses /sys/class/led for the lcd backlight, instead of /sys/class/backlight. There are 2 ways to handle it:
- make a new fsodeviced plugin or improve an existing one to handle leds backlights.
- handle it in the kernel like for the htc dream(2.6.32) or for the nexusone(2.6.37)
SOC
A SOC or system on a chip is like a CPU, but with some peripherals on the same chip, for instance on the qualcomm devices you have in one chip:
- The CPU
- The modem
- The audio(connected to the modem)
- The GPS (connected to the modem)
sound
MSM and Snapdragoon
The msm7k devices like the htc dream have some alsa drivers(in sound/soc/msm) that can be found in various devices kernel, on codeaurora. there are different versions, some use .mmap some don't(if you can make .mmap work fine use that since it gives sound multiplexing)
The snapdragoon devices like the nexus one now have a compatible alsa driver.
Previsously when the alsa driver was not written yet, a .asoundrc trick was created (that file went in /home/root/.asoundrc):
pcm.qsd8k {
type plug
slave {
pcm "file:/dev/msm_pcm_out,raw"
format S16_LE
rate 44100
channels 2
}
}
# Device for playing media audio
pcm.softvol {
type softvol
slave.pcm "qsd8k"
control.name "PCM"
control.card 0
}
pcm.!default {
type plug
slave.pcm "softvol"
}
Wifi and bluetooth
bcm4329 (wifi)
The android devices usually use the bcm4329 wifi driver for the broadcom 4329 cards, this driver is a WEXT driver and lacks cfg80211/libnl interface and has issues with scanning. I found 2 broadcom drivers on AOSP:
Note that:
- the htc HD2(also known as htc leo) device have working scan with bcm4329
- There is an htc hd2 wifi page
- on the nexusone the following changes are needed:
- replace -DCSCAN by -DWL_IW_USE_ISCAN in the bcm4329 Makefile
- scan for wireless network like that:
iwlist eth0 scan essid ""
The mainline driver which is compatible with the bcm4329 chip is:
/drivers/net/wireless/brcm80211/brcmfmac
bcm4329 (bluetooth)
See the htc HD2 bluetooth page for more details
wl1251_sdio
- The android devices that have a wl1251 sdio card usually use the ti wlan driver
- Mainlines kernel have a wl1251_sdio standard driver, to make it work on older kenrels(without the runtime PM API (without support for it in your SDIO drivers you can't use that) ) you need:
- that commit for passing data to the wl1251_sdio driver
- that activator for enabling wifi : modprobing that loads the wifi driver, and rmmoding removes it (it assume that you have wl1251_sdio driver already loaded)
GPS
- The GPS works on the htc dream(it has been converted from an android library to a GNU/Linux standalone activator called by ogpsd(we also have a new standalone dbus-aware activator ) and it uses the autotools build system)
- if you have a different modem than the htc dream, look at the official android GPS libraries sources and do the same conversion than the htc dream
- gpstest in the android sources is capable of activating the GPS on android,for instance you could chroot that like this to do a quick test with the free android libraries:
mount -o bind /dev dev mount -o bind /proc proc mount -o bind /sys sys mount -t yaffs2 /dev/mtdblock3 system mkdir -p dev/oncrpc cd dev/oncrpc ln -s ../30* ./ cd ../../ chroot ./ /system/xbin/gpstest
Modem(telephony)
msm7k
- the msm7k have an fsogsmd plugin for them
snapdragoon
- The newer snapdragoon seem to work fine with the singleline plugin
- The newer snapdragoon require an activator to get audio during calls, that activator should be integrated in fsoaudiod.
data/3g
- both the msm7k and the snapdragoon use the pdp_qmi plugin
- The other devices usually use one of the ppp plugins
usbnet
Usbnet is crucial for permitting you to ssh into your device when the rest doens't work(that's usually the case at the beginning of the port). To make usbnet work, select usbnet in the kenrel and add the following includes in drivers/usb/gadget/composite.c:
#include <linux/delay.h> #include <linux/kdev_t.h>
Xorg
- Add CONFIG_VT(virtual terminal) in your kenrel
- try xf86-video-fbdev at first
- your kenrel may need a refresh thread in the framebuffer driver or not...
- remove VGA_CONSOLE(vga text console) else you'll have that:
drivers/video/console/vgacon.c: In function ‘vgacon_startup’: drivers/video/console/vgacon.c:508:18: error: ‘PCIMEM_BASE’ undeclared (first use in this function) drivers/video/console/vgacon.c:508:18: note: each undeclared identifier is reported only once for each function it appears in drivers/video/console/vgacon.c: In function ‘vgacon_do_font_op’: drivers/video/console/vgacon.c:1073:22: error: ‘PCIMEM_BASE’ undeclared (first use in this function)
