Difference between revisions of "Xbox Frontend on Xebian stable"

From MythTV Official Wiki
Jump to: navigation, search
m
m
Line 63: Line 63:
  
 
  XBOXLinuxInstall
 
  XBOXLinuxInstall
(NOTE: On my screen this appears incorrectly as Xbox and not as the correct XBOX)
+
 
 
You have a few options now; check the pdf for more but if you have a 10GB Seagate hard drive in you box, you'll probably want to install to the unused 2GB hard drive space (or F:/ partition) as it seems quicker than installing on E:. If you only have an 8GB Western Digital drive, you'll have to install to E: (check the pdf for instructions), otherwise:
 
You have a few options now; check the pdf for more but if you have a 10GB Seagate hard drive in you box, you'll probably want to install to the unused 2GB hard drive space (or F:/ partition) as it seems quicker than installing on E:. If you only have an 8GB Western Digital drive, you'll have to install to E: (check the pdf for instructions), otherwise:
  

Revision as of 19:49, 19 February 2008

Installing an Xbox Frontend on Xebian Stable

Alex Fisher has recompiled Christian Marillat's mythtv 0.20 source package against debian stable and optimised for Pentium 3.

The advantage with this configuration is that you do not need to upgrade any part of your Xebian from stable (sarge) to unstable (sid).

The following will end you with a ratpoison window manager and autostarting mythfrontend, with information taken from mycampus' Xebian And Mythtv-frontend HOWTO and the xbox-linux MythTV on Xebian wiki, combined together and a few steps clarified / added.

Assumptions

1. Xbox has been modded (either soft or hard, following assumes Krayzie's Ndure) and boots to a modded dashboard of some kind.

2. You are NOT using HDTV output. Composite is fine, RGB works only on pre-1.6 boxes (green image only on 1.6s), others you may have to try additional things to get working.

3. You know what size drive is in your xbox (open it up and look, or install XBMC and check product IDs in there).

4. Mythbackend 0.20.2 is installed somewhere else on the network.

5. Xbox has access to the network, with an IP in the same subnet as your mythbackend PC.

6. Make sure your mythbackend is configured with an IP not the default 127.0.0.1. You change this in mythsetup.


Install Xebian 1.1.4

Download Xebian 1.1.4-xbox, named dist-1.1.4-xbox.tar.gz at http://sourceforge.net/project/showfiles.php?group_id=54192 then extract and burn the ISO to disc using the slowest available speed and Track-At-Once if available. AS the xbox's dvd drive has compatibility issues, you may have to try burning to a different DVDR/W or CDR/W until one works. note If you burn to dvd you should be successful, there are some cdr/w disks which may be compatible (depending on drive and xbox version) but most if not all dvd's will work and will be cheaper. The cdrw route came about when DVD burners were rare and expensive.

Before booting Xebian, connect all devices you wish to use to the xbox via USB to Xbox converter cables if needed, inc. mouse, keyboard, remote and Xbox control pad. This may or may not help with correct drivers being loaded during install, but it don't hurt to make sure does it?

Insert the disc in to the xbox, and depending on your mod method it may just run, or with the Ndure mod, power off the xbox with disc in drive, power back on and Xebian should just start to boot. If not, try another disc.

Now follow the Xebian And Mythtv-frontend HOWTO pdf, steps 4.1 through 4.5. They're reproduced below incase the PDF ever goes awol.

If no keyboard is available, open xvkbd from the Apps > Tools menu available when pressing B on the xbox controler.

Now start a bash shell from Apps > Shells and, using the virtual keyboard if necessary, type:

su
xebian
cd /etc/network
nano interfaces

Edit the "iface eth0 inet static" line to read

iface eth0 inet dhcp

and save / exit nano by using Ctrl-X, hit Y, and enter. Now restart your ethernet interface using:

ifdown eth0
ifup eth0

Ignore any messages about eth0 not existing when you ifdown, and you should see printout confirming the assignment of a correct IP / gateway / subnet after ifup.


Now SSH in to the xbox, either via a Linux command line or using Putty on a Windows PC. On linux, this is:

ssh root@(xbox ip)

And on windows just type the ip in to the first box in putty and connect. Click or type yes to any key queries, and use "xebian" as the password (and "root" as login in putty).


Now install Xebian using the following command:

XBOXLinuxInstall

You have a few options now; check the pdf for more but if you have a 10GB Seagate hard drive in you box, you'll probably want to install to the unused 2GB hard drive space (or F:/ partition) as it seems quicker than installing on E:. If you only have an 8GB Western Digital drive, you'll have to install to E: (check the pdf for instructions), otherwise:

Choose the 2nd Install to free space option. Change the swap size to +512M (may or may not make much difference from 256M but it can't be bad) then wait about 8 minutes as the OS is installed.

When asked for IP / Netmask / Gateway, enter the xbox's current IP / Netmask / Gateway (that's the IP you're using to access over ssh, and your backend's netmask / gateway should be the same). Use whatever hostname you like but I kept default. Local network domain should proabably left at local.localdomain unless you know better. And that should be about it, once install is done you should see the text "Happy penguin" and you can type "shutdown -h now" to shutdown. Now power on with the eject button, remove the CD and boot in to your old dashboard.

You can boot xebian using the default.xbe file in E:/debian, which you should be able to access via your dashboard, in XBMC it's under Programs (you may have to add E:/debian as a source and chose the 2.3GB Linux program). Section 4.6 in the PDF gives more details on adding dashboard buttons to quick load the thing. Either way, it should take aprox 55 seconds to boot from F, and look identicle to the live CD.

First thing you should do when you boot up is SSH in again and make sure the time is set correctly. Run:

tzconfig

Type y and enter if the timezone wrong, and follow the easy steps to enter the correct one which should then list the correct time.

Update Xebian

This is where I went a little wrong, but it worked and from my experience using Linux updates, doing anything different may mean it doesn't work, so best you do the same...

After logging in via SSH again, firstly change /etc/apt/sources.list to look like the following (using "nano /etc/apt/sources.list", Ctrl-X, Y, enter to save), basically all you need to do is add the final two lines:

deb http://ftp.at.debian.org/debian stable main contib non-free

deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free
deb-src http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free

deb http://security.debian.org stable/updates main contrib non-free
deb-src http://security.debian.org stable/updates main contrib non-free

deb http://alexfisher.me.uk/debian sarge main
deb http://debian-multimedia.fx-services.com/ sarge main

The other links should be *left* using the *stable* repos. Now, update Xebian using the following command, which includes installing the joe text editor as it a) is what I did (and it worked) and b) ensures your updates are working as they should:

apt-get update
apt-get install joe
apt-get update
apt-get upgrade

The joe installation will print out a readme file, just type :q (colon, Q) to exit it, ignore the errors about log file permissions, then choose Y to install glibc now and Y to restart services.

After the upgrade hit :q again to exit the readmes, then chose No for the portmap stuff, N to keep the current /etc/issue and /etc/issue.net. Once upgraded you'll be dumped at a normal command prompt and just type "shutdown -r now" to reboot, then start up again from the dashboard.

Update Sources

SSH in again, and again edit your sources.list to change all "stable" links to "sarge". The resulting sources.list file will look like this:

deb http://ftp.at.debian.org/debian sarge main contib non-free
deb http://non-us.debian.org/debian-non-US sarge/non-US main contrib non-free
deb-src http://non-us.debian.org/debian-non-US sarge/non-US main contrib non-free

deb http://security.debian.org sarge/updates main contrib non-free
deb-src http://security.debian.org sarge/updates main contrib non-free

deb http://alexfisher.me.uk/debian sarge main
deb http://debian-multimedia.fx-services.com/ sarge main 

If you do not do this, you will get dependency errors when trying to install mythtv-frontend.


Add Myth-Backend to Hosts

Use nano to edit /etc/hosts and add a line with the IP and host name of your mythtv backend server:

192.168.1.2   biggs

Frankly I don't know how important this bit is, but anyway...

Install MythTV

Due to a possible bug in the installer, make and chmod a mythtv folder yourself:

mkdir /etc/mythtv/
chmod 777 /etc/mythtv/

Now run the following commands to install mythtv-frontend 0.20.2:

apt-get update
apt-get install mythtv-frontend

This should install all needed dependencies for you. If not, you probably have the /etc/sources.list file wrong - make sure that all links contain "sarge" instead of "stable". When asked for confirmation, hit Y and enter and when asked for the IP of the backend server, enter just that.

You may also want to install aditional plugins for mythfrontend at this point, though I left it til later just to make sure all was working beforehand. Whenever you want to install, just type:

apt-get update
apt-get install mythvideo mythmusic mythtv-themes

Add or remove whichever plugins you want, and note that without mythtv-themes you'll only have the default GANT or some yucky blue theme available.

