Donnerstag, 16. August 2012

Dualshock 3 and Raspberry PI

Getting Sony Dualshock 3  gamepad to work in Raspberry Pi on Raspbian (Debian Wheezy).

First of all, I'll need a bluetooth dongle, since Raspbery Pi doesn't have built-in one, listing of compatible dongle you can find here.

So, install dependencies first

sudo apt-get install bluez-utils bluez-compat bluez-hcidump checkinstall libusb-dev  libbluetooth-dev joystick

It takes a while.

After all type "hciconfig" in console, you should see something like this.

pi@raspberrypi ~ $ hciconfig
hci0: Type: BR/EDR Bus: USB
 BD Address: 00:1F:81:00:06:20 ACL MTU: 1021:4 SCO MTU: 180:1
UP RUNNING PSCAN
RX bytes:1260 acl:0 sco:0 events:46 errors:0
TX bytes:452 acl:0 sco:0 commands:45 errors:0


if not, your dongle seems not to be recognized by system.

So now, we need to pairing the dongle with the gamepad using this tool.

download and compile it.

wget http://www.pabr.org/sixlinux/sixpair.c
gcc -o sixpair sixpair.c -lusb

After this you should have a executable file "sixpair".
Now connect your  Dualshock via a USB cable to Raspberry Pi and launch this file with sudo.

sudo ./sixpair

Current Bluetooth master: DE:AD:BE:EF:00:00
Setting master bd_addr to: 00:1F:81:00:06:20


If you see this, it was successful.

Install a Sixaxis Joystick Manager. Download a last archive and compile only important for us part.

wget http://sourceforge.net/projects/qtsixa/files/QtSixA%201.5.1/QtSixA-1.5.1-src.tar.gz
tar xfvz QtSixA-1.5.1-src.tar.gz
cd QtSixA-1.5.1/sixad
make
sudo mkdir -p /var/lib/sixad/profiles
sudo checkinstall

the last command make automatically a package for you, so you can later simple uninstall it, if you won't it or use a different system, type  "sudo make install" instead of "sudo checkinstall"

Now test it, for this launch temporary a sixad daemon.

sudo sixad --start

Then press a "PS" button on Dualshock gamepad, if you feel a vibration, it works, congratulations!

After all you can make "sixad" daemon starting at boot time.

sudo update-rc.d sixad defaults
reboot


If you have any trouble with recognition, you can debug your Dualshock controller with "jstest".

sudo jstest /dev/input/js0


P.S. Thanks goes to http://blog.onsw.net/yuta/

Mittwoch, 15. August 2012

Making Raspberri Pi into Retro Games Station

Installation


Tested only on Rasbian (Debian Wheezy)

First, install all dependencies

sudo apt-get install git dialog

Then make directory for git and cloning the repo

mkdir ~/git_dir
cd ~/git_dir
git clone https://github.com/petrockblog/RetroPie-Setup.git


After finishnig that, you should have "retropie_setup.sh" file, start it with sudo.

sudo ./retropie_setup.sh

You'll see a dialog, that asks you about "binary" or "source" installation, it's up to you, but the "source" installation takes about 2-3 hours.
So that's it, after installation you should have in your home "RetroPie" directory with some other directories inside.

pi@raspberrypi ~/RetroPie $ ls
EmulationStation emulatorcores RetroArch-Rpi roms SNESDev-Rpi


So let me explain, what is actually means.
emulatorcore -> separate emulators for respective platform from different developers.
RetroArch-Rpi -> Frontend for emulators (see http://themaister.net/retroarch.html), that allows use these emulators in the same way with same API.
EmulationStation -> GUI for RetroArch
roms -> copy your ROMs into directory
SNESDev-Rpi > see here http://petrockblog.wordpress.com/2012/07/03/snesdev-rpi-a-snes-adapter-for-the-raspberry-pi/

So, basically you have 3 different layers.

To start the emulators you'll need launch
~/RetroPie/EmulationStation/emulationstation

FAQ


How to use Gamepad

Plug your USB gamepad in to Raspberry PI (I've tested it with some generic PS-Clone Controller).

type this in console

sudo ~/RetroPie/RetroArch-Rpi/tools/retroarch-joyconfig | sudo tee -a /etc/retroarch.cfg

then type respective the button, that you see on the screen.

Using Gamepad to exit Emulator/Game

add this line at the end of /etc/retroarch.cfg

input_exit_emulator_btn = “11″

where "11" is you desired button, for example "11" for my controller equivalent R3 (right stick)

How to make a desktop link

create a file in "~/Desktop/emustation.desktop" with this content

[Desktop Entry]
Version=1.0
Type=Application
Name=EmuStation
Comment=EmulateStation, GUI for Retro Game Emulators
Categories=Game
Exec=/usr/bin/emulationstation
Icon=/home/pi/.joypad.svg
Terminal=false
StartupNotify=false


Of course you need change "Icon" with your image.

I can't see my ROMs.

check you "EXESTENSION" value in "EmulationStation" settings, it's case sensitive!

less ~/.emulationstation/es_systems.cfg

e.g for Sega it's ".smd", so it means a rom this name Sonic.SMD (not Sonic.smd) will not be displayed!

P.S. Thanks to  Aloshi, petrockblog, ToadKing and others.