2.6.25 and BT working on Gumstix

I finally got the Bluetooth working with my Gumstix running 2.6.25 and my linux setup. My patches are against two weeks old kernel but hopefully apply to current HEAD too. The patches include my kernel config: gumstix-verdex-bt.config too.

I had to configure the BT hardware using pxaregs and /prog/gpio in my startup scripts (copied from some OE image):


echo -n "Starting 32kHz clock..."
/usr/sbin/pxaregs OSCC_OON 1
while /usr/sbin/pxaregs OSCC_OOK | tail -n 1 | grep -q -v 1;do
echo -n '.'
sleep 1
done
echo "Settled"

/sbin/modprobe gumstix_bluetooth
/sbin/modprobe proc_gpio

echo "AF3 out" > /proc/gpio/GPIO9

echo "AF1 in" > /proc/gpio/GPIO42
echo "AF2 out" > /proc/gpio/GPIO43
echo "AF1 in" > /proc/gpio/GPIO44
echo "AF2 out" > /proc/gpio/GPIO45

I also had to patch my hciattach from bluez-utils 3.29. Those patches are here.

Ogg-support 0.7: Canola interoperability

Light Media Scanner now uses libivorbis (Tremor) instead of floating point libvorbis. Ogg-support now depends on newer build of libivorbis that exports the symbols needed by LMS.

There’s now ogg-support-lightmediascanner meta package which depends on lightmediascanner0-ogg for easier installation with the Application Manager.

Unfortunately all other issues with ogg-support still remain.

UBIFS and Gumstix

I wanted try something other than JFFS2 as the rootfs and decided to go with UBIFS. Thanks to GIT’s brilliance I had no trouble pulling the UBIFS kernel patches from their tree to mine.

It seems that the UBIFS hasn’t had many NOR flash users before me and it needed some fixes. Artem Bityutskiy was extremely helpful in fixing the deficiencies and helping me out. After a few debug rounds I now have UBIFS root on my Gumstix.

I created the UBIFS image with the following commands:


sudo mkfs.ubifs --compr=zlib -r /tmp/rootfs -m 1 -e 130944 -c 120 -o ubifs.img
ubinize -o ubi.img -m 1 -p 128KiB -v ubinize.cfg

With this ubinize.cfg:


[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=13MiB
vol_type=dynamic
vol_name=rootfs
vol_alignment=1
vol_flags=autoresize

Note that I have reserved 2MiB for the kernel partition.

I had to add one extra parameter to the kernel args to specify what MTD partition I wanted to use:

console=ttyS0,115200n8 root=ubi0:rootfs rootfstype=ubifs reboot=cold,hard ubi.mtd=1

Now my Gumstix boots with simplified kernel to busybox shell in roughly 4.2 seconds (counted from the bootm command in U-Boot).

2.6.25 running on Gumstix

I had to add a new category after all: gumstix. The embedded word has too broad a meaning.

Updating the kernel wasn’t such a big thing after all, even for a kernel n00b like me. I git cloned the vanilla tree from kernel.org and patched the generic (and one bluetooth) Gumstix patches from OE: arch-config.patch, board-init.patch, header.patch, mach-types-fix.patch, modular-init-bluetooth.patch, tsc2003-config.diff, tsc2003.c, and uImage-in-own-partition.patch. Most of them applied fine, I just had to manually apply simple Makefile patches and change pxa_init_irq call to pxa27x_init_irq.

I don’t know if it really works, but at least it booted:


root@gumstix-custom-verdex:~$ uname -a
Linux gumstix-custom-verdex 2.6.25-rc8-00151-gdc41023 #2 Fri Apr 4 23:43:25 EEST 2008 armv5tel unknown

Ogg-support: Issues

The ogg-support is listed as the The Pearl for OS2008, thanks! :)

Even though the ogg-support has got nice ratings in the download page, it doesn’t work perfectly on the OS2008. Most of the issues has some sort of workaround so I decided to make a summary post of them.

Ogg-support breaks VOIP calls

Ogg-support adds Speex voice codec to the system and it seems that the VOIP client advertises it as the first choice. If both parties have it installed, it’s selected. But. The VOIP engine (or whatever) doesn’t know or just refuses to use Speex, so the VOIP stream is not actually sent, properly at least.

If you delete the Speex’ GStreamer plugin, the calls seems to work nicely.

