Samba in Mythbuntu

Setting Samba in Mythbuntu:

Open Terminal and type in:
sudo nano /etc/samba/smb.conf

Ensure that the Workgroup is the same as your home workgroup.

Check the default shares. They may ust need to be re-mapped if you moved the video, music, pictures or recordings directories.

Once all looks good, then restart.

Creating Ubuntu Torrent and Xbox 360 Media Server

Wow, it’s been awhile since i’ve posted something, but i think that just means that Ubuntu 9.10 has been really stable. It honestly has. I’m running it on multiple computers and compatibility has been a non issue. Now crazy tricks to get things to work properly. However this past weekend i went to work on a new Ubuntu project.

So recently i came upon an old Dell Optiplex GX240. For those who don’t know, this computer is fairly elderly with not a whole lot of useful tasks it can be utilized for any more. My original intention when i purchased the thing for $25 was to use it as a companion to my 42″ LCD since it had such a small case. I already have a HD PVR, so i wasn’t going to use it for that. But simply to browse the web, play flash movies, and a bit of nintendo emulation in a tight small case that doesn’t look like a total eye soar in my tv shelf. Unfortunately, this P4 1.5Ghz with 512MB RAM couldn’t handle it due to the pitiful 16MB AGP video card. And since it only takes low profile AGP cards… i wasn’t about to try and hunt one down.

So after blowing $25 and wanting to salvage my investment my idea changed to create a torrent server that i could stream movies to my Xbox without using the terribly unreliable Windows Media Center. After a good portion of a saturday and a lot of trial and error and swearing, i got myself an Ubuntu torrent and xbox 360 media server using TorrentFlux and uShare.

So here is the quick and easy instructions on how to create a web based torrent downloading client on an Ubuntu machine and stream your torrent downloads directly to your Xbox using Apache, PHP, MySQL, TorrentFlux and uShare.

First off, download the latest version of TorrentFlux which is basically your Bit Torrent download client that will be run on your Ubuntu server. You can find it at www.torrentflux.com

After you download TorrentFlux, take your freshly installed Ubuntu 9.10 machine (or an Ubuntu install you haven’t messed up too badly yet) and install Apache 2.

$ sudo aptitude install apache2

Install PHP 5

$ sudo aptitude install php5

Install MySQL

$ sudo aptitude install mysql-server

$ sudo aptitude install php5-mysql

Restart the apache server

$ sudo /etc/init.d/apache2 restart

LAMP stack is now installed, now move onto installing TorrentFlux (i used 2.4, but whatever is newest i’m sure will work fine). I chose to install in the root www folder of apache, but feel free to put it where you want. I untarred the torrentflux file on my desktop then moved the html folder of TorrentFlux into the root www folder of apache.

$ tar -xvzf torrentflux_2.4.tar.gz

$ sudo chown (user):(user) /var/www/

$ cd /home/user/Desktop/torrentflux_2.4/html/

$ cp -r * /var/www/

Now that we have TorrentFlux in the proper folder, it’s time to setup the database. Create a database called torrentflux.

$ mysqladmin -u root -p create torrentflux

Now run the sql file for torrentflux to get the database in the initial state to run TorrentFlux

$ cd /home/(user)/Desktop/torrentflux_2.4/sql

$ mysql -u root -p torrentflux < mysql_torrentflux.sql

Now you got to modify the TorrentFlux config file and set the database password you used when you installed MySQL.

$sudo gedit /var/www/config.php

modify these lines as you see fit.

$cfg["db_user"] = “root”; // username for your MySQL database

$cfg["db_pass"] = “”; // password for database

Now to set the file permissions on your torrent download folder.

sudo chmod -R 777 /var/www/downloads/

Now that TorrentFlux is now setup, go to http://localhost/index.php and make sure you get a login screen. If you did, that means you followed the steps correctly. Your first login is actually setting your admin username and password. So use this screen now to set that.

