README-raspberrypi.txt
author Gabriel Jacobo <gabomdq@gmail.com>
Mon, 16 Dec 2013 10:03:26 -0300
changeset 8064 ac809ea54d63
parent 8007 f4264c673a8d
child 8127 7d1ae292393b
permissions -rw-r--r--
[Android] Define SDL_VIDEO_OPENGL_ES2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7753
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     1
================================================================================
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     2
SDL2 for Raspberry Pi
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     3
================================================================================
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     4
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     5
Requirements:
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     6
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     7
Raspbian (other Linux distros may work as well).
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     8
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     9
================================================================================
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    10
 Features
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    11
================================================================================
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    12
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    13
* Works without X11
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    14
* Hardware accelerated OpenGL ES 2.x
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    15
* Sound via ALSA
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    16
* Input (mouse/keyboard/joystick) via EVDEV
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    17
* Hotplugging of input devices via UDEV
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    18
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    19
================================================================================
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    20
 Raspbian Build Dependencies
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    21
================================================================================
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    22
7778
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
    23
sudo apt-get install libudev-dev libasound2-dev libdbus-1-dev
7753
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    24
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    25
You also need the VideoCore binary stuff that ships in /opt/vc for EGL and 
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    26
OpenGL ES 2.x, it usually comes pre installed, but in any case:
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    27
    
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    28
sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    29
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    30
================================================================================
7806
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    31
 Cross compiling from x86 Linux
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    32
================================================================================
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    33
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    34
To cross compile SDL for Raspbian from your desktop machine, you'll need a
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    35
Raspbian system root and the cross compilation tools. We'll assume these tools
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    36
will be placed in /opt/rpi-tools
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    37
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    38
    sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    39
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    40
You'll also need a Rasbian binary image.
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    41
Get it from: http://downloads.raspberrypi.org/raspbian_latest 
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    42
After unzipping, you'll get file with a name like: <date>-wheezy-raspbian.img
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    43
Let's assume the sysroot will be built in /opt/rpi-sysroot.
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    44
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    45
    export SYSROOT=/opt/rpi-sysroot
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    46
    sudo kpartx -a -v <path_to_raspbian_image>.img
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    47
    sudo mount -o loop /dev/mapper/loop0p2 /mnt
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    48
    sudo cp -r /mnt $SYSROOT
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    49
    sudo apt-get install qemu binfmt-support qemu-user-static
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    50
    sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    51
    sudo mount --bind /dev $SYSROOT/dev
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    52
    sudo mount --bind /proc $SYSROOT/proc
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    53
    sudo mount --bind /sys $SYSROOT/sys
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    54
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    55
Now, before chrooting into the ARM sysroot, you'll need to apply a workaround,
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    56
edit $SYSROOT/etc/ld.so.preload and comment out all lines in it.
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    57
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    58
    sudo chroot $SYSROOT
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    59
    apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev libxss-dev
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    60
    exit
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    61
    sudo umount $SYSROOT/dev
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    62
    sudo umount $SYSROOT/proc
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    63
    sudo umount $SYSROOT/sys
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    64
    sudo umount /mnt
8007
f4264c673a8d Fixes building for RPi using --no-undefined
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7809
diff changeset
    65
    
f4264c673a8d Fixes building for RPi using --no-undefined
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7809
diff changeset
    66
There's one more fix required, as the libdl.so symlink uses an absolute path 
f4264c673a8d Fixes building for RPi using --no-undefined
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7809
diff changeset
    67
which doesn't quite work in our setup.
f4264c673a8d Fixes building for RPi using --no-undefined
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7809
diff changeset
    68
f4264c673a8d Fixes building for RPi using --no-undefined
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7809
diff changeset
    69
    sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
f4264c673a8d Fixes building for RPi using --no-undefined
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7809
diff changeset
    70
    sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
7806
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    71
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    72
The final step is compiling SDL itself.
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    73
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    74
    export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux"
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    75
    cd <SDL SOURCE>
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    76
    mkdir -p build;cd build
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    77
    ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd
7808
627f256b0e56 Fixes X11 video backend compilation when no GL is available
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7806
diff changeset
    78
    make
