Tuesday, February 1, 2011

XBMC - PS3 Remote

Over the past few years I’ve been looking to setup a dedicated box for XBMC. That day finally came this week since I found a broken laptop here at home. The screen wasn’t working, the harddrive had corrupted sections, the swivel mounts were snapped in half, the power supply cut out frequently; it was in rough shape. I made some minor repairs to get it to a workable state and figured to at least try it out. Here’s the steps I used since some of them aren’t documented so well.
  1. This one is pretty simple, just go to http://www.xbmc.org
  2. Click Downloads | Get XBMC
  3. Click on the Live button and it will download a disk image (.iso)
  4. Burn the image using the software of your choice (I used ImgBurn)
  5. Put the CD in your soon-to-be HTPC making sure it has a connection to the internet
  6. Let it set up, use whole disk for partition
  7. When it comes time to put in name, use your name
  8. For computer id use “xbmc” without quotes
  9. For password use “xbmc” without quotes
  10. After that it will boot up, verify everything works okay with the internet and playing videos/music
 This is the tricky section so follow closely.
   1. Hit CTRL+F2 to exit xbmc and go to the command line
   2. Log in using “xbmc” for the user and “xbmc” for the password
   3. Type cd ..
   4. Type cd ..
   5. Type sudo add-apt-repository ppa:kitlaan/ppa
   6. Type sudo apt-get purge bluez
   7. Type sudo echo deb http://ppa.launchpad.net/kitlaan/ppa/ubuntu maverick main » /etc/apt/sources.list
   8. Type sudo echo deb-src http://ppa.launchpad/kitlaan/ppa/ubuntu maverick main » /etc/apt/sources.list
   9. Type sudo apt-key adv —keyserver keyserver.ubuntu.com —recv-keys 6F7177CC
  10. Type sudo apt-get update
  11. Type sudo apt-get install bluez
  12. Type sudo apt-get install bluez-utils python-bluez
  13. Type hcitool scan
  14. Press and Hold the Start and Enter keys on the PS3 remote
  15. You should see something similar to the following:
Scanning …
    00:82:7C:B9:14:7A   BD Remote Control
  16. Write down the sequence before BD Remote Control
  17. Type wget http://h00s.net/ps3bdremote.tar.gz
  18. Type tar xvzf ps3bdremote.tar.gz
  19. Type cd ps3bdremote 
  20. Type sudo nano ps3bdremote-test.py
  21. Look for the line that starts with remote = ps3bdremote.PS3BDRemote and change the sequence to the one you wrote down
  22. Save and exit (Hit CTRL+X, then Y, then ENTER)
  23. Type sudo apt-get install python-bluetooth
  24. Type python ps3bdremote-test.py
  25. Press and Hold Start + Enter on the PS3 Remote

It should say Connected and start displaying the buttons you press, if not check to make sure the sequence was entered correctly.

Now that everything is connected, the remote needs to be configured to work with XBMC as well as be launched when XBMC starts.
  1. Press CTRL+ALT+F3 to open another command line
  2. Log in with “xbmc” as the user and “xbmc” as the password
  3. Type cd ..
  4. Type cd ..
  5. Type sudo apt-get install blueman
  6. Type sudo modprobe uinput
  7. Type sudo nano /etc/init.d/rc.local
  8. Scroll down to the end of the file
  9. Type sudo modprobe uniput
  10. Save and Exit
  11. Type cd ~
  12. Type wget http://kitlaan.twinaxis.com/holdingcell/ps3pair.tar.gz
  13. Type tar xvfz ps3pair.tar.gz
  14. Type cd ~/ps3pair
  15. Type sudo python ps3_pair.py
  16. Press and Hold Start + Enter on the PS3 remote
  17. Type 1 then ENTER after it connects
  18. Type cd ..
  19. Type cd ..
  20. Type cd ..
  21. Type usr/share/doc/bluez/examples/list-devices
  22. Check to make sure the PS3 Remote shows as connected
  23. Type cd etc
  24. Type cd bluetooth
  25. Type sudo nano input.conf
  26. Replace the file with the following, swaping the sequence with the one you wrote down