Bug report (#2811).

All Oggs from Map are listed in Media Player

The Metalayer Crawler adds all known media files to the Media Player’s Library. With ogg-support also Ogg files are recognized and added to the Library. Problem is that the Map application includes almost 2000 Oggs with N810 so they are added to the Library too.

A workaround is mentioned in the ogg-support’s help forum. It requires editing the SQL database after the files are added to the Library.

Bug report (#2772).

File Manager doesn’t launch Media Player for Oggs

I had to modify the mime type XML a bit to get File Manager to recognize videos and audios in Ogg container separately instead of just showing all *.ogg files as e.g. audio/x-vorbis. To be specific I had to remove the *.ogg pattern from the XML file.

It seems that the hildon_mime_open_file() in libhildonmime doesn’t launch the file without the *.ogg pattern tag in XML.

No workaround for this one.

Bug report (#2521).

PS. Many problems are reported in the Internet Tablet Talk’s forums. I don’t follow those frequently so please notify me in the garage’s forums about possible bugs, issues or workarounds. I do get a instant mail notification about those. Thanks.

Ogg-support 0.4: Media Player

I added initial support for the built-in Media Player. It’s untrivial to get everything working properly as the FileManager, the Metalayer Crawler, and the Media Player are all close source applications and their behaviour is not really documented anywhere.

The change log:

  • Added OGG support for the built-in media player.
  • Updated ogg related mime types from freedesktop.org.xml (excluding *.ogg patterns).
  • Added icons for the new mime types.
  • Removed dependency to floating point vorbis library.

Known issues:

  • The FM doesn’t now how to start the new mime types.
  • The Metalayer Crawler doesn’t fill in the meta data (artist etc.) for the ogg files.
  • I removed the *.ogg patterns from the mime file because with it neither the FM nor the Crawler checked the real mime type for files but just put the first mime type with *.ogg pattern.

The Crawler did fill in the artist etc. for my ogg files at one point, but I don’t know why. If you have any hints for these issues, I’m all ears :)

PS. The MP now plays oggs with Theora video and Vorbis audio too :)

Speex encoder on n800’s DSP

I’ve been wanting to run things on OMAP‘s DSP processor since the day I tested an OMAP1510 development board some years ago. Finally after a Proof of concept G.711 dsptask mail by Simon Pickering I decided to cut’n’paste that and try.

I knew the Speex had already been ported to the DSP (TMS320C55) used by OMAP1 (770) and OMAP2 (n800) so I started porting it to the DSP Gateway to be able to use it in my n800.

The DSP Gateway’s DSP tasks are seen as /dev/dsptask/<taskname> devices on ARM side and are interacted with read, write, and ioctl calls. Very linux stylish and convenient in my opinion. On the DSP code one struct defines callbacks for these calls. The code overhead on DSP side is some tens of lines.

Speex has speex_alloc functions that can be overwritten if the default memory allocation is not suitable. In the existing DSP port these were overwritten with functions using preallocated global char arrays that are used for all allocations, freeing is not possible. The DSP char is 16 bits as is int. The long is 32 bits and a pointer is 23 bits. Long long is 40 bits. I had some problems with calculating with pointers (casting a pointer to long didn’t produce valid looking value) in the existing implementation so I rewrote the allocation functions to use arrays and indexes. Also the existing implementation printed pointer values as %x which seemed to print completely different values than %p. I did use dbg() however, not fprintf.

The dbg() prints will be shown in dmesg or syslog on the ARM side if the kernel is compiled with mbox debug. The n800 stock kernel is not, but it’s almost trivial to compile a kernel of your own. My kernel with mbox debugs and built-in ext3 is here.

Other than the allocation functions there was not much to port, couple of functions calling the speex’ init and encode functions. I did have an odd problem though: the DSP seemed to jam after some tens of seconds and the DSP kernel was rebooted. After I added poll_disable(task) in my encoding callback function, the jamming was gone. The function will disable the polling for 10 seconds. Afaik, that should be called only if the completion of the function takes more that 10 seconds, which it doesn’t.

My speex patch against the git head is available, if somebody wants to test it. There can be some weirdness as this is my first test with the DSP stuff and I don’t even know how to use the git ;)

If my measurements are correct it takes roughly 40 ms to encode one 20 ms frame without compiler optimizations. With -o3 it takes a bit over 20 ms. The speex is meant to be portable and has a header defining some math functions. The functions are ported to different CPUs like ARMv5 and Blackfin. Maybe some DSP guru quickly ports those to the TMS320C55 too? :)

I think the best place for DSP information for the tablets is in maemo.org wiki as I hope it will be kept up to date with the latest projects and tweaks. One thing to be added there would be a note about the skeleton page. I used the Active Block Receiving and Active Block Sending.

Ogg-support 0.2: Speex

The 0.2 release includes dependency to the Speex (libspeex1 and the corresponding gst plugin in gstreamer0.10-plugins-good-kulve). The Speex is compiled from SVN trunk.

I made some light (just looked the numbers, no playback) performance tests. The two tables below show how much time in seconds it took to encode a 60 second audio clip (8000Hz, mono, 16bit). The first column shows the complexity used (scale is 0-10) and the rest of the columns show the encoding time with different qualities (0-10).

no VBR, no DTX, no VAD:

c/q      1       2       3       5       7
0       12       8      10      14      11
1       12       9      10      15      11
2       13       8      12      16      16
3       13      10      15      22      19
4       13      10      16      23      20

VBR, DTX, VAD:

c/q      1       2       3       5       7
0       10      10      11      14      16
1        9      10      13      14      16
2       10      12      13      15      18
3       11      13      15      19      22
4       11      13      17      20      24

The next table shows the difference between fixed point and floating point versions.

c        fixed     float
0        11        17
1        11        18
2        13        20
3        19        29

So, use the fixed point Speex API, if possible (the gst doesn’t use it). If using the floating point API, the libspeex will make the conversion.

For VoIP a good quality setting could be quality 7, complexity 2 and VBR, VAD, and DTX on.

Ogg support for n800

The Internet Tablets don’t support Ogg natively, so there has been some open source projects to add it. I made yet another one.

Features:

  • Adds application/ogg and audio/x-ogg mime types
  • Add GnomeVFS mime type icons for above
  • Depends on ogg, vorbis and theora libs and on the corresponding GStreamer plugins

See project page, home page or install it (conflicts with kilikali-codecs-meta).

For an open source player, see kilikali.