So now that we got that complete, we only have to setup the uPnP streaming server to stream the files to our xbox. To install ushare, do the following.

$sudo apt-get install ushare

Once that is installed, lots stop the ushare server and set the configuration.

$/etc/init.d/ushare stop

$sudo gedit /etc/ushare.conf

For my installation, this was probably the biggest pain of it all to get it to stream to the xbox correctly. Problem one, on default, despite what your settings may say, it doesn’t load into ushare using Xbox mode, and sometimes the port changes after you stop and start the server (we will remedy this later in the post when modifying the rc.local file). Not sure if i was doing something incorrectly or just bad luck, but this is the configuration that works 100% for me. The following are lines you should have set in the ushare.conf file. Although feel free to change the ushare_name as that’s the name it shows up as on your xbox. Also, if your downloads folder is a different location than mine, change that.

USHARE_NAME=Torrent

USHARE_PORT=49200

USHARE_DIR=/var/www/downloads

ENABLE_WEB=yes

ENABLE_TELNET=no

ENABLE_XBOX=yes

Next you are going to want to configure the mime types for video streaming.

$ sudo gedit /usr/share/mime/packages/freedesktop.org.xml

find:

type=”video/x-msvideo”

change to:

type=”video/x-ms-wmv”

One of the problems i encountered and mentioned above is that by default, it doesn’t want to take the ENABLE_XBOX settings, so on bootup, your xbox can’t see your torrent server. So to change this, i modified the rc.local file (file which runs whenever you boot linux) to run some root commands to shut down the server, and start it back up on a new port forcing xbox enabled.

$ sudo gedit /etc/rc.local

at the end of the file right before the line “exit 0″, write above it

/etc/init.d/ushare stop
ushare -p 49201 -x

The last couple hurdles i had to overcome was refreshing the share list and updating file permissions. One of the issues with uPnP streaming is that it indexes the list of files you are streaming. This means that even though you download new files, your xbox isn’t going to see them. Luckily ushare builds in a page where you can update it, so i added the link right inside the TorrentFlux interface for easy use. Only thing is, when you are watching a video on your xbox, it’s not accessible, so don’t refresh your list while you’re watching. The other issue i found was TorrentFlux gives it’s own owner to files it downloads. If you share that folder on your network and want to move or delete files, it likely won’t let you, so i just made a script that updated the permissions for every file in the downloads folder. I’m sure there is a better way to do this, but at this point, i was kind of lazy and didn’t want to spend a lot of time figuring this out, and i figured this way was pretty easy by adding the link into the TorrentFlux interface as well.

$ sudo gedit /var/www/index.php

at the very end of the file. but right above the body and html tags, insert this:

<p><center><a href=”http://<?php echo $_SERVER["SERVER_ADDR"]; ?>:49201/web/ushare.html” target=”_blank”>Refresh Share List</a><br><a href=”permissions.php” target=”_blank”>Refresh File Permissions</a></center>

now to create the script that will update the permissions.

$ sudo gedit /var/www/permissions.php

insert the following code.

<?php
echo “Fixing File Permissions…<p>”;
echo shell_exec(“chmod -R 777 /var/www/downloads/”);
echo “<p>Done”;
?>

And just like that you’re done. You now have a torrent client on a remote server you can access from anywhere and you are able to stream everything you download with ease to your xbox. All you gotta do on your xbox is select “My Xbox” and then “Video Library” and select the ushare name you set to your server. Have fun!

$ sudo chown user:user /var/www/torrentflux/

HP Mini 1000 audio fix for Ubuntu 9.04

So i decided to pick up a sexy netbook and i couldn’t be happier. Now, this is the first time i’ve actually purchased anything that wasn’t a desktop, and the recent surge in popularity of netbooks caught my interest. Now i rarely have a need to do computer work on the road or have the need to take a computer somewhere, but i knew i could find some conveniences with a netbook that i wouldn’t normally have with a laptop. Netbooks are tiny, light, and generally look better than laptops. Plus they have enough power to do your every day tasks and is crazy easy to carry around. I decided on the HP Mini 1000 (1035NR) for 2 reasons. 1, the keyboard is large for my freakishly bulbus fingers, and 2. the price was right for only $279.