627f256b0e56 Fixes X11 video backend compilation when no GL is available
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7806
diff changeset
    79
    make install
7806
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    80
7808
627f256b0e56 Fixes X11 video backend compilation when no GL is available
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7806
diff changeset
    81
To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths:
627f256b0e56 Fixes X11 video backend compilation when no GL is available
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7806
diff changeset
    82
    
627f256b0e56 Fixes X11 video backend compilation when no GL is available
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7806
diff changeset
    83
    perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config
627f256b0e56 Fixes X11 video backend compilation when no GL is available
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7806
diff changeset
    84
    
7806
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    85
================================================================================
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    86
 Apps don't work or poor video/audio performance
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    87
================================================================================
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    88
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    89
If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to 
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    90
update the RPi's firmware. Note that doing so will fix these problems, but it
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    91
will also render the CMA - Dynamic Memory Split functionality useless.
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    92
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    93
Also, by default the Raspbian distro configures the GPU RAM at 64MB, this is too
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    94
low in general, specially if a 1080p TV is hooked up.
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    95
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    96
See here how to configure this setting: http://elinux.org/RPiconfig
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    97
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    98
Using a fixed gpu_mem=128 is the best option (specially if you updated the 
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
    99
firmware, using CMA probably won't work, at least it's the current case).
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
   100
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
   101
================================================================================
7778
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   102
 No input
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   103
================================================================================
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   104
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   105
Make sure you belong to the "input" group.
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   106
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   107
    sudo usermod -aG input `whoami`
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   108
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   109
================================================================================
7753
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   110
 No HDMI Audio
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   111
================================================================================
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   112
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   113
If you notice that ALSA works but there's no audio over HDMI, try adding:
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   114
    
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   115
    hdmi_drive=2
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   116
    
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   117
to your config.txt file and reboot.
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   118
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   119
Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   120
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   121
================================================================================
7778
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   122
 Text Input API support
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   123
================================================================================
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   124
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   125
The Text Input API is supported, with translation of scan codes done via the
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   126
kernel symbol tables. For this to work, SDL needs access to a valid console.
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   127
If you notice there's no SDL_TEXTINPUT message being emmited, double check that
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   128
your app has read access to one of the following:
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   129
    
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   130
* /proc/self/fd/0
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   131
* /dev/tty
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   132
* /dev/tty[0...6]
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   133
* /dev/vc/0
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   134
* /dev/console
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   135
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   136
This is usually not a problem if you run from the physical terminal (as opposed
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   137
to running from a pseudo terminal, such as via SSH). If running from a PTS, a 
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   138
quick workaround is to run your app as root or add yourself to the tty group,
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   139
then re login to the system.
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   140
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   141
   sudo usermod -aG tty `whoami`
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   142
    
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   143
The keyboard layout used by SDL is the same as the one the kernel uses.
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   144
To configure the layout on Raspbian:
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   145
    
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   146
    sudo dpkg-reconfigure keyboard-configuration
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   147
    
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   148
To configure the locale, which controls which keys are interpreted as letters,
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   149
this determining the CAPS LOCK behavior:
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   150
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   151
    sudo dpkg-reconfigure locales
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   152
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7753
diff changeset
   153
================================================================================
7753
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   154
 Notes
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   155
================================================================================
e4c38f17bfad Raspberry Pi support (also unified UDEV and EVDEV support)
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   156
7809
fd53b2b2a205 Prevent keystrokes from leaking through to the console when using evdev.
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7808
diff changeset
   157
* When launching apps remotely (via SSH), SDL can prevent local keystrokes from
fd53b2b2a205 Prevent keystrokes from leaking through to the console when using evdev.
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7808
diff changeset
   158
  leaking into the console only if it has root privileges. Launching apps locally
fd53b2b2a205 Prevent keystrokes from leaking through to the console when using evdev.
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7808
diff changeset
   159
  does not suffer from this issue.
fd53b2b2a205 Prevent keystrokes from leaking through to the console when using evdev.
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7808
diff changeset
   160
  
7806
03e6aaea8347 Updates the Raspberry Pi README
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7778
diff changeset
   161