ioctl_open.cpp
Go to the documentation of this file.
00001 /*
00002  * ioctl_open.cpp
00003  *
00004  *  Created on: Dec 27, 2010
00005  *      Author: petrito1
00006  */
00007 
00008 #include <stdlib.h>
00009 #include <stdio.h>
00010 #include <fcntl.h>
00011 
00012 #include <sys/ioctl.h>
00013 #include <sys/types.h>
00014 #include <sys/stat.h>
00015 
00016 // Could not find VIDEO1394_IOC_UNLISTEN_CHANNEL definition anywhere...
00017 //#include <ieee1394/video1394.h>
00018 //#include <linux/firewire-cdev.h>
00019 // Using inline definition from http://lxr.free-electrons.com/source/drivers/ieee1394/ieee1394-ioctl.h#L47
00020 #define VIDEO1394_IOC_UNLISTEN_CHANNEL _IOW('#', 0x11, int)
00021 
00022 int main(int argc, char **argv) {
00023 
00024   if (argc < 3) {
00025     printf("Not enough arguments.\n");
00026     printf("Usage: ioctl_open <device> <channel>\n");
00027     printf(" device - the video1394 character device driver (by default \"/dev/video1394/0\" if your host card is port 0)\n");
00028     printf(" channel - the IEEE 1394 ISO channel previously allocated to the camera (usually numbered from 0 on each host)\n");
00029     printf("Example: ioctl_open /dev/video1394/0 0\n");
00030     return -1;
00031   }
00032 
00033   char* device = argv[1];
00034   int channel = atoi(argv[2]);
00035   printf("Calling ioctl(open(%s, O_RDONLY), VIDEO1394_IOC_UNLISTEN_CHANNEL, %d)...\n", device, channel);
00036 
00037   ioctl(open(device, O_RDONLY), VIDEO1394_IOC_UNLISTEN_CHANNEL, channel);
00038 }
00039 
 All Classes Namespaces Files Functions Variables Typedefs Defines


omnicamera
Author(s): Tomas Petricek / petrito1@cmp.felk.cvut.cz
autogenerated on Tue Dec 10 2013 14:26:53