Obviously, my first task after opening it up was installing Ubuntu. First problem was that i don’t have an external dvd drive, so i had to create a bootable usb flash drive with the ubuntu cd image. That had it’s own set of challenges until i actually managed to format the flash drive correctly prior to loading the image on to it.

After i got Ubuntu installed it looked absolutely perfect with none of the usual suspects when it comes to Linux compatibility with hardware with the one exception of the audio. After searching all over getting no real good answers, i find this incredibly helpful post with a line by line instruction on how to compile the newest alsa drivers from source. i followed the instructions, rebooted, and bam, i got myslef some sound.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/318942/comments/63

- First, check that you have this packages installed (sudo apt-get install package_name):
patch, gettext, libncurses5-dev, xmlto, xmltoman
- Use this script:

cd ~
mkdir soundtmp
cd soundtmp

wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.19.tar.bz2
wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.19.tar.bz2
wget ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.0.19.tar.bz2

tar xjf alsa-driver-1.0.19.tar.bz2
tar xjf alsa-lib-1.0.19.tar.bz2
tar xjf alsa-utils-1.0.19.tar.bz2

cd alsa-driver-1.0.19
./configure –with-cards=hda-intel –with-kernel=/usr/src/linux-headers-$(uname -r)
make
sudo make install
cd ..

cd alsa-lib-1.0.19
./configure
make
sudo make install
cd ..

cd alsa-utils-1.0.19
./configure –disable-nls
make
sudo make install

- Change your alsa-base.conf file (sudo gedit /etc/modprobe.d/alsa-base.conf) adding these lines:

options snd-pcsp index=-2
alias snd-card-0 snd-hda-intel
alias sound-slot-0 snd-hda-intel
options snd-hda-intel model=hp-m4
options snd-hda-intel enable_msi=1

- Go to System>Preferences>Sound and change first 4 options to ALSA

- Reboot!

- After reboot you should hear login sound…

- In volume control, you’ll want to set the input sources to “line” and “front mic” for the HDA Intel (Alsa mixer). Make sure your volumes are not set too low after a reboot, you’re off and running (thanks to jasonq).

Built in speakers work, headphones and internal mic. Magic blue keys works too, and i’m not having issues about playing from 2 different sources at the same time (youtube in firefox and mp3 in rhytmbox). However, I didn’t test external mic.

Tabbed SSH Terminals to Remote Systems in Ubuntu

Most Server Administrators need to manage multiple Unix/Linux servers via remote SSH Terminals. Here’s a quick guide on how to set up multiple SSH Server Profiles so that they can be run in a tabbed environment in a standard Ubuntu install.

Step 1: Open a Terminal

Applications -> Accessories -> Terminal

Step 2: Create a New Profile

On the terminal window tool bar click File -> New Profile

Give this new profile a name like ‘test’ then click the “Create” button.

Step 3: Set Up Profile Settings

Click the “Title and Command” Tab.

Initial Title: type in the name that you want to appear in your SSH tab/ window.

Check the “Run a custom command instead of my shell” check box to on.

Custom Command: Type in the SSH command line to connect to the remote server.

When command exits: Set this Dropdown to “Exit the Terminal”.

Click the “Close” button.

Step 4: Open Up a Tabbed SSH Terminal to a Remote Server Profile

Click File -> Open Tab -> [profile name]

Type in your password and you are good to go!

Step 5: Setting Up Multiple Profiles The Quick Way:

If you are setting up multiple profiles you can select a base profile to use as template in the “New Profile” Popup by selecting a previously created profile in the “Base on” Dropdown.

