3:26 PM Čet, 13.02.2020. Filip Bozuta <filip.boz...@rt-rk.com> је написао/ла: > > +int main(int argc, char **argv) > +{ > + char ioctls[15][35] = {"SNDRV_TIMER_IOCTL_PVERSION", > + "SNDRV_TIMER_IOCTL_INFO", > + "SNDRV_TIMER_IOCTL_NEXT_DEVICE", > + "SNDRV_TIMER_IOCTL_PARAMS", > + "SNDRV_TIMER_IOCTL_TREAD", > + "SNDRV_TIMER_IOCTL_STATUS", > + "SNDRV_TIMER_IOCTL_GINFO", > + "SNDRV_TIMER_IOCTL_START", > + "SNDRV_TIMER_IOCTL_GPARAMS", > + "SNDRV_TIMER_IOCTL_STOP", > + "SNDRV_TIMER_IOCTL_GSTATUS", > + "SNDRV_TIMER_IOCTL_CONTINUE", > + "SNDRV_TIMER_IOCTL_SELECT", > + "SNDRV_TIMER_IOCTL_PAUSE"}; > + > + bool (*const funcs[]) (int, bool) = { > + test_pversion, > + test_next_device, > + test_tread, > + test_ginfo, > + test_gparams, > + test_gstatus, > + test_select, > + test_info, > + test_params, > + test_status, > + test_start, > + test_pause, > + test_continue, > + test_stop, > + NULL > + }; > +
Order of these two arrays don't match, and that leads to the wrong choice of test function later on in the code. For example, if one chooses "SNDRV_TIMER_IOCTL_STATUS" in the command line, one will end up testing "SNDRV_TIMER_IOCTL_GSTATUS", if one chooses "SNDRV_TIMER_IOCTL_INFO", one will end up testing "SNDRV_TIMER_IOCTL_NEXT_DEVICE", etc. Nice feature (ability to test just a single ioctl), but it needs to be fixed. Thanks, Aleksandar