Make and run simple PND

From Pandora Wiki
(Redirected from PND nub modes)
Jump to: navigation, search

Feel free to use this as a start for your own PND! This is pretty much the simplest PND possible. It will show a black screen for 2 seconds and then quit. Unfortunately, due to a bug in MiniMenu, this PND can only (as of HF5) be launched from XFCE.


The PND has 2 files. First, "", which is our executable application, and "PXML.xml" which the Pandora uses to launch the application correctly.

First, create a "simplepytest" folder in one of your application folders (i.e., "/pandora/menu").

This file is the actual application that the Pandora executes.

Create a file called "" and put the following contents in it. This will display a black screen for 2 seconds at the current screen resolution, using Python and Pygame.

#! /usr/bin/python

import pygame, pygame.locals
import time


vidInfo = pygame.display.Info()
resolution = (vidInfo.current_w, vidInfo.current_h)

pygame.display.set_mode(resolution, pygame.locals.FULLSCREEN)



This file contains the information the Pandora needs to figure out where to display your game and how to execute it.

Create a file called "PXML.xml" and put the following contents in it:

<?xml version="1.0" encoding="UTF-8">
<PXML xmlns="">
        <package id="simplepytest">
        <version major="0" minor="0" release="0" build="1"/>
        <author name="YOUR NAME" email="YOUR EMAIL"/>        
                <title lang="en_US">Simple Py Test</title>
                        <title lang="en_US">Simple Py Test</title>
    <application id="simplepytest">
        <title lang="en_US">Simple Py Test</title>
                        <title lang="en_US">Simple Py Test</title>
        <description lang="en_US">A Python and Pygame test program.
        <version major="0" minor="0" release="0" build="1"/>
        <exec command="python" />
        <author name="YOUR NAME" email="YOUR EMAIL"/>
                        <license name="other"/>
            <category name="Game">
                <subcategory name="ArcadeGame">

Running Your Game

  1. Save all the above files.
  2. Make sure your Pandora is running the XFCE Gui.
  3. Unmount, then remove your SD card.
  4. Re-insert your SD card.
  5. The "Simple Py Test" game should appear in the Arcade Game folder.


It would be good to have basic shell scripting knowledge before proceeding with this article.


Usage: -p file.pnd -e cmd [-a args] [-b pndid] [-s path] [-c speed] [-d [path]] [-x] [-m] [-u]
   -p file.pnd	: Specify the pnd file to execute
   -e cmd	: Command to run
   -a args	: Arguments to the command
   -b pndid	: name of the directory mount-point (/mnt/utmp/pndid) (Default: name of the pnd file)
   -s path	: Directory in the union to start the command from
   -o speed	: Set the CPU speed
   -d [path]	: Use path as source of the overlay. (Default: pandora/appdata/pndid)
   -x		: Stop X before starting the apps
   -m		: Only mount the pnd, dont run it (-e become optional)
   -u		: Only umount the pnd, dont run it (-e become optional)


It is possible to execute the content of your pnd using arguments. This can be done by passing -a to with arguments quoted

-a "--arg 1"

Creating a launch script for PND

For a PND to function normally, you usually need to pass the appdata or PND ID (via -b) and correct executable (via -e) to the script. These can be found by examining PXML data that is appended in PNDs, or alternatively you can find IDs by using various package managers and executable paths by checking the .desktop files generated by the PND system. For the PND ID you would use the "appdata" entry of the PXML.xml, and, if absent, the application id. This will also determine the directory in pandora/appdata which will be used as base for the overlay. (As of this writing, the -d parameter is not evaluated.) For the -e parameter, you look for the "exec command" in the PXML.xml. This will determine the executable, which would be especially important in a multi-app-pnd. -p /media/SD1/pandora/menu/Chromium.pnd -e "" -b "chromium" -a "$*"

Where chromium is the PND's ID found from PXML, and is the application found from .desktop file.

Modifying PNDs launch script(s) to accept arguments

With the Chromium.pnd it's not possible to use any additional arguments for the browser by default. This is because the launch script it uses does not expect arguments to be passed to it, and therefore does not pass them to chrome binary.

For example, the original from Chromium.pnd (as time of writing), looks like this:

# /mnt/utmp/chromium/
mkdir ./Default
mkdir /tmp/chromium
cp "First Run" /tmp/chromium/
ln -s /mnt/utmp/chromium/Default /tmp/chromium/Default
export HOME
rm -r /tmp/chromium

Notice that it launches ./chrome and does not give any arguments for it.

