Search This Blog

Apr 26, 2011

Wireless USB transceiver stuff

Get input devices.

Where get my wireless USB mouse device information?
$ cat /proc/bus/input/devices
I: Bus=0003 Vendor=045e Product=0745 Version=0111
N: Name="Microsoft Microsoft® Nano Transceiver v2.0"
P: Phys=usb-fsl-ehci.1-1.3/input0
S: Sysfs=/devices/platform/fsl-ehci.1/usb2/2-1/2-1.3/2-1.3:1.0/input/input3
U: Uniq=
H: Handlers=kbd event3 
B: EV=120013
B: KEY=10000 7 ff800000 7ff febeffdf f3cfffff ffffffff fffffffe
B: MSC=10
B: LED=7

I: Bus=0003 Vendor=045e Product=0745 Version=0111
N: Name="Microsoft Microsoft® Nano Transceiver v2.0"
P: Phys=usb-fsl-ehci.1-1.3/input1
S: Sysfs=/devices/platform/fsl-ehci.1/usb2/2-1/2-1.3/2-1.3:1.1/input/input4
U: Uniq=
H: Handlers=kbd mouse1 event4 
B: EV=1f
B: KEY=837fff 2c3027 bf004444 0 0 1f0001 f84 8b27c000 667bfa d9415fed 8e0000 0 0 0
B: REL=3c3
B: ABS=1 0
B: MSC=10

I: Bus=0003 Vendor=045e Product=0745 Version=0111
N: Name="Microsoft Microsoft® Nano Transceiver v2.0"
P: Phys=usb-fsl-ehci.1-1.3/input2
S: Sysfs=/devices/platform/fsl-ehci.1/usb2/2-1/2-1.3/2-1.3:1.2/input/input5
U: Uniq=
H: Handlers=kbd js0 event5 
B: EV=10001f
B: KEY=837fff 2c3027 bf004444 0 c000000 1 10f84 8b27c007 ffff7bfa d941dfff febeffdf ffefffff ffffffff fffffffe
B: REL=40
B: ABS=ffffff01 701ff
B: MSC=10
From above messages, we can know this wireless USB transceiver contains 3 devices, there are keyboard,mouse, joystick. Also we know where they register.

Enable HID debug message output

If you want to see debug message when debugging HID device, please do following action.
$ echo 1 > /sys/module/hid/parameter
$ dmesg

Test mouse or keyboard under command line console.

$ cd /dev/input/
$ ls 
by-id    event0   event2   event4   js0      mouse0   uinput
by-path  event1   event3   event5   mice     mouse1
$ cat event4
# move your mouse or click on the buttons. We can see uart console output some character, that means mouse works.
S�v     S�v    S
S ����S  ����SS�' ����S�'  ����S�'S�F ����S�F  ����S�FS&f ����S)f  ����S1fSO� ����SS� 

Add other wireless USB transceiver support

We have a wireless transceiver, vendor is Sunplus, but i.MX53 has no response when plug in. The reason is that we didn't include its driver into kernel. Make one modification in imx5_defconfig, build uImage and done.

Apr 15, 2011

Mfgtools mkfs.vfat format fat parittion smaller than 1GB

vfat partition file system reports size is 0.99GB

We met problem when using Mfgtools to update android image to 4GB SD card on MX53 SMD board.I got Mfgtools-Rel-11.03.00_ER_MX53_UPDATER.tar.gz, extract it and select "MX53SMD-Android-SD" config to burn Android image to SD card. Mfgtools use "Profiles\MX53 Linux Update\OS Firmware\ucl.xml" to control burning operation. It will fdisk 5 partitions on SD card. First partition is vfat, and others are EXT4. We can look at part of the code:
"push" body="$ mkfs.vfat /dev/mmcblk0p1">Formatting sd partition
  "push" body="$ mkfs.ext4 /dev/mmcblk0p2">Formatting system partition
  "push" body="$ mkfs.ext4 -O^extent /dev/mmcblk0p4">Formatting recovery partition
  "push" body="$ mkfs.ext4 /dev/mmcblk0p5">Formatting data partition
  "push" body="$ mkfs.ext4 -O^extent /dev/mmcblk0p6">Formatting cache partition
My SD card is 4GB, in this case, vfat partition assigned 3.3GB. But after burn image complete, I found fat partition file system only 0.99GB. I checked update log message, found vfat partition information is correct, 3.3GB size. and format that partition with tool "mkfs.vfat", the problem should comes from this tool. Normally, it should be such as word length issue,32 bits variable has limitation to access GB space size. And from the log, it shows that "mkfs.vfat" version is 2.11, date is 2005. It is six years old.

Found patch via google.

