torstai 29. toukokuuta 2008

How to recover from power failure with Mini

One important thing in VDR system is that it can survive from different kind of error situations. OS X has option like "Restart after power failure" so I was expecting that the option is saved to pram or somewhere anyway. But I just found out that if I unplug the power cord from Mini when Fedora is running and the putting the power cord back in after a while Mini wouldn't restart. Ouch!

Once again Google gave me some answers. Results pages were saying that in ppc machines you can use:

echo "server_mode=1" > /proc/pmu/options

But x86 linux doesn't have system like that. Luckily after some more googling I found the solution:

setpci -s 0:1f.0 0xa4.b=0

Not so logical, but it works :)

P.S. I bought Logitech Harmony 525 for 30,30 euro.

keskiviikko 28. toukokuuta 2008

Remote solution

I got my Logitech Harmony 525 working as I wanted with Lirc. Now there's enough buttons to cover the VDR usage and key-repeats work also fine with internal ir-receiver. But, I noticed that I cannot wake up the Mini from sleep with remote. It is working if Mini is put to sleep from OS X, but doesn't work from Fedora.

I checked /proc/acpi/wakeup and enabled all the USB devices from there by typing:

echo "USB1" > /proc/acpi/wakeup

But didn't help in case of the remote. USB keyboard and Bluetooth mouse did woke up the Mini, but neither Harmony or Apple Remote did. Then I plugged in the Satelco's ir-receiver and noticed that using Satelco remote Mini wakes up. So I'm going to buy Logitech Harmony 525, teach one button from Satelco remote as power command to Harmony and use the Satelco ir-receiver for wake up events.

Another good option could have been Playstation 3's Bluetooth remote. The price is about the same than second hand Harmony 525 and there is enough buttons also. You can get PS3 remote working with Linux using bdremote drive, which maps the buttons from Bluetooth to Lirc. But I decided to go with Harmony as that can be also used for controlling other devices if needed.

perjantai 23. toukokuuta 2008

Drawback with remote

Next thing I tried with the Mini was remote control. I installed Lirc and tried to record ir-commands with following command:

irrecord -H macmini -d /dev/hiddev0 appleremote.conf

After teaching the buttons I could start lirc with following command:

/usr/sbin/lircd --driver=macmini -d /dev/hiddev0 appleremote.conf

Apple remote worked fine, but Satelco remote didn't give any event for button presses. I googled around and found out that Mac Mini's ir-receiver doesn't support any other remotes than Apple's own! Solution is to use learning remote, like Logitech Harmony 525 which I happen to own, to learn many Apple remote codes to one set of keys.

Next thing I decided to try was to get the Satelco's USB ir-receiver to work. After some more googling around I found out that Fedora 9 would already support the receiver. The patch needed for the ir-receiver, which is reported as Samsung IrDA remote controller, is included in the kernel 2.6.25 and the Lirc version 0.8.3 also includes driver for the Samsung. But there is one crucial constraint: "Minor constraint: Repeat events are not supported." This is not acceptable with my system as for example setting the volume is very hard without key-repeats. Anyway I tested the remote with lirc's conf file for samsung, note that when Satelco's ir-receiver was plugged in, it was the first hiddev device and Mini's own was mapped to hiddev1 (This took some time to notice):

/usr/sbin/lircd --driver=samsung -d /dev/hiddev0 lirc.conf.samsung

The remote worked fine except for the key-repeats. Arrow buttons were mapped to keyboard's cursor keys, Ok button was mapped to Enter. Power button was mapped to power key of the system, so it put the Mac Mini to standby immediately, which isn't so great as VDR should be the one which initiates the standby command, otherwise the timer wakeup wouldn't work.

So now I need to use my Harmony 525 to learn different Apple Remote ir-codes and test that with Lirc. If it works flawlessy I then need to find out second affordable unit of that remote type so that my budget won't go too high.

torstai 22. toukokuuta 2008

First tests

I couldn't resist and yesterday I installed Fedora 9 to the Mini. First I installed minimum installation of OS X, it took 3GB disk space. Boot Camp Assistant adds always 5GB free space to the OS X partition, so I ended up with 49GB for Linux.

Next thing was to install rEFIt. I selected custom install with the support for ext3 etc, but otherwise installation was simple. After two reboots rEFIt menu appeared on boot. The way forward from that point was to follow this page's instructions. I chose to make 8GB partition for /, 8GB swap partition and rest 33GB for /video.

One thing I was suprised was that my Bluetooth mouse was already working on the installation menus. Installation of Fedora was straightforward, I choose not to install Office applications but I did install development tools. When file copying was some where around 75% the installation failed because of I/O error. I think that it was caused of read failure of installation DVD. So I started the installation from beginning with same options and this time it worked ok all the way through.

I had to use the rEFIt to update MBR and the start the Fedora rescue mode to update grub installation like described in the page I mentioned above. After those steps I was able to login to the Fedora 9 and pretty much everything was working. Bluetooth, WLAN, hibernate and also standby in some extent. After second standby attempt Mini woke up, but it was only showing flicking mouse pointer and I had to shutdown the device with power button. I need to check what the problem is in there and also try out the timed wake up, which is very crucial for the VDR use cases.

keskiviikko 21. toukokuuta 2008

Mini arrives

Yesterday I finally received the Mini. There was some problems when sending the package, but the most important thing is that it is here now. I also bought Seagate Momentus 5400.3 160GB 8MB SATA hard drive and Samsung SN-T082L/BEBM DVD+RW DL drive, but they are at my parents so I won't get them until next week.

I installed Boot Camp Beta 1.4 to the Mini which has OS X 10.4 to test if I can use Tiger or do I need to install Leopard. Boot Camp Assistant won't run on Tiger by default anymore because the beta is expired, but as simple trick as changing the system time back to year 2007 enables running the assistant.

Fedora 9 is released so I downloaded the installation DVD, that needs to be burned on DVD and after that next thing to do is to get the drives and install them. Before that I can test things but not actually proceed with the project.

sunnuntai 4. toukokuuta 2008

Hunt for the Mini ends

I finally found a Mini which fit into my budget or in fact it went a little over if shipping costs are included. But it was domestic auction so I'm happy to pay that extra ten euros more. Also I'm getting free tv-out adapter so I can try to sell it to get some money back.

Mini is 1,66GHz Core Duo model with 512MB RAM, 60GB HDD and Combodrive. So I still need to upgrade the optical drive and hard disk in the future. Optical drive will be Samsung's slot-in model SN-T082L, with dard drive there is plenty of options, I think I need to study them a bit before making an order.

What I also need is some extra time so I can start to build up the system.