You can now setup tabs for all of your remote SSH sessions in Ubuntu without installing other programs!

Mounting a UFS2 drive in ubuntu (read only)

Believe it or not reading a FreeBSD UFS2 Drive Partition is even more tricky then mounting an ntfs or FAT partition! Here’s the low down on how it worked for me.

I did this using a disk formatted in FreeBSD 6.2 using UFS2 connected via a USB Disk Enclosure.

Open up a terminal and type the following commands substituting “/dev/sdc1″ with your ufs partition device name:

sudo mkdir /mnt/ufsdisk

sudo mount -t ufs -r -o ufstype=ufs2 /dev/sdc1 /mnt/ufsdisk

Voila! I could read all of the files on the drive! Not sure how to mount a ufs partition for writing, but if you need to get data off of a FreeBSD UFS2 drive (UFS2 is for FreeBSD 5-7) this should work.

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!

Adding LIRC to Mythbuntu Game Emulators

Most of the stuff in this post I found at an awesome wiki that explains how to completely configure mythgame for mythbuntu. This post just covers setting up zsnes and sdlmame to work with lirc so that you can use your remote to navigate menus and control volume and all that great stuff.

Here is a link to the article with information on almost every emulator out there and how to configure them: http://www.mythtv.org/wiki/Configuring_MythGame_Emulation#Remote_Control_Integration.

Step 1 Install Packages Using Synaptec Package Manager

  • xmacro
  • sdlmame
  • zsnes

Step 2 Edit LIRC Config Files

Run the following command from console:

nano ~/.lirc/irexec

File Contents:

begin
remote = mceusb
prog = irexec
button = Stop
config = xmacro-wrap extra1
repeat = 0
end
begin
remote = mceusb
prog = irexec
button = Power
config = xmacro-wrap Exit
repeat = 0
end
begin
remote = mceusb
prog = irexec
button = Pause
config = xmacro-wrap Pause
repeat = 0
end
begin
remote = mceusb
prog = irexec
button = Play
config = xmacro-wrap LoadState
repeat = 0
end
begin
remote = mceusb
prog = irexec
button = Record
config = xmacro-wrap SaveState
repeat = 0
end
begin
remote = mceusb
prog = irexec
button = More
config = xmacro-wrap SelectState
repeat = 1
end
begin
remote = mceusb
prog = irexec
button = VolDown
config = xmacro-wrap VolDown
repeat = 1
end
begin
remote = mceusb
prog = irexec
button = VolUp
config = xmacro-wrap VolUp
repeat = 1
end
begin
remote = mceusb
prog = irexec
button = OK
config = xmacro-wrap Return
repeat = 0
end
begin
remote = mceusb
prog = irexec
button = Home
config = xmacro-wrap Menu
repeat = 0
end
begin
remote = mceusb
prog = irexec
button = Up
config = xmacro-wrap Up
repeat = 1
end
begin
remote = mceusb
prog = irexec
button = Down
config = xmacro-wrap Down
repeat = 1
end
begin
remote = mceusb
prog = irexec
button = Left
config = xmacro-wrap Left
repeat = 1
end
begin
remote = mceusb
prog = irexec
button = Right
config = xmacro-wrap Right
repeat = 1
end

Run the following command from console:

nano ~/.lircrc

Add the following line to that file:

include ~/.lirc/irexec

You may need to restart your lirc daemon for changes to take effect.

/etc/init.d/lirc restart

Step 3 Create a macro-wrap Script

OH Wait! Here is one for you already that contains the commands for both zsnes:
run this command from console and paste the text in the box below in

sudo nano /usr/bin/xmacro-wrap

File Contents:

#!/bin/bash
# xmacroplay wrapper for emulators under mythTV

