[pwc] VIDIOCPWCRUSER: Bad file descriptor

Mathieu Bouchard matju at artengine.ca
Thu Sep 20 06:29:34 CEST 2007


On Thu, 20 Sep 2007, oliver wrote:

> in: setpwc_bang
> fd=-1; does not look right to me.

check_device sets fd. the =-1 might be simply a way to avoid an 
"uninitialized variable" warning.

> Maybe you could declare it as a global variable,

this would make it stop trying to reopen the device every time and 
forgetting the filehandle that it doesn't close. however it shouldn't be 
global, because there can be multiple instances of t_setpwc; instead, a 
"int fd;" should be added in t_setpwc (x_obj really has to be the first 
field though, as it represents the superclass). A setpwc_free function 
must also be written and registered in order to close the filehandle at 
the time of destruction of the object.

However, this will prevent the device from being opened by the camera 
input object, as the device can only be opened once at a time. That handle 
cannot be passed around given the way that PureData/GEM are made. If at 
the same time the desired setting resets on each reopen, then this object 
class is rather futile for this task.

Let me know if I understood anything wrong.

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada


More information about the pwc mailing list