# input.conf - kitlaan custom
# Configuration file for the input service

# This section contains options which are not specific to any
# particular interface

# Set idle timeout (in minutes) before the connection will
# be disconnect (defaults to 0 for no timeout)

# This section contains options that are specific to a device
# Set a custom idle timeout (in minutes) for this device

# This section is the PS3 Remote keymap.  It is loaded when bluez starts.
# Use 'uinput.h' from bluez sources or '/usr/include/linux/input.h' for
# a list of possible KEY_* values.
[PS3 Remote Map]
# When the 'OverlayBuiltin' option is TRUE (the default), the keymap uses
# the built-in keymap as a starting point.  When FALSE, an empty keymap is
# the starting point.
#OverlayBuiltin = TRUE
0x16 = KEY_E              # EJECT
0x64 = KEY_A              # AUDIO
0x65 = KEY_Z              # ANGLE
0x63 = KEY_T              # SUBTITLE
0x0f = KEY_DELETE         # CLEAR
0x28 = KEY_GRAVE          # TIMER
0x00 = KEY_1              # NUM-1
0x01 = KEY_2              # NUM-2
0x02 = KEY_3              # NUM-3
0x03 = KEY_4              # NUM-4
0x04 = KEY_5              # NUM-5
0x05 = KEY_6              # NUM-6
0x06 = KEY_7              # NUM-7
0x07 = KEY_8              # NUM-8
0x08 = KEY_9              # NUM-9
0x09 = KEY_0              # NUM-0
0x81 = KEY_F7             # RED
0x82 = KEY_F8             # GREEN
0x80 = KEY_F9             # BLUE
0x83 = KEY_F10            # YELLOW
0x70 = KEY_I              # DISPLAY
0x1a = KEY_S              # TOP MENU
0x40 = KEY_M              # POP UP/MENU
0x0e = KEY_ESC            # RETURN
0x5c = KEY_C              # TRIANGLE/OPTIONS
0x5f = KEY_TAB            # SQUARE/VIEW
0x5e = KEY_SPACE          # CROSS
0x54 = KEY_UP             # UP
0x56 = KEY_DOWN           # DOWN
0x57 = KEY_LEFT           # LEFT
0x55 = KEY_RIGHT          # RIGHT
0x0b = KEY_ENTER          # ENTER
0x5a = KEY_F1             # L1
0x58 = KEY_F2             # L2
0x51 = KEY_F3             # L3
0x5b = KEY_F4             # R1
0x59 = KEY_F5             # R2
0x52 = KEY_F6             # R3
0x43 = KEY_HOMEPAGE       # PS button
0x50 = KEY_INSERT         # SELECT
0x53 = KEY_HOME           # START
0x33 = KEY_R              # SCAN BACK
0x32 = KEY_PLAY           # PLAY
0x34 = KEY_F              # SCAN FORWARD
0x30 = KEY_PAGEUP         # PREVIOUS
0x38 = KEY_STOP           # STOP
0x31 = KEY_PAGEDOWN       # NEXT
0x60 = KEY_COMMA          # SLOW/STEP BACK
0x39 = KEY_PAUSE          # PAUSE
0x61 = KEY_DOT            # SLOW/STEP FORWARD
0xff = KEY_MAX

Check it in XBMC by hitting CTRL+ALT+F7 or F8 to make sure everything is working.

Now the only thing left to setup is someway to send the media files that you have on your PC to XBMC and store it on the external drive that is connected. You could just disconnect the drive every time you want to put stuff on, but that ruins the point of having a dedicated box. The tutorial for this is done amazingly indepth by the folks at mini-itx.com. The only change you need to do is when you edit smb.conf put the path as / instead of /home/xbmc. By doing that you’ll be able to go to media and see your external drive. Stop once it starts talking about Windows. That part isn’t needed. Hit CTRL+ALT+DEL to restart the HTPC and everything will be running smooth and trouble free.
Here’s their tutorial
So there’s the whole process in 75 easy-ish steps. Hopefully it’ll save a headache to anyone that’s never used linux before. Good Luck, and if you need any other help, all of this information was culled from the below sources which helped me figure everything out.

No comments:

Post a Comment