I'm told this next bit poses security issues, though there's probably so many on mine I'll just have to make do if my oap neighbours hack in to my WPA2 network and rm -rf my ass. The potential smoother video playback is more than worth it imo, so let's give mythfrontend sudo id root acces:

chmod -s /usr/bin/mythfrontend

You'll also want to enable realtime priority threads in the frontend setup to make use of this.

Xbox Remote Key Bindings

Note: This section assumes you are using the official Xbox DVD remote kit and that you had it connected during the installation process (it may or may not work if not, check "more /etc/lirc/lircd.conf" for Xbox remote info if you didn't).


You now want to download and copy a key binding file for the Xbox remote to use with MythTV and Mplayer via a Lircrc and mplayer.config file. The Xbox remote should already be working with Lirc so you just need to copy a few files from a mythtv-xbox package. You might wanna check the file is still available for download at bit.blkbk.com first, and then continue with the install. You can also edit the lircrc file if you so wish / know how to, but you're on your own there.

cd /root
mkdir temp
wget http://bit.blkbk.com/mythtv-xbox.0.4.5-beta.tar.gz
gunzip mythtv-xbox.0.4.5-beta.tar.gz
tar xvf mythtv-xbox.0.4.5-beta.tar.gz
cd live
cp lircrc /usr/share/lirc/
cp mplayer.config /usr/share/mplayer


MCE User

Note: a number of the following steps differ from mycampus' pdf. You MUST follow the steps below for the the lircrc and .config files otherwise they will not link correctly, and you should also use the chown steps below to avoid chowning the whole /home directory which causes problems if you want to use any other user in the furture.


You can continue to use the default live user if you wish, and keep a nice fluxbox gui, but if you're just gonna be running mythfrontend then there's no need for this as it takes up a little memory which you could betetr use elsewhere. The below will setup the inbuilt mce user to be logged on by default and run mythfrontend automatically.

First up you need to link the copied lircrc and mplayer.config files to the mce users home directory, but you must also remove any current version of these files from there before you do so, so...

cd /home/mce
rm .lircrc
rm .mplayer/config
ln -s /usr/share/lirc/lircrc .lircrc
ln -s /usr/share/mplayer/mplayer.config .mplayer/config
mkdir .mythtv
ln -s /usr/share/lirc/lircrc .mythtv/lircrc


Database Conenction

You also now need to create a mysql.txt file within the .mythtv directory containing the mysql database info for mythfrontend. Without doing this, I found that mythfrontend would not start, and trying to start it via a command line on the xbox showed it had problems connecting to the database. The following steps resolved this for me.

First up, know what to put in mysql.txt. You should see what you need in either /etc/mythtv/mysql.txt or /home/(user)/.mythtv/mysql.txt on your backend, otherwise using the below defaults with the IP address of your backend and password found on the Setup > General page of mythfrontend on your backend machine should work.

cd /home/mce/.mythtv
nano mysql.txt

Use nano to enter the following (changing what's needed) and Ctrl-X, Y, enter to save.

DBHostName=192.168.1.2
DBUserName=mythtv
DBName=mythconverg
DBPassword=mythtv

Even after this you may have connection problems, so run the followin ON YOUR BACKEND MACHINE to allow access. Note that during my attempts to fix my problems, I did each of these three lines for the live, mce and mythtv users. Presumably only mce or mythtv is actually needed, but you're best just doing the same as I did. Just hit enter after the first command when asked for password.

mysql -u root -p -h localhost

GRANT ALL PRIVILEGES ON *.* TO 'live'@'192.168.1.3' IDENTIFIED BY 'secretmagicpasswd' WITH GRANT OPTION;
UPDATE mysql.user SET Password = OLD_PASSWORD('secretmagicpasswd') WHERE User = 'live';
SET PASSWORD FOR 'live'@'192.168.1.3' = OLD_PASSWORD('secretmagicpasswd');

Make sure to change 192.168.1.3 to your XBOX's IP, the secretmagicpasswd to the same as the one used in the mysql.txt file (your nomal mysql password) and iterate through live, mce and mythtv for all three lines.


Finishing Up

Now you just have two more things to do for the xbox's mce user. SSH back in if you aren't already, and...

nano /home/mce/.xinitrc

Edit the file to read:

exec /usr/bin/ratpoison &
exec /usr/bin/mythfrontend

Basically you just change freevo to mythfrontend. Ctrl-X, Y, enter.


Now, this is another bit that differs from the PDF guide as I'm sure it's wrong in there. You basically just want to chown all the files you just created to belong to the mce user, not root. Do a "cd /home/mce" then "ls -a -l" to see the current permissions, then:

cd /home/mce
chown mce:mce .lircrc
chown mce:mce .mplayer/config
chown mce:mce .mythtv
chown mce:mce .mythtv/mysql.txt
chown mce:mce .xinitrc

Do "ls -a -l" again and you should see all files belong to mce now. Note that I actually followed the guide's version which is:

cd /home/mce
chown mce:mce * -R
chown mce:mce .* -R

but this chown's the whole contents of the /home directory to the mce user and caused me to then have problems using the live user. But, if you have any problems getting Myth to work, you may wanna try this as a last resort as it's what's working on my system.


Auto Login

Just one more thing left, and that's to enable auto login.

nano /etc/inittab

What you want to do is change the "live" user in the following line to "mce":

1:12345:respawn:/sbin/mingetty --noclear --autologin live tty1

But while you're at it you should also comment out four or so of the extra teminals as these take up memory and unless you know better you'll never use them. So, edit the file so it looks as follows, then Ctrl-X, Y, enter to save.

1:12345:respawn:/sbin/mingetty --noclear --autologin mce tty1
#1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6

And that should be it. Type "shutdown -r now" to restart, boot your regular dashboard, run Linux, and you should see the Ratpoison gui load after 55 odd seconds, and Mythfrontend should load around 10 seconds later with no extra configuration needed. You'll probably wanna go through the setup and change things to your liking though, and if you know how there's plenty of stuff like extra optimization (eg. free up some more memory), installing a better remote and altering lircrc key bindings but I've not got that far myself yet so we'll leave that for another day.

Also, you'll notice it's not the fastest frontend ever. Recordings / TV should take around 20 seconds to start up, maybe 5 or so seconds to stop a video, and changing menu options via the OSD will also take 10 or so seconds. Paging will help, so after doing something once it should be quicker, but you'll probably just have to put up with it.

And if you're viewing on a CRT, you probably want to enable Bob(2x) deinterlacing. Unfortunately if you want/need to watch subtitles (like my father) then any live subtitling will either cause Bob to stutter on every word update, or may be barely visible due to constant flickering on and off. Regular (non-live) subtitling seems much better though as it only updates once every few seconds.

And general picture quality seems pretty good (better than XBMC's major contrast issues), if not quite as bold and vivid as my STB, but then I am currently using a composite scart socket and haven't touched display settings, either resolution or contrast/brightness/hue etc.


Tweaks

Enable Shutdown / Restart

As is, the option for "Yes, Exit and Shutdown" on the exit screen will just restart X. Handy if you're testing modelines, not so much if you actually wanna shut down. To fix, you can either run "chmod +s /sbin/halt" as root, or do as I do and add the following line to the end of /etc/sudoers:

mce    ALL=/sbin/shutdown

and change the shutdown command in general setup to:

sudo /sbin/shutdown -h now

Note that -h will shutdown and -r will restart so change to suit your needs.


Change Image Properties

WORK IN PROGRESS - If anyone has experience with xbox video optimisation I'd appreciate your input; most mailing lists haven't been touched for years and anyone who did once know things seems to not have touched their xbox for just as long...

Note: the following only applies to pre 1.6 xboxes. If you have a 1.6, you'll need to use a workaround such as this to correct overscan.

Resolution

I'm still working on this, but basically you wanna edit /etc/X11/XF86Config-4-xbox to add your wanted modeline under the Monitor section and change the "640x480" modes lower down the file to the name of your modeline. These are what I'm using at the moment:

Modeline "768x576" 28.44 768 800 904 936 576 588 593 605 -Hsync -Vsync
Modeline "720x576" 27.000 720 760 824 864 576 599 601 625 -Hsync -Vsync

Note that due to a bug in X, 720xXXX modelines will cause corruption in the MythUI, but do work fine when running video. Because of this, you can use the "seperate vid modes for gui + vid" setting to use a non-720 modeline for the GUI and a 720 modeline for video if you so wish. Also, due to the way the xbox outputs video, all timing information other than the dotclock and resolution in the modeline will be ignored, so you cannot use them to change the positioning of an image, and the xvidtune app will have no affect.

There is no need to use xbv or fbset to change resolutions; these do exactly the same thing.


Overscan

For overscan correction, append the following to the end of the "append" line in linuxboot.cfg, found in E:/debian when running FTP to the xbox (using a modded dashboard) regardless of whether you installed to E: or F:.

video=xbox:hoc=0,voc=0

Change the 0's for horizontal and vertical overscan correction to a number between 0 and 20. These work in percentages, with 0 being no overscan and 20 being 20% overscan. Note that to keep the original aspect ratio of the image, both percentage numbers should be kept the same, eg. hoc=10.voc=10.

You can also use the following command to change overscan on the fly; again with values between 0 and 20 inplace of the two 0s, eg xboxfbctl -o 10,10.

xboxfbctl -o 0,0


Flicker Filter

On 1.0 to 1.3 xboxes (with conexant video chips) the flicker filter defaults to 5, the highest filter setting, to smoothen any flicker that would be visible due to interlacing. Unfortunately this leaves you with an image with much less sharpness to it, and is not really suitable for video playback.

Firstly, use the following command to give printout of your current filter settings, and note you need to be root to do this:

xbv -d

Within the output you should see the flicker filter settings listed like this:

Flicker: DIS_FFILT=0, ADPT_FF =1, DIS_YLPF =1
F_SELY =3, F_SELC =3, Y_ALTFF =0
C_ALTFF =0, Y_THRESH=4, C_THRESH =4
YSELECT =1, FFRTN =1, PKFIL_SEL=0

If you do not see any filter settings (or the command will not run; you did run it as root?) then you should probably avoid doing the following. Otherwise, make a record of the current settings, then try this:

xbv DIS_FFILT 1

This should disable the flicker filter on conexant chips, and the result should be clear on any text or detail in a video. Unfortunately this then means any gui text will look terrible. You can either put up with it, or compromise with the filter enabled but at a much lower setting.

xbv DIS_FFILT 0 DIS_YLPF 0 Y_ALTFF 2 Y_THRESH 2 PKFIL_SEL 3

After this you can swap back to the original defaults by swapping the values in the line with the original ones from the xbv -d command. Because you can change the commands on the fly, try swapping between defaults with filter disabled, and the last line above with a low filter setting, and see if you can make out the differences. The filtered setting should show a very slight bluring of detailed images during video but not much less flicker, but as the disabled filter cause loads of flicker in the gui you may wish to either continue using the filtered line, or use a script to change between the two depending on whether you're watching video or in the gui.

Except, I haven't found any way of doing this. But, assuming you've done as I have above and are using seperate resolutions for video playback and gui then there is a workaround - you can query xdpyinfo for the current resolution setting and run the required xbv command depending on which resolution (representing video or gui) is currently set. I've yet to test my script yet but will update once I have it working.


Non-Conexant Xboxes

If you are using a PAL CRT and have a 1.4 or 1.5 xbox that uses a Focus video chip, you may be interested in this guide for a suitable modeline setup. I'm also not sure which of the above overscan / filter commands will work, but I'm assuming they all do for now.

If you own a 1.6 Xbox with an Xcalibur video chip, you'll likely have problems with one or more of the above. I have no idea which though; by the looks of it no one's ever really said what commands work and what don't, only that the Xcalibur has much less support for video based alterations. So until I try it out myself, you'll have to figure it out yourselves.

Known/Possible Issues

Jack Lowry has had a problem with his backend (Slackware 10.2, myth .19, mysql to 4.1.4) and his upgrading his xbox (xebian + mythtv 0.18 -> 0.19) with a mysql problem

But now I have a mysql version issue, when myth tries to make a 
connection to the mysql database I get a message in the .xsession-errors 
file that says:
ERROR 1251: Client does not support authentication protocol requested by 
server; consider upgrading MySQL client
I've also tried the mysql client and got the same error message.

It seems newer versions of mysql use a new password scheme that's compatible with the mysql client compiled into myth packages I was using. The following link provides several methods to work beyond this problem. I created a new user for my xbox frontend using the old format password.

http://dev.mysql.com/doc/refman/4.1/en/old-client.html

Another alternative is to check the my.cnf file on the server. It may contain an option to enable old-scheme passwords. Also, if you are unable to connect to the database check the my.cnf file to see if mysql is bound to an actual network address and not 127.0.0.1.

A simpler (MythTV) related solution to this problem can be found at the following link:

http://www.xbox-linux.org/wiki/MythTV_on_Xebian_HOWTO

Bear in mind that MythTV on the X-Box will run under the userid "live" and the instructions in the link above assumes the X-Box MySQL userid is also "live", so make sure you use this userid when configuring via mythtvsetup (runs by default first time) or by editing /home/live/.mythtv/mysql.txt.