bookmark_borderDebian Kiosk

I have configured a kiosk using Debian GNU/Linux with blackbox window manager.

The challenges:
1. Touchscreen configuration.
2. Autometic login and start X server.
3. Start desired application for kiosk.
4. A boot splash for booting and shutdown.
 
1. Touchscreen configuration:
First, setup touchscreen driver and configure it according to your device specification.
I was using eGalax driver, which I have downloaded from
source: http://home.eeti.com.tw/web20/eg/drivers.htm

2. Automatic login:
Edit /etc/inittab and comment the following line:

#1:2345:respawn:/sbin/getty 38400 tty1

add the following line below:

1:2345:respawn:/bin/login -f USER_LOGIN tty1 /dev/tty1 2>&1 

Edit .bash_profile (create if require) and add the following line at bottom:

startx

source: http://www.debianadmin.com/how-to-auto-login-and-startx-without-a-display-manager-in-debian.html

Blackbox window manager:
Edit ~/.xinitrc (or ~/.Xsession), create if require, and add the following line:

exec blackbox

3. Autostart application:
To autostart iceweasel/firefox:
Again edit ~/.xinitrc (or ~/.Xsession) and add the following line:

firefox &
exec blackbox

source: http://blackboxwm.sourceforge.net/BlackboxFAQ/StartupAndShutdown

Install iceweasel/firefox plugin “R-kiosk” from https://addons.mozilla.org/en-US/firefox/addon/1659

3. Bootsplash:
Install a bootsplash

apt-get install splashy

Create your own bootsplash and set it

# splashy_config -c

To enable splashy, you may need to edit grub.config and add the following after “kernel…ro quiet”

vga=791 splash

source: http://splashy.alioth.debian.org/wiki/faq

Tips and tricks:
“X: user not authorized to run the X server”
You can allow the user to use run startx by:

#dpkg-reconfigure x11-common

or edit  /etc/X11/Xwrapper.config

allowed_users=anybody 

“Auto login problem”
 If you have setup GDM (XDM) earlier, then you need to disable it for automatic log in

#update-rc.d -f gdm remove

If you want to enable it simply run (experiment purpose):

#update-rc.d -f gdm defaults

source: http://www.debianadmin.com/howto-boot-debian-in-text-mode-instead-of-graphical-mode-gui.html

Kiosk performance tuning:
Install the CPU frequency related tools and configure it.
details: http://wiki.debian.org/HowTo/CpuFrequencyScaling

resources:
http://www.debianadmin.com/debirf-build-a-kernel-and-initrd-to-run-debian-from-ram.html
http://cmrg.fifthhorseman.net/wiki/debirf

bookmark_borderCustom Font Example iPhone

An example for using custom font in iPhone.

Initially, I have tried with UIFont for using custom font, but it seems not possible.

Documents from apple:
http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Reference/CGFont/Reference/reference.html

Create custom font using CGDataProvider:

NSString *fontPath = [[NSBundle mainBundle] pathForResource:@”CUSTOM_FONT” ofType:@”ttf”];
CGDataProviderRef fontDataProvider = CGDataProviderCreateWithFilename([fontPath UTF8String]); CGFontRef customFont = CGFontCreateWithDataProvider(fontDataProvider);

Use the font:

CGContextSetFont(context, customFont);
CGContextSetFontSize(context, 34.0);
CGContextSetTextDrawingMode(context, kCGTextFill);
CGGlyph textToPrint[[mainString length]];
// Loop through the entire length of the text.
for (int i = 0; i < [mainString length]; ++i) { // Store each letter in a Glyph and subtract the MagicNumber to get appropriate value.
textToPrint[i] = [[mainString uppercaseString] characterAtIndex:i] + 332;
}

//to understand the MagicNumber, I open the font file using FontForge
//found that the font I am using started from location 32
//after I changed the “Encoding->Reencode” to “Glyph Order”
//I found that the “U+0020 space” started from location 3
//