Category: Mythbuntu

Setting up your Xbox 360 controller on Ubuntu

As much as people want to deny it, the Xbox 360 controller is the best gamepad you can buy. And since i already have a 360, using my current xbox controllers makes a lot of sense for emulation on ubuntu. However, the usb receiver/gamepad compatibility in ubuntu is sketchy at best for older Ubuntu versions.

If you are using Ubuntu 9.04, it’s basically plug and play. As soon as you connect the receiver and sync your controller, you should just have to map your buttons like any other gamepad. For Ubuntu 8.04 and 8.10 you have to do the following.

First thing is, plug in that usb receiver and then attempt to sync your controller with the receiver. First thing i noticed was that it doesn’t connect like it does with the xbox where you will get the top left part of the ring lit up representing player 1. In ubuntu, I got the full ring blinking constantly. Not sure why this is, but i just ignore it.

When you first plug it in, you notice, it’s basically the mouse… as you move the left analog, your mouse cursor moves. Fantastic, another mouse, this isn’t what i want. After doing a bit or research, this is apparently a problem in 8.04 and 8.10. To get it working as a joystick/gamepad, open up terminal and type:

xinput list

you will get a list of devices. despite what you read online elsewhere, you don’t get one for the controller, but 4 of “Xbox Wireless Receiver” which look like this:

“Xbox 360 Wireless Receiver” id=6 [XExtensionPointer]
Num_buttons is 32
Num_axes is 2
Mode is Absolute
Motion_buffer is 256
Axis 0 :
Min_value is -32768
Max_value is 32767
Resolution is 10000
Axis 1 :
Min_value is -32768
Max_value is 32767
Resolution is 10000

You have to enable all 4 of them (cause who knows which one your controller will pick) with the following command. The device number is the “id=6″ part from above.

sudo xinput set-int-prop [device number] ‘Device Enabled’ 32 0

Now the problem appears to be with this is when you restart your pc, these settings get reset. as of now, you gotta set them each time you reboot. I’m going to work on this issue. I’ll post when i got it worked out. But from here, just go into zsnes for example and map your buttons for your gamepad. Easy as that.

I must admit, playing Super Mario Bros. 3 with an Xbox 360 Controller is a bit surreal.

Configuring LIRC Button Presses (repeat and delay)

This post covers the LIRC button press configuration options found in an LIRC config file in mythbuntu. The LIRC config files are found in the .lirc directory in your home directory (/home/yourname/.lirc/ or ~/.lirc/ ).

An LIRC control configuration file has several options that are available when a button is pressed to control how that button is interpreted and translated into a key press. Here is a brief explanation of the options.

Here is an example of a key press configuration (taken from /home/yourname/.lirc/mythtv):

begin
remote = mceusb
prog = mythtv
button = Down
config = Down
repeat = 2
delay = 1
end

Ok lets break this down and explain how it works:

begin
remote = mceusb
# this is the id for the remote that this configuration belongs too

prog = mythtv
# this is the name of the executable of the program that this configuration triggers in

button = Down
# this is the id for the button that when pressed on the remote fires this event

config = Down
# this is the action that is fired when the button is pressed
# the config option can either be a X windows key press event
# or a shell command like “xmacro-wrap SaveState”

repeat = 3
# use the repeat command for buttons that you want to be able to
# just hold down and they keep repeating the command every ‘n’ cycles.
# In this example the command will be issued every 3 cycles
# which for the mceusb remote is about once every second.
# if you set repeat = 0 the command will be sent only once even if you
# hold the button down.

delay = 0
# the delay config option can be used in conjunction with the repeat command to
# to tweak the speed that the button presses are accepted
# a delay of 1 delays the repeat by one cycle set the delay to 0 to disable it.
end

There are some other options available but these are the most common options used with mythtv. for more information google wiki LIRC Configuration.

Hopefully this is the last LIRC post for mythbuntu even though there is more you can do hopefully this will give enough info to be deadly and come up with creative uses for LIRC in mythbuntu!

