January 25, 2008

Using a Logitech QuickCam Pro 3000 with ZoneMinder

Okay, so I got ZoneMinder installed. Now I want to play with it. I recently purchased an XBox 360 webcam for use with my Mac, but I thought that was a little too good for this. However I did have a Logitech QuickCam Pro 3000 lying around. I remember having to download the drivers for this camera under Windows, so it would be fair to say I had low expectations in getting this working under Linux. In fact quite the opposite--it works very well indeed. As soon as I plugged it in it showed in /var/log/messages. There's even a utility that sets the various options of the QuickCam's Philips chipset called http://www.vanheusden.com/setpwc/ written by Folkert van Heusden.

After plugging it in, the first thing I did was try and find out what settings I needed to have in ZoneMinder. After installing setpwc, it was fairly easy to find out what I needed. There is even a setpwc Debian package that can just be installed via apt-get. However for me this version was 1.1 and the latest as of January 2008 is 1.23. The obvious difference between the two is that with the latest version you can set the resolution. However just to find out the settings for ZoneMinder, 1.1 will do.

These are the settings I used initially in ZoneMinder. You can get to this area just by clicking Add New Monitor on the console page of ZoneMinder (i.e. http://yoursever/zm/) and then clicking on the Source tab:

Device Path: /dev/video0
Device Channel: 0
Device Format: AUTO
Capture Palette: YUV420P
Capture Width: 320
Capture Height: 240
Preserve Aspect Ratio: Unchecked
Orientation: Normal

I knew the device was located on /dev/video0 as that's what was reported in /log/var/messages. You'll have to check the correct device path your camera. Once I clicked Save and returned back to the ZM Console page, I clicked on what I named the source, in my case Cam1 and it worked--I saw the image! It seems that if everything went okay, the source field for the respective camera will turn orange, otherwise red.

Okay, my camera supports 640x480. I used the latest version of setpwc to set the resolution and then edited the source settings to set the correct capture height and width, but once I did that the source field for the camera on the ZM console turned red and I wasn't able to see an image. A few more Google searches and reading ZoneMinder's installation instructions correctly, it seems you have to increase the amount of shared memory. This can be done instantly by issuing the following command:

# echo 134217728 >/proc/sys/kernel/shmall && echo 134217728 >/proc/sys/kernel/shmmax

However upon reboot, this will need to be done again so it's best to edit /etc/sysctl.conf to add kernel.shmmax = 134217728. You can quickly do this by issuing:

# echo kernel.shmmax = 134217728 >> /etc/sysctl.conf

That's it. Job done, camera working.

January 24, 2008

Installing ZoneMinder 1.23 under Debian 4.0r2 Etch

ZoneMinder is an open source CCTV application for Linux. A friend of mine first showed it off to me on his Ubuntu system and since having my own dedicated Linux box and a spare webcam lying around, I decided to install it.

The installation requires a basic LAMP installation and a few Perl modules. I have Debian 4.0r2 Etch with already Apache2, MySQL 5 and PHP4 installed. I started with the following guide on ZoneMinder's website: http://www.zoneminder.com/wiki/index.php/Yadig

Installation was easy to follow except when I came to compile and had a couple of issues locating the correct Perl modules. The guide is written for slightly older versions of everything I had installed. Essentially the only module that seems to not be available from Etch's main repositories was PHP::Serialization. After several unsuccessful hunts on Google, I came across the following CPAN site: http://search.cpan.org/~jbrown/PHP-Serialization-0.27/. This is what I wanted, I downloaded, compiled and installed it and was then able to continue the rest of the ZoneMinder installation.

Step-by-Step installation

1. Run apt-get install with with the required packages. I also accepted any recommended packages by apt-get:

# apt-get install apache2 mysql-server libmysqlclient15-dev php4 php4-mysql g++ make netpbm libssl-dev libjpeg62-dev libmime-perl libwww-perl libarchive-tar-perl libdate-manip-perl libarchive-zip-perl libmime-lite-perl libdbi-perl libdbd-mysql-perl libpcre3-dev

2. Download, compile and install the PHP::Serialization module:

# cd /usr/local/src/
# wget
http://search.cpan.org/CPAN/authors/id/J/JB/JBROWN/php-serialization/PHP-Serialization-0.27.tar.gz
# tar -xzvf PHP-Serialization-0.27.tar.gz
# cd PHP-Serialization-0.27
# perl Makefile.PL
# make
# make test
# make install

3. Download, compile and install ZoneMinder:

# cd /usr/local/src/
# wget
http://www2.zoneminder.com/downloads/ZoneMinder-1.23.1.tar.gz
# tar -xzvf ZoneMinder-1.23.1.tar.gz
# cd ZoneMinder-1.23.1
# ./configure --with-webdir=/var/www/zm --with-cgidir=/usr/lib/cgi-bin --with-webuser=www-data --with-webgroup=www-data
# mysql -u root -p < db/zm_create.sql
# mysql -u root -p
mysql> grant select,insert,update,delete on zm.* to
'zmuser'@localhost identified by 'zmpass'; quit;
# make install

4. Create a Debian init.d script as per instructions here and then restart Apache, MySQL and ZoneMinder:

# /etc/init.d/apache2 restart
# /etc/init.d/mysql restart
# /etc/init.d/zm restart

6. Connect to http://yourserver/zm/ and modify the following two parameters:

  • Under Options, System, set ZM_AUTH_RELAY to none.
  • Under Options, Paths, set ZM_PATH_ZMS to /cgi-bin/zms

7. That's it! Just connect your camera and configure!

Update #1: As mentioned on ZoneMinder's Wiki, you should also increase the amount of shared memory, especially if your camera supports 640x480 as it probably won't be possible to use it at higher resolutions until you've done this. If you do have issues getting 640x480, you can instantly test this by issuing the following command and restarting ZoneMinder:

# echo 134217728 >/proc/sys/kernel/shmall && echo 134217728 >/proc/sys/kernel/shmmax

However upon reboot, this will need to be done again so it's best to edit /etc/sysctl.conf to add kernel.shmmax = 134217728. You can quickly do this by issuing:

# echo kernel.shmmax = 134217728 >> /etc/sysctl.conf

January 12, 2008

Resetting the BIOS Password on a HP/Compaq Evo D510

So I finally gave up running Linux on my Playstation 2. The distribution was old and getting things compiled and running proved problematic--especially with MySQL. I was actually looking at buying one of these: http://www.linutop.com/ -- a nice self contained Linux box that uses very little power. However by the time you add postage and import duty, it can turn out to be quite expensive. Anyway I found a guy selling a load of Compaq D510 Ultra Slim desktops on Ebay for around 100 euros. Apparantly they'd only been used for around 20 hours ;-). I clicked Buy it Now and picked up the machine that weekend. I did get a list of passwords however the BIOS password proved incorrect and the seller didn't know the correct one.

Normally it's not a problem cases like this since the advent of the Internet. You'd expect a few keywords like 'compaq', 'd510', 'bios', 'reset' in the Google search bar would do the trick, however it took me slightly longer than expected so I decided to blog it (hopefully saving you some time!).

In a nutshell, locate the jumper labelled PASSWORD JMP on the motherboard (see image--it's between the PSU and the hard disk) and remove it. Power up the machine once without the jumper and then power it down again before replacing the jumper--the BIOS password should now be cleared. Easy.