LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-14-2007, 08:11 AM   #1
abk4523
Member
 
Registered: Jun 2004
Distribution: RH8/Fedora Core 4
Posts: 139

Rep: Reputation: 15
Unable to query video device


Noobie here, bare with me. I am trying to write a capture program for my Logitech QuickCommunicate STX webcam and running into difficulties. I am able to open /dev/video with no problems, but when I query the device to fill the capabilities table, the function fails. I am not using a capture card if it helps. Here is my source so far:

[\code]



#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

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

struct video_capability capability;

int video_fd;
char *file_device = "/dev/video";
char ch;

int main()
{
if (video_fd = (open(file_device, O_RDONLY)) == 0)
{
printf("\nUnable to open device %s\n",file_device);
}

else
{
printf("\nSucess opening device %s\n", file_device);
}

if ((ioctl(video_fd, VIDIOC_QUERYCAP, &capability)) != -1)
{
printf("\nSucess querying device.\n");
}
else
{
printf("\nUnable to query device.\n");
}

while (1)
{
printf("\nReading device %s\n", file_device);
if ((ch = getc(stdin)) == 'x')
break;
else
continue;
}
video_fd = close(file_device);
return (0);

}

[\code]

Can the camera be considered a capture device, or am I coding something wrong? Thanks in advance.
 
Old 01-15-2007, 09:12 AM   #2
abk4523
Member
 
Registered: Jun 2004
Distribution: RH8/Fedora Core 4
Posts: 139

Original Poster
Rep: Reputation: 15
Mystery solved. Not happy. :-<
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to unmount USB device gsathya MEPIS 3 07-27-2006 12:07 AM
Media query : Video Capture cards tireseas Slackware 8 11-02-2004 01:06 PM
unable to mount device latuzim Linux - General 8 10-23-2004 07:03 PM
Unable to open Video device - creative web cam pugsley Linux - Hardware 1 07-05-2004 10:06 PM
Volume control is unable to run correctly. Unable to open audio device '/dev/mixer'. sevenreams Slackware 1 05-16-2003 07:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration