webcam.cgi not found

max
Hello,

With the original install of my mini2440 Qtopia, I've got http server with
3 pages. The chinese pages USB camera not working, in the page code source
I found a HTML form using webcam.cgi but this file are not present.
Where I can found it? It is present in other compilation ? 

Thanks

Vladimir Fonov
Hello,

I've never found it, but if you want to play with built-in cam you can try
http://code.google.com/p/mjpg-streamer-mini2440/

puma
Hello Vladimir,

I Just would like to know if the built-in cam will also work on kernel
2.6.29.4? Which kernel version have you tried it?

Thanks,
Puma

screwface
Maybe this webcam.cgi script can be found in the Qtopia image from an old
DVD version. The oldest one I have found on arm9 website is
ed2k://|file|mini2440-20090220.iso|2698563584|BD3CD6411CA9666A9DF4B04CD7...

Maybe it is possible to find older ones

Vladimir Fonov
Hello,

>I Just would like to know if the built-in cam will also work on kernel
2.6.29.4? Which kernel version have you tried it?

version r6 will work with standard camera driver, so either 2.6.29.4 or
2.6.32.2 is fine.

max
I try mjpg-streamer-mini2440 but It don't work with my webcam 0ac8:307b

with command line :
./mjpg_streamer -o "output_http.so -w ./www" -i "input_gspcav1.so -d
/dev/video0 -r QVGA -f r32"

and the result:
MJPG Streamer Version.: 2.0
 i: Using V4L1 device.: /dev/video0
 i: Desired Resolution: 320 x 240
video /dev/video0
Camera found: PC Camera
VIDIOCGPICT brightnes=0 hue=0 color=0 contrast=32768 whiteness=26214depth=8
palette=0
Bridge found: zc3xx
Not an Spca5xx Camera !!
wrong spca5xx device
StreamId: -1  Camera
try palette 21 depth 8
Damned second try fail
try palette 15 depth 12
Damned second try fail
try palette 4 depth 24
Damned second try fail
try palette 3 depth 16
Damned second try fail
try palette 5 depth 32
Damned second try fail
probe size in
Available Resolutions width 640  heigth 480
Available Resolutions width 384  heigth 288
Available Resolutions width 352  heigth 288
Available Resolutions width 320  heigth 240
Available Resolutions width 192  heigth 144
Available Resolutions width 176  heigth 144
Available Resolutions width 160  heigth 120
Invalid palette in check palette fatal !!
 Format asked 5 check -1
VIDIOCSPICT brightnes=0 hue=0 color=0 contrast=32768
whiteness=26214depth=32 palette=5
VIDIOCGPICT brightnes=0 hue=0 color=0 contrast=32768 whiteness=26214depth=8
palette=0
could't set video palette Abort !

An emule running but they are not many people who have
mini2440-20090220.iso !!!

max
Finaly I build my own software and it's work :

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/types.h>
#include <linux/videodev.h>

#define VIDEO_DEV "/dev/video0"

int main(int argc, char** argv)
{
  int fdv;
  /* open the video4linux device */
  fdv = open ( VIDEO_DEV, O_RDWR );
  
  if( fdv < 0 )
  {
    perror(VIDEO_DEV);
    return -1;
  }
  
  struct video_capability vcap;
  
  if (ioctl (fdv, VIDIOCGCAP, &vcap) < 0) {
    perror ("VIDIOCGCAP");
    exit (1);
  }
  
  printf ("Video Capture Device Name : %s\n", vcap.name);

  printf("type %x, channels=%d, audios=%d, maxwidth=%d, maxheight=%d,
minwidth=%d, minheight=%d\n",
    vcap.type, vcap.channels, vcap.audios, vcap.maxwidth, vcap.maxheight,
vcap.minwidth, vcap.minheight );
    
  struct video_channel vc;
  vc.channel = 0;
  vc.norm = -1;
  
  
  if(ioctl (fdv, VIDIOCGCHAN, &vc) < 0) {
    perror ("VIDIOCGCHAN");
    exit (1);
  }
  
  printf ("Video Channel Name %d: %s\n", vc.channel, vc.name);    
  printf ("tuners=%d,flags=%x,type=%x,norm=%x\n", vc.tuners, vc.flags,
vc.type, vc.norm);  
  
  //JPGH
  vc.channel = 0;
  vc.norm = -1; //NORM_DEFAULT
  //vc.norm = VIDEO_MODE_PAL;
  if (ioctl(fdv, VIDIOCSCHAN, &vc) < 0){
    perror ("VIDIOCSCHAN");
    exit (1);
  }  
  
  const int width = 640 ;
  const int height = 480 ;
  
  struct video_mbuf vid_buf;
  if (ioctl (fdv, VIDIOCGMBUF, &vid_buf) < 0 ) {
    perror ("VIDIOCGMBUF");
    exit (1);  
  }
  
  printf("vid_buf.size=%d\n",vid_buf.size);
  
  struct video_picture vid_pic;
  if (ioctl (fdv, VIDIOCGPICT, &vid_pic) < 0) {
    perror ("VIDIOCGPICT");
    return -1;
  }  
  //La camera nous renvoye 0 comme palette ce qui  n'existe pas !
  printf("vid_pic.palette =%d\n", vid_pic.palette );

  char* map = mmap (0, vid_buf.size,
PROT_READ|PROT_WRITE,MAP_SHARED,fdv,0);
  if ((unsigned char *)-1 == (unsigned char *)map) {
    perror ("mmap()");
    return 1 ;
  }

  struct video_mmap vid_mmap;
  vid_mmap.format = 0 ; //Ici on laisse la palette a 0
  vid_mmap.frame = 0;
  vid_mmap.width = width;
  vid_mmap.height = height;
  
  if (ioctl (fdv, VIDIOCMCAPTURE, &vid_mmap) < 0 ) {
    perror ("VIDIOCMCAPTURE");
    fprintf (stderr, "args: width=%d height=%d palette=%d\n",
          vid_mmap.width, vid_mmap.height, vid_mmap.format);    
    return 1 ;
  }
  
  if (ioctl (fdv, VIDIOCSYNC, &vid_mmap.frame) < 0 ) {
    perror ("VIDIOCSYNC");
    return 1 ;
  }
  
  printf("Content-Type: image/jpeg\r\n\r\n");
  fwrite( map, vid_buf.size, 1, stdout );
  /*
  FILE *fout = fopen( "out.jpg", "w" );
  fwrite( map, vid_buf.size, 1, fout );
  fclose( fout );
  */
  
  printf("Ok\n");
}