I just added an old webcam on my slug and wanted to share in here. First of all if you want to add webcam to your system go ahead and upgrade your system as explained in the previous post.
Anyway, I upgraded my system and plugged in the webcam to one of the empty slots. Surprisingly the green webcam light was on which means it if successfully loaded. I checked lsusb
Bus 002 Device 003: ID 0ac8:301b Z-Star Microelectronics Corp. ZC0301 WebCam
then video port by typing ls /dev/video* and I had /dev/video0 in there. But when I tried to get some pictures it failed...
It was automatically loading zc0301 module (check with lsmod) but I soon realized that this module bad. I had to prevent that module loading. To do so,
nano /etc/modprobe.d/blacklist
and add
blacklist zc0301
We need another module at this point, gspca.To load this module debian has an easy and beatiful application module-assistant. Go ahead and install it
apt-get install module-assistant
then to install gspca module
m-a auto-install gspca
That is it. Your webcam should be ready now. To test
apt-get install streamer
then
streamer -t 10 -r 2 -o foobar00.jpeg
should capture ten frames, two per second.
To setup a system that captures images and put them to your webserver you can use webcam software. To install write
apt-get install webcam
After that you should put your config file to /root/.webcamrc.
nano /root/.webcamrc
paste the lines below
[grab]
device = /dev/video0
text = "NSLU2 webcam %Y-%m-%d %H:%M:%S (EST)"
# infofile =
fg_red = 255
fg_green = 255
fg_blue = 255
width = 640
height = 480
# delay = number of seconds between snapshots
delay = 30
wait = 1
input = ZC301-2
# norm = webcam
rotate = 0
top = 0
left = 0
bottom = -1
right = -1
quality = 100
trigger = 0
once = 0
# archive =
[ftp]
host = 127.0.0.1
user = root
pass = xxxx
dir = /var/www/webcam
file = webcam.jpeg
tmp = uploading.jpeg
passive = 1
debug = 0
auto = 0
# local = 1 means just use the local directory specified above, do not use ftp or ssh
local = 1
ssh = 0
now if you type
webcam
it should start capturing images and put them to the folder you specified. There is something to mention though
input = ZC301-2
this line is catchy. I guess it differs at different webcams. To learn the correct input name of your device first install v4l-conf
apt-get install v4l-conf
Then,
v4l-info | grep name
should give you the correct name. In my case I got
ioctl VIDIOCGTUNER: Invalid argument
ioctl VIDIOCGAUDIO: Invalid argument
name : "Z-star Vimicro zc0301p"
name : "ZC301-2"
and I used ZC301-2 as the input.Try and see what is yours.
After the setup if you want it to work automatically after restart you can set up a crontab:
crontab -e
@reboot /usr/bin/webcam
I hope this helps someone...