# finds an emulator running and loads its keytable.
# add your emulator below! Use the ‘unused’ key for unused commands
function keyAssign {
# master list of commands
COMMAND=( ‘Exit’ ‘Reset’ ‘SaveState’ ‘LoadState’ ‘PickState’ \
‘IncState’ ‘DecState’ ‘Fastforward’ ‘SlowDown’ ‘Rewind’ \
‘Pause’ ‘Return’ ‘Menu’ ‘VolUp’ ‘VolDown’ \
‘Mute’ ‘Up’ ‘Down’ ‘Left’ ‘Right’ \
‘Extra1′ ‘Extra2′ ‘Extra3′ ‘Extra4′ ‘Extra5′)
let NUMCOMMANDS=${#COMMAND[@]}-1
KEYS=”

####### ########################################################
# Add other emulators below! ##################################################
####### ########################################################

#zsnes configuration
if ps -A | egrep -q ‘ zsnes’; then
# quit reset save_st load_st pick_st
KEYS=( ‘F11′ ‘F10′ ‘F2′ ‘F4′ ‘F3′ \
# st+ st- ffwd slow rwnd
‘unused’ ‘unused’ ‘unused’ ‘unused’ ‘unused’ \
# pause ok menu vol+ vol-
‘p’ ‘Return’ ‘Escape’ ‘F8′ ‘F9′ \
# mute up down left right
‘unused’ ‘Up’ ‘Down’ ‘Left’ ‘Right’ \
# extra1 extra2 extra3 extra4 extra5
‘Escape’ ‘unused’ ‘unused’ ‘unused’ ‘unused’ )
PASSNUMERAL=’true’ #use numbers to change state for fceu
EMUNAME=”ZSNES”
#sdlmame configuration
elif ps -A | egrep -q ‘ sdlmame’; then
# quit reset save_st load_st pick_st
KEYS=( ‘Escape’ ‘F3′ ‘F7′ ‘Shift_L+F7′ ‘unused’ \
# st+ st- ffwd slow rwnd
‘unused’ ‘unused’ ‘unused’ ‘unused’ ‘comma’ \
# pause ok menu vol+ vol-
‘unused’ ‘Return’ ‘Tab’ ‘Right’ ‘Left’ \
# mute up down left right
‘asciitilde’ ‘Up’ ‘Down’ ‘Left’ ‘Right’ \
# extra1 extra2 extra3 extra4 extra5
‘Escape’ ‘unused’ ‘unused’ ‘unused’ ‘unused’ )
PASSNUMERAL=’true’ #use numbers to change state for nestopia
EMUNAME=”SDLMAME”
fi
}

#use KeyStr and hold down for a little bit. $1 is keystr, [$2] is delay
function pressKey {
echo “KeyStrPress $1″ | xmacroplay “:0.0″
local SLEEPTIME=.05 #.05 is a good default hold time for fceu and zsnes
if [ $# == 2 ]; then
SLEEPTIME=$2
fi
sleep $SLEEPTIME
echo “KeyStrRelease $1″ | xmacroplay “:0.0″
debugOutput “$1 ($SLEEPTIME seconds)” 1
}

#output to console/logfile
function debugOutput {
ECHOCOMMAND=”echo”

# use “debugOutput text 1″ or similar to prevent newline
if [ $# == 2 ]; then
ECHOCOMMAND=”echo -n”
fi
if [ $DEBUGMODE != 'none' ]; then
$ECHOCOMMAND “$1″
fi
if [ $DEBUGMODE = 'true' ]; then
$ECHOCOMMAND “$1″ >> ~/.xmacro-wrap.log

#trim log
if [ ! -z "$LOGFILESIZE" ]; then
cat ~/.xmacro-wrap.log | tail -n $LOGFILESIZE > ~/.xmacro-wrap.log
fi
fi
}

#send the key!
function sendData {
KEYSYM=’undefined’

# see if a numeral was entered
# if so, set the key symbol to that number if allowed by settings
# if the numeral is also a command, the numeral will be overwritten later
for i in 0 1 2 3 4 5 6 7 8 9; do
if [ "$1" == $i ] && [ "$PASSNUMERAL" = 'true' ]; then
KEYSYM=$1
fi
done

#find the key we want to send
# look for a match in our definitions
for i in `seq 0 $NUMCOMMANDS`; do
if [ "${COMMAND[i]}” = “$1″ ]; then
KEYSYM=${KEYS[i]}
COMMANDNAME=${COMMAND[i]}
fi
done

#if not legal key
if [ "$KEYSYM" = 'undefined' ] || [ "$KEYSYM" = 'unused' ]; then
debugOutput ” $KEYSYM for $EMUNAME”
exit 1
fi

#otherwise do it!
pressKey $KEYSYM $2
debugOutput ” sent to $EMUNAME”
exit 0
}

# true logs to file and to stdout
# false logs to stdout only
# none is silent
DEBUGMODE=’true’
LOGFILESIZE=’50′ #number of lines, use blank for unlimited

if [ "$#" == "0" ] || [ "$#" -gt "3" ]; then
echo ‘Wrapper for xmacroplay for use with emulators’
echo ”
echo ‘Usage: xmacro-wrap COMMAND [DURATION]‘
echo ‘ or: xmacro-wrap KEYSTR direct [DURATION]‘
echo ”
echo ‘COMMAND is any internally recognized command, for example’
echo ‘ Exit, Reset, SaveState, Mute.’
echo ”
echo ‘DURATION is in seconds.’
echo ”
echo ‘Direct mode is invoked like this: xmacro-wrap backslash direct 1′
echo ‘ (Sends backslash key, held for 1 second)’
echo ‘ see X11/keysymdef.h’
echo ”
exit 1
fi

#direct mode option
if [ "$2" = "direct" ]; then
debugOutput “Direct output: ” 1
pressKey $1 $3
exit 0
fi

DATESTR=”`date +%m/%d/%y` `date +%T`”
keyAssign
# if an emulator isn’t running, KEYS is blank
if [ -z "$KEYS" ]; then
debugOutput “$DATESTR, no emulator to pass command \”$1\”!”
exit 1
else
debugOutput “$DATESTR, command \”$1\”: ” 1
fi
sendData $@

Run the following command in console:

sudo chmod 755 /usr/bin/xmacro-wrap

Step 4 Create Game Launcher Scripts

Run the following command from console:

nano ~/snes.sh

File Contents:

#!/bin/bash
# zsnes path + executable
ZSNES=/usr/bin/zsnes
# irexec path + executable
IREXEC=/usr/bin/irexec
# irexec process name to kill
IREXEC_PS=irexec

$IREXEC &
$ZSNES “$1″
killall $IREXEC_PS
exit 0

Run the following command from console:

nano ~/mame.sh

File Contents:

#!/bin/bash
# zsnes path + executable
MAME=/usr/games/sdlmame
# irexec path + executable
IREXEC=/usr/bin/irexec
# irexec process name to kill
IREXEC_PS=irexec

$IREXEC &
$MAME -skip_gameinfo $1
killall $IREXEC_PS
exit 0

Run the following commands from console:

chmod 755 ~/snes.sh
chmod 755 ~/mame.sh

Step 5 Configuring Mythbuntu Game Players

Configure zsnes keys MISC->Misc Keys:

Start up the Myth Frontend Interface.
Select Utilities / Setup -> Setup -> Media Settings -> Game Settings -> Game Players.
New Game Player
Type: SNES
Command: ~/snes.sh

New Game Player
Type: MAME
Command: ~/mame.sh

Step 6 Problems

This guide requires that you have setup the proper keys in zsnes to match the keys in the xmacro-wrap script.

Make sure that in /etc/mame.ini file the rom-path is set to the path where all of the roms are located or sdlmame may not work.

Enjoy!

**Edit here is an updated set of lirc and shell scripts for running macrowrap!

mythbuntu-macrowrap-lirc

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