As the original launch script resides in PND that is read-only file system, you can't modify it directly. However you can copy the script to that PND's appdata directory, which overrides the files of PND when mounted.

So copy it and modify this part:

./chrome $@

So it should look like this in the end:

# /media/SD1/pandora/appdata/chromium/ 
mkdir ./Default
mkdir /tmp/chromium
cp "First Run" /tmp/chromium/
ln -s /mnt/utmp/chromium/Default /tmp/chromium/Default
export HOME
./chrome $@
rm -r /tmp/chromium

There probably exists many more PNDs that don't expect arguments, and it's problematic when you actually need to pass them arguments, or make them as launchers for some file types. So you need to learn how to modify them.

Making Chromium the default browser of XFCE using the PND

Create launch script such as:

# /media/SD1/launchers/
/usr/pandora/scripts/ -p /media/SD1/pandora/menu/Chromium.pnd -e "" -b "chromium" -a "$*"

Save the script somewhere and make it as executable:

chmod +x /media/SD1/launchers/

Then go to Settings > Desktop > Preferred Applications, and point the Web Browser to your script. When opening URLs in XFCE environment, they should open in Chromium now.

This page is a work in progress, the instructions in here may or may not work for you. They were copied from several forum posts (see inline references). For an introduction to PNDs, see Introduction to PNDs.

If you want a different nub behavior for certain PND applications, you can achieve this by using one of the presented methods here.


Why would you want to do this? Simple; at least one person has reported that, when playing a natively-ported FPS (like Duke Nukem or Quake, but not GoldenEye) on the Pandora, using the right nub as the mouse has proven to be more comfortable and less awkward. But switching nub modes manually is annoying; so let's have Linux do it for you!

Presented methods ONLY apply per PND, do not affect general behavior

The methods below are crash save, as the nub behavior is changed by the process, which runs before AND after a PND is running. Thus even in the event that your PND application crashes, your nub configuration WILL be the same as before you started the PND with the custom nub behavior. (Source: sebt3 forum post)

Method: Switch left/right nub unix devices

Hint from: Blue Protoman

Step 1

You must download sebt3's new installer and run it. Get it here.
Note: This step is no longer required as of Hotfix 6 Alpha 1.

Step 2

Open a text editor and copy/paste this:

cat /proc/pandora/nub0/mode > /tmp/nub0mode_before
cat /proc/pandora/nub1/mode > /tmp/nub1mode_before

/usr/pandora/scripts/ mbuttons mouse

This will back up your current nub modes, then switch them; the left will act as the mouse buttons, the right will act as the mouse. If you'd like, you can substitute "scroll" or "absolute" (joystick) in, depending on how you like your nubs. But you must save this as Save it wherever you'd like, you will be moving it elsewhere later.

Note: script might not available in older firmwares. See Kernel interface page for more information.

Step 3

Copy/paste this into the editor again. Different file this time.

nub0mode=`cat /tmp/nub0mode_before`
nub1mode=`cat /tmp/nub1mode_before`
/usr/pandora/scripts/ $nub0mode $nub1mode

rm /tmp/nub0mode_before /tmp/nub1mode_before

This will restore your nub modes to what they were before, and delete the temporary files used to store them. You must save it as

Step 4

Simply copy these files into the appdata folder of your program of choice! Now you're done. If you want to test it, drag these files into the appdata of a program that runs windowed (like Comix or Deadbeef), so you can test with the mouse. Simply delete the files if you no longer desire their effects.

Method: Switch between nub configurator presets

Hint from: Caine


  • Start the nub configurator
  • Create a profile for the setup you wish your application to use.
  • Below, I'll assume a profile is created which is called joysticks which places both nubs in joystick mode.
  • Create a file with this content:
    • /usr/pandora/scripts/ -s temp_profile -p joysticks
    • This will store the current configuration in a profile called temp_profile and next will load the joysticks profile.
  • Create a file with this content:
    • /usr/pandora/scripts/ -p temp_profile -d temp_profile
    • This will load the previously created profile temp_profile and will remove it afterwards.
  • Simply copy the files and into the appdata folder of your program of choice!


Uses the GUI to easily create custom profiles without having to know where values are written to.


  • It is slower, uses some memory and writes profiles to NAND.
  • If you want to avoid NAND-writes per launch and you always revert back to the same profile after launch then you can use static profiles without having to save and remove the current. E.g. something like:
    • Before: /usr/pandora/scripts/ -p joysticks
    • After: /usr/pandora/scripts/ -p Default