PaNiC Random Rant (or how we used to call it: .plan)
OpenPanzer HTML5 Game
Some time ago, I was reading an article about how HTML5 will completely replace Flash games, videos and future is HTML5.
I was so out of loop, these kind of statements were made years earlier . Even Mr. Ballmer said that HTML5 is the future in 2010, and this guy is rare^H^Hndomly wrong ! So after I carefully checked that HTML5 is not some name for another *crossplatform* Silverlight technology I decided to not let this future technology wash over me like I did on so many other "the future is ..." web standards and maybe I could stand up to the puppies that were laughing at me with "oh you're using table tag".
Armed with a well supported open standard, a vision of the future, an unbearable thirst of knowledge and a willingness to make my iPad useful I planned to do a game in my spare time.
At least it will be looking like I'm working and not doing something fun with the computer, which can save me from different house and family obligations.
The shameful observations like "You came from work and already playing that stupid game ?" , will be turned into "Poor guy, he's working all day at work and then at home".
So it turned out in a turn and hex based strategy game based on classic Panzer General 2.
More about it: here
P.S. Testing still bring shameful observations, but at least I can do the testing on my iPad in some special places.
Android ICS running on picoSAM9 board (Atmel ARM 926 400Mhz CPU)
The once-in-a-while obligatory update. Android Ice Cream Sandwich tablet mode running pretty well on a 400Mhz ARM with no acceleration.
Next in queue will be Ethernet patches ported to ICS.
Android patches for kernel 3.1
Patches are available as either 1 big file or broken down. Patches were tested and found working under Android Gingerbread 2.3.4.
To activate adb add these lines in init.rc (or init.rc.
# New ADB setup for kernel 3.1
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/functions adb
write /sys/class/android_usb/android0/enable 1
Single patch
Broken down patches
Ethernet patch for Android Gingerbread
Finished porting the ethernet patch from android-x86 froyo branch to gingerbread and made them available on picopc android gingerbread repository here: https://gitorious.org/picopc-android-gingerbread (see the commits in frameworks-base, build and packages-apps-settings)
Changes from the android-x86 version:
- fixed static ip not being correctly setup
- added new icons for status bar
- changed status bar policy code
Remember to add dhcpcd_eth0 service in init.rc:
service dhcpcd_eth0 /system/bin/dhcpcd -BKL -d eth0 -dd
group system dhcp
disabled
oneshot
Direct download links to the patches:
patch /build repository
patch frameworks/base repository
patch /packages/apps/Settings repository
Labels: android
Android 2.3.4 gingerbread updated wireless patches
Updated wpa_supplicant_6 patch with google private ioctls emulated and other fixes (like no scan results showing issue):
https://gitorious.org/picopc-android-gingerbread/external-wpa_supplicant_6/commit/5f5c50d722eedaedd75c1698b79f464310ce6478?format=patch
Updated patch to use built-in kernel wifi drivers for android:
https://gitorious.org/picopc-android-gingerbread/hardware-libhardware_legacy/commit/6bc330e05f5f69e9352e52451f93ca69cfa44d48?format=patch
Patch to prevent enabling of the wifi when no device or driver present:
https://gitorious.org/picopc-android-gingerbread/hardware-libhardware_legacy/commit/b7c12215f7aa2176c4636306adcabf1e95624005
Patch to fix the crash(sigbus on armv5) when starting bluetooth:
http://review.source.android.com/#change,22734
Labels: android, gingerbread, wifi
Porting WiFi drivers to Android
Update(19/05/2011): Verify validity against Gingerbread.
Update (11/08/2010): Updated patch to fix the loading of awext driver at run time.
Added STOP and RESTART commands.
For mini-box.com picoPC we want to support several USB and miniPCI WiFi dongles, this guide provides a step by step explanation of what's involved in adding a new wifi driver and making wifi work in a custom Android build (this guide was written for android 2.1 but should be applicable to previous android releases and hopefully future releases).
Contents
0. Understand how Android WiFi works.
1. Enable building of wpa_supplicant in your BoardConfig.mk
2. (Optional) Enable debug for wpa_supplicant.
3. Provide a proper wpa_supplicant.conf for your device
4. Have the correct paths and permissions created from init.rc
5. Make sure your wpa_supplicant and dhcpcd (optional) are starting from init.rc
6. Provide your driver either as a module or built in kernel and proper kernel support for it and modify Android source code accordingly.
7. Provide a firmware if your module needs it.
8. Make your driver work with Android custom wpa_supplicant commands and SIOCSIWPRIV ioctl
Now onto details.
0. Understand how Android WiFi works.
Android uses a modified wpa_supplicant (
1. Enable building of wpa_supplicant in your BoardConfig.mk
This is by simply adding:
If you have a custom wpa_supplicant driver (like madwifi or my custom android private commands emulation - see last paragraph) you can replace WEXT with AWEXT or your driver name (MADWIFI, PRISM etc).
2. (Optional) Enable debug for wpa_supplicant.
By default wpa_supplicant is set to
To enable more messages:
2.1 modify
2.2 modify
3. Provide a proper wpa_supplicant.conf for your device
Providing a wpa_supplicant.conf it's important because the control socket for android is specified in this file (ctrl_interface= ). This file should be copied by your
There are two different ways in which wpa_supplicant can be configured, one is to use a "private" socket in android namespace, created by
Minimum required config options in wpa_supplicant.conf :
- Android private socket
ctrl_interface=wlan0
update_config=1
- Unix standard socket
ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi
update_config=1
Depending on your driver you might also want to add:
ap_scan=1
If you have AP association problems with should change to
If you want to let wpa_supplicant connect to non-WPA or open wireless networks (by default it skips these kind) add:
network={
key_mgmt=NONE
}
4. Have the correct permissions and paths created from init.rc
Incorrect permisions will result in wpa_supplicant not being able to create/open the control socket and
Since Google modified wpa_supplicant to run as wifi user/group the directory structure and file ownership should belong to wifi user/group (see
Otherwise errors like:
E/WifiHW ( ): Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": No such file or directory will appear.
Also wpa_supplicant.conf should belong to wifi user/group because wpa_supplicant will want to modify this file. If your system has /system as read-only use a location like /data/misc/wifi/wpa_supplicant.conf and modify wpa_supplicant service in init.rc with new location.
Make sure the paths are correctly created in init.rc:
mkdir /system/etc/wifi 0770 wifi wifi
chmod 0770 /system/etc/wifi
chmod 0660 /system/etc/wifi/wpa_supplicant.conf
chown wifi wifi /system/etc/wifi/wpa_supplicant.conf
#wpa_supplicant control socket for android wifi.c (android private socket)
mkdir /data/misc/wifi 0770 wifi wifi
mkdir /data/misc/wifi/sockets 0770 wifi wifi
chmod 0770 /data/misc/wifi
chmod 0660 /data/misc/wifi/wpa_supplicant.conf
chown wifi wifi /data/misc/wifi
chown wifi wifi /data/misc/wifi/wpa_supplicant.conf
If you use a Unix standard socket in wpa_supplicant.conf (see above) add:
# wpa_supplicant socket (unix socket mode)
mkdir /data/system/wpa_supplicant 0771 wifi wifi
chmod 0771 /data/system/wpa_supplicant
chown wifi wifi /data/system/wpa_supplicant
Do not add these if you use Android private socket because it will make wpa_supplicant non-functional, because
5. Make sure your wpa_supplicant and dhcpcd are starting from init.rc
For wpa_supplicant the init.rc startup like should be depending on which path you chosen:
- Android private socket:
service wpa_supplicant /system/bin/wpa_supplicant -dd -Dwext -iwlan0 -c /system/etc/wifi/wpa_supplicant.conf
socket wpa_wlan0 dgram 660 wifi wifi
group system wifi inet
disabled
oneshot
- Unix standard socket:
service wpa_supplicant /system/bin/wpa_supplicant -dd -Dwext -iwlan0 -c /system/etc/wifi/wpa_supplicant.conf
group system wifi inet
disabled
oneshot
If your wifi driver creates a wifi interface with other name than
You also should have dhcpcd starting from init.rc
service dhcpcd /system/bin/dhcpcd wlan0
group system dhcp
disabled
oneshot
Newer AOSP versions after Gingerbread use dhcpcd_wlan0 as service name.
6. Provide your driver either as a module or built in kernel and proper kernel support for it.
First make sure that CONFIG_PACKET and CONFIG_NET_RADIO (wireless extensions) are enabled in your kernel. The driver can be built as module (default android way) or built in kernel (if you want to rely in kernel auto probing to support multiple driver eg. USB wifi) but will require source code modifications (see below).
- As kernel module:
Define in your
1.
You need to specify module name in that path too, usually should look something like /system/lib/modules/wlan.ko
2.
3.
Make sure you copy your kernel module when building android to the correct location.
- As built in kernel:
- First
setprop wifi.interface "wlan0"
setprop wlan.driver.status "ok"
Do NOT add
- Secondly
You might encounter problems with WifiHW module not being able to connect to wpa_supplicant socket even with the correct permisions. Try to turn off / turn on Wifi from the GUI.
7. Provide a firmware if your driver needs it
If your driver needs a firmware you will have to copy this firmware file to
Firmware file name is defined by the driver and might also contain a folder like: RTL8192SU/rtl8192sfw.bin, entire file path should be available in
8. Make your driver work with Android custom wpa_supplicant commands and SIOCSIWPRIV ioctl.
Android uses
The errors from not having this ioctl implemented will look like:
E/wpa_supplicant( ): wpa_driver_priv_driver_cmd failed wpa_driver_priv_driver_cmd RSSI len = 4096
E/wpa_supplicant( ): wpa_driver_priv_driver_cmd failed
D/wpa_supplicant( ): wpa_driver_priv_driver_cmd LINKSPEED len = 4096
E/wpa_supplicant( ): wpa_driver_priv_driver_cmd failed
I/wpa_supplicant( ): CTRL-EVENT-DRIVER-STATE HANGED
After 4, WEXT_NUMBER_SEQUENTIAL_ERRORS errors, android will abort using the device.
To quickly test your wifi from interface you can disable error checking in
To proper implement the ioctl you will need to modify your kernel driver to reply to SIOCSIWPRIV ioctl with RSSI (signal strength) and MACADDR commands being the most important.
A better way is to add a custom driver_xxx.c to google
Below is a link to a patch for wpa_supplicant that I did for mini-box.com picoPC Android build. It creates a new driver
How to use the new driver:
1. In your
2. Change
AWEXT driver patch download: android_wext_emulation_driver_awext.patch
For Gingerbread patches see the post above.
Labels: android, wifi, wpa_supplicant
Using both memory controllers with SPARSE_MEM on Atmel SAM9G45/M10
Atmel AT91SAM9G45 and AT91SAM9M10 (AT91SAM9263 has a similar layout) have two memory controllers providing 128Mb at locations
Both banks must be initialized by AT91Bootstrap, if you use AT91Bootstrap from AT91SAM9G45/M10 SDK see the patch below. Also if u-boot is used as bootloader and you want to use second bank it needs to be patched too.
My patches wore made for 2.6.30 kernel updated patches should be available below:
AT91Bootstrap (from G45 SDK):
0001-Init-second-bank-of-memory-0x20000000.patch
U-Boot:
0001-add-support-for-both-banks-of-memory-on-Atmel-G45-bo.patch
Kernel:
Add to boot params to enable both mem banks(for example on u-boot bootparams=) :
For kernels <= 2.6.30:
0001-Add-SPARSEMEM-support-for-Atmel-CPU-for-2-banks-of-m.patch
0010-Fix-memory-mapping-for-SPARSEMEM-to-use-both-banks-o.patch
For kernels >2.6.30 (patch is for 2.6.34):
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6143/1