# Mode 0 without a network connection - solved



## Richard Loxley (Jun 4, 2002)

I've just invested in a 32" LCD, so wanted to activate mode 0 (high resolution, high bitrate recording) but I don't have a network card in the Tivo.

The best tutorial I found was http://www.tivocommunity.com/tivo-vb/showthread.php?t=286938 but the consensus seems to be that you can only install this hack with a network connection because you have to run scripts on the Tivo to do the mod.

So I invented a way to do it, which I present here 

This assumes you are comfortable with removing your Tivo drives and putting them in a PC (e.g. if you've done a drive upgrade).

First connect the drives. I used the following arrangement, if you connect them differently you'll have to adjust the drive letters:


```
DOS disk on primary master (hda)
CDROM (boot) on primary slave (hdb)
Tivo disk on secondary master (hdc)
```
In Windows put following files in c:\tivo


```
fpga7114.o.lj
iicsetw
rc.sysinit.author
runonce.sh
setupMode0.tcl
```
I wrote runonce.sh and created a modified rc.sysinit.author, but the other 3 are unmodifed versions of the files written by other people. For convenience I've attached all 5 in one zipfile.

Boot from your favourite Tivo upgrade boot CD, remembering to enable byteswapping, e.g. on a standard MFS Tools CD, use the following at the boot: prompt


```
vmlnodma hdc=bswap
```
Mount the DOS disk:


```
mkdir /mnt/dos
mount /dev/hda1 /mnt/dos
```
Mount the Tivo var partition:


```
mkdir /mnt/var
mount /dev/hdc9 /mnt/var
```
Find the Tivo root partition; first try


```
mkdir /mnt/root
mount /dev/hdc4 /mnt/root
ls -l /mnt/root
umount /mnt/root
```
If you get the message "Must specify filesystem type", it's not hdc4. Next try


```
mount /dev/hdc7 /mnt/root
ls -l /mnt/root
umount /mnt/root
```
If only one suceeded, that's the partition you need. If both worked, whichever had the newest dates on the files was the correct one.

Now mount the correct one:


```
mount /dev/hdc4 /mnt/root
```
or

```
mount /dev/hdc7 /mnt/root
```
Replace the fpga module (fixes position of the image in mode 0 and adjusts some other display parameters, see http://www.ljay.org.uk/tivoweb/tivo_fpga.html for details):


```
cd /mnt/root/lib/modules
mv fpga7114.o fpga7114.o.original
cp /mnt/dos/tivo/fpga7114.o.lj fpga7114.o
```
Create the /mnt/var/hack files:


```
mkdir /mnt/var/hack
mkdir /mnt/var/hack/bin

cd /mnt/var/hack/bin

cp /mnt/dos/tivo/runonce.sh .
cp /mnt/dos/tivo/iicsetw .

chmod 755 *
```
Set up the runonce directory:


```
mkdir /mnt/var/hack/runonce
cd /mnt/var/hack/runonce
cp /mnt/dos/tivo/setupMode0.tcl .
chmod 755 *
```
Modify the startup scripts to call the runonce script and iicsetw every time the Tivo boots up:


```
cd /mnt/root/etc/rc.d
ls -l
```
If rc.sysinit.author is not there or zero size, copy the new one over:


```
cp /mnt/dos/tivo/rc.sysinit.author .
```
If you already have a rc.sysinit.author, then you probably have a disk image which already contains hacks. You can append the new lines to the file with


```
cat /mnt/dos/tivo/rc.sysinit.author >> rc.sysinit.author
```
But then you'll have to edit rc.sysinit.author with vi or joe to make sure it makes sense. Ask here for advice if you're not sure.

Unmount the partitions:


```
cd
umount -f -a -r
control><alt><delete>
```
Wait for the PC to restart and then power off.

Remove the disk and put it in the Tivo. Boot up Tivo, wait 5 minutes after boot to ensure the "runonce" scripts have run, then reboot if necessary.

The runonce script will run everytime the Tivo boots up. It checks the directory /var/hack/runonce for any executable files, executes them, and then moves them to the directory /var/hack/runoncedone. That way they will be executed once, and then never again unless you move them back to the /var/hack/runonce directory.

It is executed 3 minutes after the Tivo boots up, to allow anything else relevant to start up. You should therefore wait at least 5 minutes after starting the Tivo to make sure it has run before rebooting (assuming your change needs a reboot to take affect - which I believe the mode 0 modification does).

For the mode 0 modification make sure save disk space is enabled in the Tivo set up pages.

You can check the results of the runonce script by putting the disk back in the PC and:

Boot from relevant CD (remember byteswapping)

Mount the Tivo var partition:


```
mkdir /mnt/var
mount /dev/hdc9 /mnt/var

cat /mnt/var/log/runonce
```
Which if everything went well, will look something like this:


```
Sat Dec  1 17:51:28 localtime 2007
Executing /var/hack/runonce/setupMode0.tcl
Resources for BEST mode set to Mode 0 (bobones settings) values
Sat Dec  1 17:51:35 localtime 2007
Moving /var/hack/runonce/setupMode0.tcl
```
This file lists the date and time and filename of every file executed. Any output or errors from the scripts executed will also appear in the file after the filename. If the files don't execute remember to check they have execute permissions (chmod 755 <filename>).

You can also check the new bitrates are being used by looking in the log file:


```
mkdir /mnt/dos
mount /dev/hda1 /mnt/dos
cp /mnt/var/log/tvlog /mnt/dos/tivo
```
This saves the tvlog file so you can look at it in your favourite text editor later. Search for the string "VBR", which will only appear if you have set "save disk space" to yes, and have the new bit rates. You should see lines such as:


```
Dec  1 18:01:58 (none) TmkMediaswitch::Trace[133]: using VBR, bitRate=4800000, maxBitrate=9000000
```
if it's worked. Search also for CBR, which will list the bit rates when "save disk space" is turned off, or if the original (non-VBR) bit rates are still being used:


```
Feb 21 07:29:58 (none) TmkMediaswitch::Trace[128]: using CBR, bitRate=5960000, maxBitrate=5960000
```
You'll probably have a mixture of both, before and after the upgrade, so check the dates.

Remember to unmount the partitions and shutdown cleanly:


```
cd
umount -f -a -r
control><alt><delete>
```
Note that although this just worked successfully for me, you have to do this at your own risk!

It's also worth noting that once you've set this up, you can pull the drive, copy anything into /var/hack/runonce and it will run it exactly once on the Tivo. Thus almost any hack can be installed using this technique 

Just remember to check the paths in your scripts, as you'll have to put the main script in /var/hack/runonce, but any other files the script needs should be in a different directory to ensure they are not executed themselves.


----------



## ciper (Nov 4, 2004)

Why not run the links web browser locally on the tivo over a serial connection and connect to 127.0.0.1 and change the settings?


----------



## Richard Loxley (Jun 4, 2002)

ciper said:


> Why not run the links web browser locally on the tivo over a serial connection and connect to 127.0.0.1 and change the settings?


I don't have an appropriate serial cable, I'd have had to pull the drive anyway to activate serial access, and I make my living writing shell scripts so for me this was the easiest solution!


----------



## afrokiwi (Oct 6, 2001)

nice one ...


----------



## Richard Loxley (Jun 4, 2002)

Well, this hacking lark is addictive isn't it?

I got fed up of swapping drives every time I made a tiny change to a tcl script, so I bit the bullet and made myself a serial cable.

Turned out I had an old serial mouse in my box of computer bits, and some broken headphones, so didn't cost a penny.

But I still think the drive pulling route is the way to go for a "single-shot" upgrade process. If I put hacks on my mum's Tivo, I'll probably do it that way.


----------



## geekspeak (Oct 1, 2002)

This looks great - just what I have always wanted. Thanks santa, sorry, Richard Loxley! Has anyone else tryed it yet? (Not that I am not trusting!) 

Is it difficult to uninstall should the need arise? (e.g. if it turns out my particular box suffers form the flashing colours I have heard about?)

Also I have heard people mention different tweeks of resolution/bitrates, can these be tweeked using this menthod or are the settings used, considered the best?

If I don't want to keep mode 0, is it as simple as switching "save space" off again. Finally does mode 0 affect "live tv" - not that I use such a bizarre function - just thinking about testing/comparison.

Might try it at the weekend. Thanks again!


----------



## Richard Loxley (Jun 4, 2002)

I can't speak for anyone else, but I have now used this method to install 2 other hacks on the Tivo.

If you get into difficulty I'm happy to answer questions!

Yes, you can change the bitrates and reverse the mod if you need to, BUT you need to edit the file "setupMode0.tcl" to do so. Most of the file is functions to do various stuff, but if you scroll right to the bottom you'll see 2 lines:


```
#setDefaultValues
setBobonesBest
```
The # means a comment, so that line isn't executed. So when you run the script it sets up Bobone's settings (Bobone is the guy who provided this version of the script). These settings modify Best quality only to make it mode 0 resolution, and variable bitrate ranging from 4800000 to 9000000. So High, Medium and Basic are unmodified.

To undo the change, you need to edit "setupMode0.tcl" to make the last 2 lines look like this:


```
setDefaultValues
#setBobonesBest
```
which will set all the values back to the default. Note that you probably need to edit the file using an editor that understands Linux line-break characters, or use a 'dos2unix' style program after editing before putting it on the Tivo.

Then put the edited file in /mnt/var/hack/runonce and boot up the Tivo.

There are 2 other changes made: the fpga7114.o file, which as far as I know only affects the output of mode 0, so can be safely left in place, and the iicsetw file, which adjusts the RGB output to be less bright and less saturated. Again you can leave that in place if it improves the picture as it affects all output via RGB. If you want to get rid of it just remove /mnt/root/etc/rc.d/rc.sysinit.author after you've done everything else.

To adjust the bitrates (e.g. to try to minimise white flashes), edit "setupMode0.tcl" and scroll down to this section:


```
proc setBobonesBest {} {
	
   # DBSBestVBRBitrate
   set result [ResSetStringResourceValue 17 8 4800000] 
   # DBSBestMaxBitrate
   set result [ResSetStringResourceValue 17 9 9000000] 
   # DBSBestResolution
   set result [ResSetStringResourceValue 17 10 0] 
   # CATVBestVBRBitrate
   set result [ResSetStringResourceValue 17 40 4800000] 
   # CATVBestMaxBitrate
   set result [ResSetStringResourceValue 17 41 9000000] 
   # CATVBestResolution
   set result [ResSetStringResourceValue 17 42 0] 
   # RooftopBestVBRBitrate
   set result [ResSetStringResourceValue 17 72 4800000] 
   # RooftopBestMaxBitrate
   set result [ResSetStringResourceValue 17 73 9000000] 
   # RooftopBestResolution
   set result [ResSetStringResourceValue 17 74 0] 

   TVUpdateResources
   puts "Resources for BEST mode set to Mode 0 (bobones settings) values" 
}
```
The usual advice for tweaking the bitrates is first turn off "Save disk space" so Tivo is only using the "MaxBitrate" settings (the 9000000 values in the file). Then gradually reduce all the 9000000 values in proc setBobonesBest until the flashes disappear. Then set the VBR values to something lower and turn "Save disk space" back on.

After each change (making sure you use a Linux-friendly editor or dos2unix) you will need to put the file in /mnt/var/hack/runonce and boot up the Tivo, then re-boot after 5 minutes to allow the new settings to be used. Rather long-winded, but hey, you are saving money compared to a network card!

Now of course, all this is deviating from the step-by-step instructions I wrote for setting it up in the first place, so you have to be a little bit aware of what you are doing. If you don't understand what each step in my original instructions means, it might be worth you having a bit of a read in the forums or on google to find out.

It's definiately worth you understanding the following linux commands: cd, ls, cp, mv, rm, mkdir, chmod, mount, umount so you can follow along with the instructions.

If all this is too daunting, ask me very nicely, and I'll upload a modified "setupMode0.tcl" which will just re-set the values and post step-by-step instructions for undoing the mod. But understanding the process will probably give you more confidence in your ability to work on your Tivo in the long run


----------



## Cainam (May 25, 2004)

> (Bobone is the guy who provided this version of the script)


If I remember correctly, it was with Gary or BlindLemon who came up with the script.

The script was there to automate the task of setting the resoures and resolutions that Tivo uses which can be done in TivoWeb but can be fiddly. So the script makes it easier to put in all those values.

Various people tried numerous combinations of resource values to find out which ones gave the best trade off between files sizes, what Tivo could cope with, and how it look on screen. The values that Bobones came up with seemed to work very well for many people and became a sort of defacto standard, but other combinations are possible.

Again, IIRC, BlindLemon's own preferred settings are also in the script and can be chosen by replacing the "setBobonesBest" line to "setCustomValues" instead.

Just to give credit where it is due!

(Mr Lemon - I know you do not like people quoting you indirectly, but I think I got this right! Apologies if not.)


----------



## Richard Loxley (Jun 4, 2002)

Cainam said:


> Just to give credit where it is due!


Cheers


----------



## geekspeak (Oct 1, 2002)

Thanks for the updates. I think I remember most of the linux stuff from Uni and the odd dabble since. Heck I think I probably remember most of the vi commands. Weird!

Will definitely give it a go and let you know how I get on. I have a 2nd tivo for less critical stuff to play on first.


----------



## geekspeak (Oct 1, 2002)

Well, I think that was a success with my 2nd tivo!

Usual problems of new pc - SATA, only one IDE channel, used a floppy for the 5 files, but file names truncated to 8,3 so had to rename them back. 

Anyway all back up and running. Whilst waiting the 5 minutes I was switching back and forth with AUX and I was unable to see any difference anyway as I have a 28" CRT on the 2nd tivo, big test will be on the main tivo!

One problem though, when I did the cat runonce, I got what I should have got inc "Resources for Best mode set to Mode 0 ..." but before that I got four identical lines of 

retrying aftererrTmBackgroundHoldOff

Does this sound bad?


----------



## geekspeak (Oct 1, 2002)

Something isn't right. After checking the runonce log I put the drive back in the tivo and booted up. AUX worked but no picture on tivo live tv. Rebooted and it was all working again but the picture was certainly nothing like the quality of aux so I don' think any different to when I started. So I tried all over again. This time, I did not get the four errors but the picture is still no better. 

I do have save space on and I did allow 5 minutes. Is there anyway to tell? I have a 200Gb drive and Info is telling me 44 hr 43 minutes. Does this change at all with mode 0 enabled?

Not sure whether to try on my main tivo now??

P.S. I do see the right numbers in the log file 48 and 90 etc. There are a couple of error messages, something to do with promo not being able to do something. Does that mean anything?


----------



## Richard Loxley (Jun 4, 2002)

geekspeak said:


> One problem though, when I did the cat runonce, I got what I should have got inc "Resources for Best mode set to Mode 0 ..." but before that I got four identical lines of
> 
> retrying aftererrTmBackgroundHoldOff
> 
> Does this sound bad?


That's fine. The message means it was waiting for Tivo to stop accessing the database before it could update the bitrates.



geekspeak said:


> I have a 200Gb drive and Info is telling me 44 hr 43 minutes. Does this change at all with mode 0 enabled?


My 320GB Tivo went from 110 hours at Best to 73 hours with mode 0, so 45 hours sounds about right for mode 0 on 200GB.



geekspeak said:


> the picture was certainly nothing like the quality of aux so I don' think any different to when I started.


Are you saying that before the change you couldn't tell the difference between live TV and aux, but now you can? Or are you now using a different telly where the difference is apparent?

On my 32" LCD I can just tell the difference between aux (coming from Freeview) and mode 0 Live TV - if you have a better quality input than Freeview or a bigger set then the difference might be greater.



geekspeak said:


> P.S. I do see the right numbers in the log file 48 and 90 etc. There are a couple of error messages, something to do with promo not being able to do something. Does that mean anything?


I've no idea about the error message, but the log files often seem to have errors as a matter of course - maybe someone else can shed some light on it. The bitrates in the log file and the number of hours capacity definitely seem to show it has worked.

Has the picture quality stayed the same, improved (but still not as good as the aux input) or got worse?

If it's the same, then you probably don't need mode 0 for your TV. If improved, then it's probably as good as it will get now. If it's got worse then I'm not sure what has happened.


----------



## geekspeak (Oct 1, 2002)

ok, it looks like both my tivos are working with mode 0 now. Not quite sure what the difficulty was - it was almost like I had to do them both twice! Or the 5 minute thing is not long enough or an additional reboot is required???? 

I can still see a difference between live and aux but I am looking close up. I think it probably is better than before.

Anyway got there in the end. Thanks again.

I definitely had to wait 5 minutes, reboot, wait a while and then reboot again before info told me the new best space on the main tivo.


----------



## geekspeak (Oct 1, 2002)

Just an update now I have had mode 0 for a couple of weeks - the picture is dramatically better at 'normal' viewing distances. However the white flashes at the bottom of the screen are annoying. Is it possible to turn the parameters down a little to reduce this or is it a fundamental issue with "mode 0"? 

I am with cable. I seem to remember someone saying a different set of parameters might suit cable better?


----------



## Richard Loxley (Jun 4, 2002)

Yes, you can adjust the bitrates down a bit - see my previous post #7: http://www.tivocommunity.com/tivo-vb/showthread.php?p=5787191#post5787191 and scroll down to "To adjust the bitrates".

I'm not sure the best values to use, maybe a search for "mode 0" will give some values other people have used? The script I posted used 9000000 as the Max bitrate, and the original Best quality used 5960000, so something between the 2 would be good to try.

I guess I'm lucky, I've only seen the flashes on 2 programmes since I upgraded a month ago.


----------



## geekspeak (Oct 1, 2002)

Thanks, sorry forgot the previous post! (So much info about this)

I guess the number can be anything then - it doesn't need to be a multiple of anything. e.g. 8000000 or 7500000 etc ?

I was watching the football on BBC1 yesterday and it was flashing almost every 30 seconds (randomly of course) but have had the same on Zone Horror and I would imagine these two channels to be quite opposites in quality.


----------