find a bug report in debian, it is known issue that mkfs.vfat 2.11 has bug that will limit fat format size smaller than 1GB. Got the patch, it is very simple, Just add specific CFLAGS in debian/rules.
ifeq ($(ARCH),alpha)
-OPTFLAGS="-fomit-frame-pointer -fno-strict-aliasing"
+OPTFLAGS="-fomit-frame-pointer -fno-strict-aliasing $(shell getconf LFS_CFLAGS)"
-OPTFLAGS="-O2 -fomit-frame-pointer"
+OPTFLAGS="-O2 -fomit-frame-pointer $(shell getconf LFS_CFLAGS)"
$ getconf LFS_CFLAGS
OK, that is key point, it tells mkfs.vfat to support LARGEFILE_SOURCE and FILE_OFFSET_BITS is 64, that make sense.
Get LTIB1101, extract dosfstools package
$./ltib -m prep -p dosfstools
It extract source code in directory rpm/BUILD/dosfstools-2.11/, check debian/rules, but it already contains that patch. Oh, now we suppose that Mfstools default mkfs.vfat has problem, I need generate new mkfs.vfat to replace it.

Generate new Mfgtools ram rootfs.

Mfgtool use initramfs.cpio.gz.uboot as it rootfs when burning image.
execute ./ltib --selectype, select Mfgtools profile, and also select dosfstools and util-linux in package list, mkfs.vfat in dosfstools, sfdisk in util-linux. After building done, copy initramfs.cpio.gz.uboot to Mfgtools directory "Profiles\MX53 Linux Update\OS Firmware". Run Mfgtools to burn image into SD card, but unfortunately, vfat partitin file system report 0.99GB! Why?

Get latest dosfstools_3.0.11.orig.tar.gz

Just suppose this fix doesn't work at all, get latest dosfstools from Put it in /opt/freescale/pkgs/. Modify "ltib/dist/lfs-5.1/dosfstools/dosfstools.spec" to support this new package. Regenerate initramfs.cpio.gz.uboot, testing. Oh, the vfat partition size changed, it change to 2GB size! Oh, that is not my desire... 2GB size normally is FAT16 limitation, but it shows that is FAT32.Must something wrong. I doubt SD card driver has problem to access 2GB size, something like SDHC issue. I want to use "mkfs.ext4 /dev/mmcblk0p1" it shows 3.3GB. SD card driver has no problem, problem comes from mkfs.vfat.

Debug dosfstools_3.0.11 mkdosfs.

I choose ltib environment for debuging, use mx53 SMD board with NFS. Extract dosfstool package.
$./ltib -m prep -p dosfstools
$ cd rpm/BUILD/dosfstools_3.0.11
$ make -j2
We got mkfsdos, it link to mkfs.vfat. Copy it to /tftpboot/sbin. In mx53 smd console, excute "mkfs.vfat", but it report error and cannot run. And then I want to try use ltib to build.
$./ltib -m scbuild -p dosfstools
Copy mkdosfs to /tftpboot/sbin, it can run, but vfat partition size still not correct. What is the difference between LTIB scbuild and directly make under dosfstools directory? Compare the build process message, found when use ltib scbuild it will pass CFLAGS in it, that is to say, CFLAG in mkdosfs Makefile will has no use. Here is the command line when execute ltib scbuild.
arm-none-linux-gnueabi-gcc -c -Dllseek=lseek64 -D_LARGEFILE64_SOURCE mkdosfs
I think that is the root cause, the CFLAG definition for ltib scbuild in "dist/lfs-5.1/dosfstools.spec", modified it:
-make CC="${TOOLCHAIN_PREFIX}gcc" CFLAGS="-Dllseek=lseek64 -D_LARGEFILE64_SOURCE"
+make CC="${TOOLCHAIN_PREFIX}gcc" 
Build mkdosfs, copy it to /tftpboot/sbin, in mx53 SMD console
$ mkfs.vfat /dev/mmcblk0p1
$ mount -t vfat /dev/mmcblk0p1 /mnt
$ df
It shows 3.3GB.
We locate the root cause!

LTIB default dosfstools 2.11 also works

Turn back to LTIB default dosfstools 2.11, with same modification, mkfs.vfat make format the whole partition to correct size 3.3GB. Now, we known, the CFLAG in "dist/lfs-5.1/dosfstools.spec" cause the problem.

Apr 13, 2011

[ZAKER分享] 纽约时报书评:甘地是怎样炼成的

