FACT++  1.0
int MVideo::Ioctl ( int  req,
void *  opt,
bool  allowirq = true,
bool  force = false 
) const
private

Definition at line 108 of file MVideo.cc.

References fFileDesc, fPath, and gLog.

Referenced by CaptureStart(), CaptureWait(), Enumerate(), EnumerateControls(), GetCapabilities(), GetProperties(), GetTunerAbilities(), GetVideoStandard(), Init(), ReadControl(), SetChannel(), Start(), and WriteControl().

109 {
110  if (fFileDesc<0)
111  {
112  gLog << err << "ERROR - Ioctl: Device " << fPath << " not open." << endl;
113  return -1;
114  }
115 
116  while (1)
117  {
118  // FIXME: This call is a possible source for a hangup
119  const int rc = ioctl(fFileDesc, req, opt);
120  if (rc==0)
121  return 0;
122 
123  if (errno==EINVAL)
124  return 1;
125 
126  if (!allowirq && errno==EAGAIN)
127  return -4;
128 
129  cout <<"errno="<< errno << endl;
130 
131  // errno== 4: Interrupted system call (e.g. by alarm())
132  // errno==16: Device or resource busy
133  if (errno==4 || errno==16)
134  {
135  if (!allowirq && errno==4)
136  return -4;
137 
138  gLog << err << "ERROR - MVideo::Ioctl 0x" << hex << req << ": errno=" << dec << errno << " - ";
139  gLog << strerror(errno) << " (rc=" << rc << ")" << endl;
140  usleep(10);
141  continue;
142  }
143 
144  if (!force)
145  {
146  gLog << err << "ERROR - MVideo::Ioctl 0x" << hex << req << ": errno=" << dec << errno << " - ";
147  gLog << strerror(errno) << " (rc=" << rc << ")" << endl;
148  }
149  return rc;
150  }
151  return -1;
152 }
int fFileDesc
Definition: MVideo.h:54
TString fPath
Definition: MVideo.h:52
#define gLog
Definition: fits.h:36

+ Here is the caller graph for this function: