Sunday, October 24, 2010

android tool box

Emulator:
emulator -cpu-delay 0 -no-boot-anim -cache ./cache  -avd froyo


adb log view:
adb -e logcat

(-d if device, -s xxxx if multiple emulators/devices)

and for the code:
import android.util.Log;
[...]
Log.d(TAG, sb.toString());


controling the emulator (will never understand why it's not implemented in the shell...)
telnet localhost 5554
# gsm call 5555
# sms...

android build on device and emulator

`ant install` will freak out and die if you have more then one device in `adb devices`

but it has an option in its rules called adb.device.arg, which is not really an adb device arg, but more like an adb arg. so you can pass any argument to adb there.

in my case since i only have one emulator and one device simply passing "-d" for device or "-e" for emulator solves it. you can also pass "-s id_of_device_or_emulator"

since i'm clueless to ant i will use the easiest solution and pass that as an argument every single time:

ant install -Dadb.device.arg="-d"


if you are clever than me, pls comment on how i create a simple `ant installdevice` rule that simply sets that var and then run the install target, please.

Android USB debugging in linux

get the device vendor string:
$ lsusb
...
Bus 001 Device 005: ID 18d1:4e12 Google Inc. Nexus One Phone (Debug)
...


add a rule to udev to allow read/write

# cat SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666" > 
/etc/udev/rules.d/51-android.rules


disconnect and reconnect the usb cable. done.

Wednesday, October 20, 2010

openwrt, static DHCP

use the correct pieces. hosts files to map from ip to host, and ether file to map from mac to name/ip.


# cat /etc/hosts

127.0.0.1 localhost

192.168.1.10 OpenWrt
192.168.1.101 printer

192.168.1.201 inutil
192.168.1.202 jabuti


On the ethers file you can also use IP instead of names, but names are better, so you don't have redundant/conflicting info with the hosts file.

# cat /etc/ethers

01:12:33:dd:c0:0b inutil
01:56:c5:bb:22:0b jabuti




# /etc/init.d/dnsmasq restart



You may need to also edit
/etc/config/dhcp
, mainly to make sure you have "config dnsmasq" section