几年前,英国作家帕特里克•弗兰奇(Patrick French)造访了位于印度古吉拉特邦艾哈迈达巴德市郊的甘地纪念馆(Sabarmati ashram)。1930年,圣雄甘地(Mahatma Gandhi)领导的"食盐长征"正是从这里出发,向大海前进。让弗兰奇大为震惊的是,纪念馆的公共厕所竟然秽气熏天,于是他就去质问纪念馆秘书由谁负责打扫厕所。
莫罕达斯•K.甘地(Mohandas K. Gandhi)曾留学英国攻读法律,并取得了律师资格。1893年,年轻的甘地以律师的身份来到南非。
甘地曾经向世人发出过许多信息,有些被人们忽略了,有些遭到了误解,还有一些信息,即便是时至今日,仍然和第一次从他口中说出时一样至关重要。大多数美国人,其实还包括许多印度中产阶级在内,对圣雄甘地的了解都仅限于于本•金斯利(Ben Kingsley)在那部奥斯卡获奖影片中塑造的银幕形象。他在影片中的表演令人倾倒,但是电影剧本却差强人意,几乎没有触及现实世界中的甘地那种令人困惑的复杂性。彼时,他既是一位虔诚的朝圣者,同时也是一位狡猾的政治家,他是禁欲主义的拥护者、非暴力不合作主义(satyagraha,真理的力量)的缔造者、宗教复兴运动的领导者、革命者以及社会改革家。
而最令约瑟夫•莱利维尔德(Joseph Lelyveld)感兴趣的却是甘地的最后一重身份。用他自己的话来说,他的新作——《伟大的灵魂》一书专注讨论甘地"逐步形成的选民观和社会观"以及他随之而来的行动——竭力要将这种观念强加在其时正"虔诚而又执迷不悟"的印度之上。想要找出一位能够为甘地立传的作者,就印度洋两岸来说,莱利维尔德尤其有资格。他曾为《纽约时报》报道南非新闻(1986年,他以种族隔离为主题的著作——《走出阴霾》(Move Your Shadow)荣获普利策奖),在上世纪60年代末,他又在印度度过了多年的记者生涯。莱利维尔德的这本新书体现了一名记者健康的怀疑精神,也展现了一位"印度通"对印度次大陆及其人民显得有些偏执的强烈兴趣。
莱利维尔德提醒我们,事实上,将这种朦胧的信念转化成明确的行动,甘地也经历了很长的一段时期。1893年,23岁的莫罕达斯•卡拉姆昌德•甘地(Mohandas Karamchand Gandhi)从印度孟买来到南非德班,这位机敏的年轻律师在英国接受了专业教育。一位富有的印度穆斯林商人聘请他来到此地为其代理一桩枯燥沉闷的民事诉讼。最开始,甘地对南非的兴趣仅停留在当地的宗教和饮食方面,而并非政治。在早期的一则宣传广告中,他声称自己是"密宗基督教联盟和伦敦素食协会的代理人"。但是,莱利维尔德又写道,"南非……从一开始就对他提出了挑战——他不清楚如何去解释,有着褐色皮肤的他,是如何看待自己在南非的所作所为的。"
 一路走来,他树敌众多——那些认为他过于同情穆斯林的正统印度教徒,那些将他宗教团结的要求看成是印度教的一种阴谋的穆斯林,那些认为他只不过是一个冒充内行的激进革命分子的英国人等等。但是在所有的敌人中,才华横溢、脾气暴躁的贱民领袖比姆拉奥•拉姆吉•安培多伽尔(Bhimrao Ramji Ambedkar)却是最难以对付的。直到如今,西方社会对安培多伽尔还知之甚少。他认为甘地那些旨在铲除贱民制度的非暴力运动充其量只是一种杂耍表演。他甚至还反对甘地为他领导的贱民们杜撰的新名称——"神的子民"(Harijans),认为这词显得有些屈尊俯就;他更喜欢"达利"(Dalits)一词,在印度梵文中的意思是"压碎的"、"破碎的"。
杰弗里•C.沃德(Geoffrey C. Ward)是一名传记作家和纪录片编剧,他少年时期曾在印度度过数年,目前正在撰写一本有关印度分裂的著作。

Sent from my iPad

Apr 12, 2011

Android graphics benchmark

   We need to know graphics benchmark in Android.
1. Get Android benchmark apk and console application. List them all
apk files:

console files:

2. Install them into Android system via adb.
$ ./adb install ApiDemoes.apk
$ ./adb install com.qualcomm.qx.neocore.apk
# Install all apk into Android devices.
# And then we push console test files into /system/bin directory, this directory is read-only in default, remount it as read-write.
$ mount -o remount rw /system
$ ./adb push console_cube/ /system/bin/console_cube
$ ./adb push 3DMark/ /system/bin/3DMark

3. Run APPS in Android UI and get performance test result.

3D benchmark
Intro (3DMark)
Samurai (3DMark)
Proxycon (3DMark)
2D benchmark

ApiDemo (Graphics/OpenGL ES/Sprite Text)
SpeedTest (1024*600)
Landscape (Nop=0,GL=0)
Portrait (Nop=0,GL=0)
Landscape (Nop=2,GL=0)
Portrait (Nop=2,GL=0)
bmp 16bit, sur 16bit, landscape
bmp 16bit, sur 16bit, portrait
bmp 32bit, sur 32bit, landscape
bmp 32bit, sur 32bit, portrait
bmp 32bit, sur 16bit, landscape
bmp 32bit, sur 16bit, portrait
bmp 16bit, sur 32bit, landscape
bmp 16bit, sur 32bit, portrait
Fill Rectangle (Test 1)
Stretch blit with Dither (Test 2.1)
Stretch blit without Dither (Test 2.2)

Dimming (Test 3)

256 color pallet blit (Test 4.1)

Stretch blit (Test 4.2)

Draw line (Test 5)
2D/3D benchmark
1098 (Total)
218 (2D)
262 (3D)