Re: staging: comedi: USB devs not working / some comedi core reorganization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




hacked cfc_check_trigger_src:
-----------------------------

static inline int cfc_check_trigger_src(unsigned int *src, unsigned int
flags)
{
          unsigned int orig_src = *src;

          *src = orig_src & flags;
          printk("cfc_check_trigger_src: orig_src=%x, *src=%x
\n",orig_src,*src );
          if (*src == TRIG_INVALID || *src != orig_src)
                  return -EINVAL;
          return 0;
}


Any ideas?

I don't know off-hand, but I'll take a look when I get the chance.
This is the first time comedi_command_test is called in generic_timed (in comedilib / userspace). That assumes that the subdevice is initialised, in particular the cmd_mask. Can it be that this sometimes won't happen? The behaviour is pretty random so it might be an uninitialised struct. Return value of generic_timed is -1 just now but had also 1 in the past.

/Bernd

EXPORT_ALIAS_DEFAULT(_comedi_get_cmd_src_mask,comedi_get_cmd_src_mask,0.7.18);
int _comedi_get_cmd_src_mask(comedi_t *it,unsigned int subd,comedi_cmd *cmd)
{
        subdevice *s;
        int ret;

        if(!valid_subd(it,subd))return -1;

        s=it->subdevices+subd;

        if(s->cmd_mask_errno){
                errno = s->cmd_mask_errno;
                return -1;
        }

        if(!s->cmd_mask){
                comedi_cmd *mask;

                mask = malloc(sizeof(comedi_cmd));

                memset(mask,0,sizeof(*cmd));

                mask->subdev = subd;
                mask->flags = 0;
                mask->start_src = TRIG_ANY;
                mask->scan_begin_src = TRIG_ANY;
                mask->convert_src = TRIG_ANY;
                mask->scan_end_src = TRIG_ANY;
                mask->stop_src = TRIG_ANY;

                s->cmd_mask = mask;

                ret = comedi_command_test(it,mask);
                if(ret<0){
                        s->cmd_mask_errno = errno;
                        return -1;
                }


static int __generic_timed(comedi_t *it, unsigned s,
        comedi_cmd *cmd, unsigned chanlist_len, unsigned scan_period_ns)
{
        int ret;
        unsigned convert_period_ns;

        if(chanlist_len < 1) return -EINVAL;
        ret = comedi_get_cmd_src_mask(it,s,cmd);
        if(ret<0)return ret;

        __comedi_errno = ENOTSUPPORTED;

        if(cmd->start_src&TRIG_NOW){
                cmd->start_src=TRIG_NOW;
                cmd->start_arg=0;
        }else if(cmd->start_src&TRIG_INT){
                cmd->start_src=TRIG_INT;
                cmd->start_arg=0;
        }else{
                COMEDILIB_DEBUG(3,"can't find good start_src\n");
                return -1;
        }

convert_period_ns = (scan_period_ns + chanlist_len / 2) / chanlist_len;
        if((cmd->convert_src & TRIG_TIMER) &&
                (cmd->scan_begin_src & TRIG_FOLLOW))
        {
                cmd->convert_src = TRIG_TIMER;
                cmd->convert_arg = convert_period_ns;
                cmd->scan_begin_src = TRIG_FOLLOW;
                cmd->scan_begin_arg = 0;
        }else if((cmd->convert_src & TRIG_NOW) &&
                (cmd->scan_begin_src & TRIG_TIMER))
        {

--
www:    http://www.berndporr.me.uk/
        http://www.linux-usb-daq.co.uk/
	http://www.imdb.com/name/nm3293421/
Mobile: +44 (0)7840 340069
Work:   +44 (0)141 330 5237
        University of Glasgow
        School of Engineering
        Rankine Building, Oakfield Avenue,
        Glasgow, G12 8LT
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux