On Thu, 2007-09-20 at 03:08 +0200, oliver wrote:
> sorry, me again,

why sorry? i am glad to see responses.

> about the bad file descriptor,
> in :
> 
> setpwc_bang
> 
> fd=-1; does not look right to me.
> 
> Maybe you could declare it as a global variable, and it does not need
> to be a pointer;
> After
> 
> fd = open(device, O_RDWR);
> 
> do not change its  value.
> 
> good luck
>     oliver

yo, thank you a lot for your effort, but i already sorted out the
problem. the object does work perfectly, though it is still not the
solution. the idea was to send the 'VIDIOCPWCRUSER' from within pd, so
that pd/gem can access the camera afterwards with the restored settings.
it turn out, that from the pcw drivers perspective this pd-object
[setpwc] and gem are two different programs, so it's not possible that
one does the 'VIDIOCPWCRUSER' command, whereas the other gets the images
from the cam.

the error was caused, because i tried to send trigger the
'VIDIOCPWCRUSER' while gem was accessing the cam. 

still, the best solution would be, if the pwc driver wouldn't forget
about the automatic gain control setting. noone answered yet, if its
possible to fix that or not. sorry to ask again, but is it?

roman






> Roman Haefeli wrote:
> > hi 
> >
> > i am still trying to find a way to overcome the
> > 'agc-setting-is-reset-each-time-cam-is-accessed' problem. a friend of
> > mine tried to help by writing a pd-object, that does send the 'restore'
> > command to the driver, so that i can at least set the gain manually,
> > when working with pd, just by restoring the nvram of the cam. 
> >
> > however, it doesn't work yet. i am not a c coder myself and thus have no
> > idea to fix it.
> >
> > i get the error:
> >
> > IDIOCPWCRUSER: Bad file descriptor
> >
> > this is the code of pd-object:
> >
> > ########################################################################
> > #include <errno.h>
> > #include <string.h>
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <sys/ioctl.h>
> > #include <sys/types.h>
> > #include <sys/stat.h>
> > #include <fcntl.h>
> > #include <unistd.h>
> > #define _LINUX_TIME_H 1 /* to get things compile on kernel 2.6.x */
> > #include <linux/videodev.h>
> >
> >
> > #include "m_pd.h"
> > #include "pwc-ioctl.h"
> >
> > char *device = "/dev/video1";
> >
> > static t_class *setpwc_class;
> >
> > typedef struct _setpwc {
> >   t_object  x_obj;
> > } t_setpwc;
> >
> > void check_device(int *fd)
> > {
> >         if (*fd == -1)
> >         {
> >                 /* open device */
> >                 *fd = open(device, O_RDWR);
> >                 if (*fd == -1)
> >                 {
> >                         post("Error while accessing device");
> > //                      exit(1);
> >                 }
> >         }
> > }
> >
> > void restore_settings(int fd)
> > {
> >         if (ioctl(fd, VIDIOCPWCRUSER) == -1)
> >                 perror("VIDIOCPWCRUSER");
> > }
> >
> > void setpwc_bang(t_setpwc *x)
> > {
> >         int fd = -1;
> >         check_device(&fd);
> >         restore_settings(fd);
> > }
> >
> > void *setpwc_new(void)
> > {
> >   t_setpwc *x = (t_setpwc *)pd_new(setpwc_class);
> >
> >   return (void *)x;
> > }
> >
> > void setpwc_setup(void) {
> >   setpwc_class = class_new(gensym("setpwc"),
> >         (t_newmethod)setpwc_new,
> >         0, sizeof(t_setpwc),
> >         CLASS_DEFAULT, 0);
> >   class_addbang(setpwc_class, setpwc_bang);
> >
> >
> >
> >
> >
> >
> >             
> > ___________________________________________________________ 
> > Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
> > _______________________________________________
> > pwc mailing list
> > pwc@lists.saillard.org
> > http://lists.saillard.org/mailman/listinfo/pwc
> >
> >   
> 
> 
> _______________________________________________
> pwc mailing list
> pwc@lists.saillard.org
> http://lists.saillard.org/mailman/listinfo/pwc


                
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
_______________________________________________
pwc mailing list
pwc@lists.saillard.org
http://lists.saillard.org/mailman/listinfo/pwc

Reply via email to