Mupen64plus with LIRC for mythbuntu 9.04

Instructions for compiling and installing mupen64plus with support your remote control in 64 bit mythbuntu.

Step 1 Install Development Packages

Install the following packages using the synaptec package manager:

  • sdlmame
  • liblircclient
  • liblircclient-dev
  • libqt4
  • libqt4-dev
  • libxtst
  • libxtst-dev
  • libsamplerate
  • libsdl1.2-dev
  • libsdl-ttf2.0-0
  • libsdl-ttf2.0-dev
  • g++

Step 2 Installing mupen64plus

Download the latest source for mupen64plus to your Desktop:

http://mupen64plus.googlecode.com/files/Mupen64Plus-1-5-src.tar.gz

Open up a console and run the following commands:

cd Desktop
tar xzf Mupen64Plus-1-5-src.tar.gz
cd Mupen64Plus-1-5-src
make LIRC=1 all
sudo make install
cd /usr/local/bin
sudo chmod 4755 mupen64plus

Step 3 Configure The Buttons on Your Remote:

run the following command from console (note the ~ is a linux alias for your home directory):

nano ~/.lirc/mupen64plus

# Add the following Lines to the file .lirc/mupen64plus
# replace mceusb with the name of your remote
# you can find the name or your remote by checking any of the files in your .lirc/ directory

# start .lirc/mupen64plus
begin
remote = mceusb
prog = mupen64plus
button = Stop
config = quit
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mupen64plus
button = Power
config = quit
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mupen64plus
button = Pause
config = pause
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mupen64plus
button = Play
config = pause
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mupen64plus
button = VolDown
config = vol-
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mupen64plus
button = VolUp
config = vol+
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mupen64plus
button = Home
config = fullscreen
repeat = 0
delay = 0
end
# end .lirc/mupen64plus
# save the file and exit nano

Run the following command from console:

nano ~/.lircrc

# add the fololowing line to the end of .lircrc

include ~/.lirc/mupen64plus

# save the file and exit nano

Step 4 Configuring Mupen64plus

Run the following command from console and use the gui to setup and configure controllers video settings etc.:

sudo mupen64plus

for best results use the Glide plugin for video not sure why this is best but it sems to work for most games!

Step 5 Configuring Mythbuntu Game Settings

  1. Start up the Myth Frontend Interface.
  2. Select Utilities / Setup -> Setup -> Media Settings -> Game Settings -> Game Players.
  3. Command: mupen64plus –nogui –fullscreen

Rock out with your frock out using mupen64plus!

Mounting NTFS Drive in Mythbuntu

1) Run fdisk to determine the Drive Partition:

sudo fdisk -l

2) Create the Mount Point:

Sudo mkdir /media/<mount point>

3) Edit the /etc/fstab File:

sudo nano /etc/fstab

4) Insert the following into the /etc/fstab file:

/dev/<your partition> /media/<mount point> ntfs-3g defaults,locale=en_US.utf8 0 0

Notes:
<your partition> -> Determined in Step 1
<mount point> -> Determined in Step 2

Setup Capture Card for Mythbuntu

Setup Capture Card for Mythbuntu:

Log into MythTV Backend

****Assumung Hauppauge PVR-150****


A) Capture Card Setup

Card Type: MPEG-2 encoder card (PVR-x50, PVR-500)

Video Devce: /dev/video0

Probed Info: Should see the card!

Default Input: Tuner1

B) Video Sources

* New Video Source

Video Source Name: Cable

Listings Grabber: Transmitted Guide Only (EIT)

Channel Frequency Table: us-cable

C) Input Connections

* Select Tuner 1

Video Source: Cable

MythTV Troubleshooting

MythTV Troubleshooting:

1) Audio Adjustments in MythTV not working:

a. Change: Utilities/Setup > Setup > General > Next (2 Menus) Audio Menu > Mixer Device: ‘ALSA:default’

2) If unable to connect to database…

a. Run “sudo dpkg-reconfigure mythtv-database”

Qjoypad a joy2key that actually works!

joypad is a sexy utility for linux that can convert basic digital joystick button and axis functionality into keypresses. It is great for mythbuntu because you don’t need a remote you can just configure a joypad to emulate all of the keypresses for the mythtv interface.

Installing Qjoypad

The Install for Qjoypad is a little tricky because it is not “technically” supported by Ubuntu so you need to actually compile the Debian sources to get it to work properly.

  1. Download the Qjoypad source files to your “/home/username/” directory:

    http://sourceforge.net/project/downloading.php?groupname=qjoypad&filename=qjoypad-3.4.1.tgz

  2. Install the following packages using the Synaptic Package Manager:
    a. zsnes (totally superflous but you should have it installed anyway)
    b. sdlmame ( also superfluous but I installed it before installing Qjoypad so its in here)
    c. Libqt3 dev
    d. Libxtst dev
    e. Libsamplerate
    f. Libsdl_ttf 2.0
    g. G++

    * here’s where things get tricky *

  3. Open up a terminal window and run the following commands:

    cd /home/username/
    tar xf qjoypad-3.4.1.tgz

    cd qjoypad-3.4.1/src
    ./config
    make
    make install

    * if you get any errors at this point you are probably missing some packages I have only tested this with mythbuntu so it may have somethings pre-installed which you need. you can troubleshoot and debug by looking at the error messages and installing the packages you need.

Configuring Qjoypad

There are 2 ways to configure Qjoypad: using the GUI interface (I found it quite buggy) or editing the config files manually (very simple a drunken monkey attached to stephen hawkings arm could do it with his bulbous half numb tongue).

Configure using the GUI interface:

To start up the GUI interface just open up a terminal and type in the following command:

qjoypad

I remember this was quite tricky but all you do is select a joystick then click on a button in the interface and assign a key to it. When you are done click save and give your profile a name.

Configure Qjoypad Using a .lyt Config File

The .lyt config files are fairly easy to configure if you know the standard X11 keycodes for the keys you want to assign. The layout config files must be stored in the folder /home/username/.qjoypad3/. Here is an example of a layout file:

dummysticks.lyt
# QJoyPad 3.4 Layout File
Joystick 1 {
    Axis 1: +key 55, -key 41
    Axis 2: +key 56, -key 42
    Axis 3: +key 102, -key 100
    Axis 4: +key 104, -key 98
    Axis 5: +key 102, -key 100
    Axis 6: +key 104, -key 98
    Button 1: key 38
    Button 2: key 52
    Button 3: key 53
    Button 4: key 39
    Button 5: key 24
    Button 6: key 25
    Button 7: key 40
    Button 8: key 54
    Button 9: key 26
    Button 10: key 27
    Button 11: key 36
    Button 12: key 9
}

Qjoypad will assign the Joystick 1 config to whatever joystick is plugged in first, it doesn’t really recognize specific joysticks kind of like the xbox 360 what ever it sees first is automatically called Joystick 1.

X11 keycodes

You can type the “xev” command into a terminal window and hit keyboard keys to get the X11 keycode for them.

Running Qjoypad

To run Qjoypad using a specific configuration use the following command (replace dummysticks with the name of your layout file but you don’t need to use the extension when running the command .lyt):

qjoypad --notray dummysticks

Qjoypad Autoload at Startup (Mythbuntu)

Open up a terminal window and type the following command:

nano /home/username/.mythtv/session

Add the following line to the session file

qjoypad --notray dummysticks

also make sure the session file is executable

chmod 755 /home/username/.mythtv/session

Qjoypad Autoload at Startup (Ubuntu)

See Pauls post http://ubuntu.bryanludvigsen.com/?p=49 and Add the following command to Startup:

qjoypad --notray dummysticks

By the way I got the name dummysticks from Paul and Jason. They said it was some game they played while in Yukon… not sure what it was about… ;)

-Steve