Friday, August 13, 2010

Old menelaus patches added to mainline tree

Reading the linux-omap mailing list, I saw that some old patches I submitted were added to the mainline tree some hours ago.

Basically, it's a simple patch to make both MMC slots work on N8X0 devices, and other patch to use macros instead of magic numbers on menelaus code.

Thanks to Jarkko Nikula for working on it.

Wednesday, October 28, 2009

Solving N810 keyboard problem on linux-omap 2.6.29

On previous post, one of the problems mentioned on 'Known Issues' when compiling and flashing the kernel 2.6.29-omap1 was related to the keyboard: some keys doesn't work, so we could not type commands on 'X Terminal'.

I proposed a patch that solves this problem to linux-omap mailing list. It's just need to set the value of platform parameter size_y to the correctly (12, instead of 8).

This simple modification makes now N810' keyboard work properly.

To test it, just apply this patch against the linux-omap tree (on version 2.6.29-omap1 - commit 58cf2f1425abfd3a449f9fe985e48be2d2555022), recompile and reflash the kernel.

How to make your N810 Internet Tablet recognizes an USB webcam and take pictures by flashing a new kernel image

This post will demonstrate how to make N810 recognizes an USB webcam and take pictures by flashing a new kernel image on device.

The equipments you need to execute this demonstration are follow:
  • A laptop or desktop computer
  • A N810 Internet Tablet
  • An UVC webcam: Logitech Quickcam Pro 9000
  • A self-powered USB hub

Download (clone) and compile kernel

In your computer (laptop or desktop), download (clone) linux-omap kernel tree to your desired directory:

$ git clone git://

Change to linux-omap-2.6 directory:

$ cd linux-omap-2.6

For this experiment, it's necessary to change to a specific commit:

$ git checkout 58cf2f1425abfd3a449f9fe985e48be2d2555022

This branch is related to v2.6.29-omap1 which it's possible to compile a bootable kernel image to N810. So, let's create a local development branch:

$ git checkout -b v2.6.29-omap1

Load N810 defconfig file:

$ make n800_defconfig

And before compile the kernel image, it's necessary to make some changes on defconfig, using:

$ make menuconfig

These changes are related to USB Gadget, Filesystem and UVC camera driver. DMA must be disabled in USB driver. In host mode DMA is not very usable, it's one transfer per packet. Find below the changes:

Device Drivers --->
Multimedia devices --->
[*] Video capture adapters --->
[*] V4L USB devices --->
<> USB Video Class (UVC)
[*] UVC input events device support

Device Drivers --->
[*] USB support --->
<*> USB Gadget Support --->
<*> USB Gadget Drivers (Ethernet Gadget (with CDC Ethernet support)) --->
(X) Ethernet Gadget (with CDC Ethernet support)

Device Drivers --->
[*] USB support --->
<*> Disable DMA (always use PIO)

File systems --->
<*> Second extended fs support
<*> Ext3 journalling file system support

It's necessary to install in your computer a cross-compiler. For this demonstration, I'm using the CodeSourcery cross-compiler, release 2007q3-53.

To compile the image and modules:

$ make zImage
$ make modules

The zImage can be found at arch/arm/boot/. The UVC camera driver module can be found at drivers/media/video/uvc/uvcvideo.ko. This module must be copied to the module kernel source directory structure of your N810 device.

Flashing the new kernel

To flash the new kernel in your device, you must use the flasher tool.

For this development purposes, some flasher options must be enabled:

# flasher --enable-rd-mode --set-rd-flags=no-omap-wd,no-lifeguard-reset

R&D mode was enabled in order to be able to use gainroot.

Flash the new kernel:

# flasher -k /location/of/your/kernel/arch/arm/boot/zImage -f -R

Activate host mode on N810

In your N810 device, activate host mode on N810. On device, start 'X terminal' application on Utilities menu and type:

$ sudo gainroot
# echo host > /sys/devices/platform/musb_hdrc/mode

Loading UVC camera module

Copy the UVC camera module from your memory card to the module kernel source directory structure:

# cp /media/mmc1/uvcvideo.ko /mnt/initfs/lib/modules/2.6.21-omap1/

And load the module with insmod utility:

# cd /mnt/initfs/lib/modules/2.6.21-omap1/
# insmod uvcvideo.ko

So, just connect the USB hub to your N810 and then connect the Logitech Quickcam to the USB hub.

The camera will be recognized and a new entry - /dev/video1 - related to this camera device is created. /dev/video1 it's a V4L2 device capable of video/streaming capture and supports MJPEG and YUV 4:2:2 (YUYV) formats.

Taking pictures from command line on N810

To take pictures from command line on N810, we can use gstreamer or uvccapture.

* Gstreamer

Using Gstreamer, it's necessary to install the packages gstreamer0.10-tools and gstreamer0.10-plugins-extra (from extras repository). gstreamer0.10-tools is a package of command-line tools to use Gstreamer.

On device, start 'X terminal' application on Utilities menu and type:

$ sudo gainroot
# apt-get install gstreamer0.10-tools gstreamer0.10-plugins-extra

Now, you can take a picture with:

# gst-launch-0.10 v4l2src device=/dev/video1 num-buffers=1 ! video/x-raw-yuv,width=352,height=288,framerate=10/1 ! ffmpegcolorspace ! jpegenc ! filesink location=/home/user/MyDocs/.images/file.jpg

With gstreamer, it's possible to take pictures without problems with resolutions up to 352x288.

* uvccapture

uvccapture is a command-line application to UVC cameras.

# ./uvccapture -x960 -y720 -d/dev/video1 -o/home/user/MyDocs/.images/file.jpg

Using uvccapture, it's possible to take pictures with resolutions up to 960x720.

Revert Changes

If you want to revert the changes applied:

# flasher -F FIASCO_IMAGE --flash-only kernel -f -R

You can download the FIASCO image (N810 OS image) to reflash your tablet here.

Known Issues

Find below some issues related to this demonstration:
  • Unfortunately, WLAN is not working for this kernel version (in fact for any recent omap kernel version). Looks like currently there's no way to compile firmware for it against the current kernels.
  • But for this kernel version, MMC (internal and external) card does work :) That's why I'm using it to transfer files from computer to device.
  • Last, but not least, for this kernel version, some keys on keyboard are no working. Actually, this problem was already solved and on the next post I'll explain how to fix it.
Some References

Friday, September 25, 2009

Retu watchdog turning off N810

Some days ago, using flasher, I decided to enable the R&D mode flag 'no-retu-wd', in order to disable watchdog on retu, using the following command:

$ flasher --set-rd-flags=no-retu-wd

In certain circumstances, like: excessive CPU usage, important process crasher, system lock up - hardware and software watchdogs/lifeguards reboots the device.

Retu is a custom ASIC chip that includes (at least) pseudo real-time clock control, power button control and a watchdog timer. On N810, there is a watchdog on the retu chip connected via cbus.

In fact, retu wd cannot be disabled due is controlled only by hardware means (resistance on a specific pin).

Anyway, if you try the command I mentioned above, N810 always turn off just after some (maybe 63) seconds after initialized.

So, avoid to try to disable the watchdog on retu, or your N810 will be turned off by its watchdog :) If you already disabled it, type the following command to revert the effects of 'disabling' retu wd:

$ flasher --clear-rd-flags=no-retu-wd