exit(0);
}
-int doioctl(struct node *node, unsigned long int request, void *parm, const char *name)
+int doioctl_name(struct node *node, unsigned long int request, void *parm, const char *name)
{
int retval;
int e;
struct v4l2_capability vcap;
__u32 caps;
- if (doioctl(node, VIDIOC_QUERYCAP, &vcap, "VIDIOC_QUERYCAP"))
+ if (doioctl(node, VIDIOC_QUERYCAP, &vcap))
return fail("VIDIOC_QUERYCAP not implemented\n");
if (check_ustring(vcap.driver, sizeof(vcap.driver)))
return fail("invalid driver name\n");
enum v4l2_priority prio;
int err;
- err = doioctl(node, VIDIOC_G_PRIORITY, &prio, "VIDIOC_G_PRIORITY");
+ err = doioctl(node, VIDIOC_G_PRIORITY, &prio);
if (err == EINVAL)
return -ENOSYS;
if (err)
return fail("VIDIOC_G_PRIORITY failed\n");
if (prio != match)
return fail("wrong priority returned (%d, expected %d)\n", prio, match);
- if (doioctl(node2, VIDIOC_G_PRIORITY, &prio, "VIDIOC_G_PRIORITY"))
+ if (doioctl(node2, VIDIOC_G_PRIORITY, &prio))
return fail("second VIDIOC_G_PRIORITY failed\n");
if (prio != match)
return fail("wrong priority returned on second fh (%d, expected %d)\n", prio, match);
return err;
prio = V4L2_PRIORITY_RECORD;
- if (doioctl(node, VIDIOC_S_PRIORITY, &prio, "VIDIOC_S_PRIORITY"))
+ if (doioctl(node, VIDIOC_S_PRIORITY, &prio))
return fail("VIDIOC_S_PRIORITY RECORD failed\n");
if (check_prio(node, node2, V4L2_PRIORITY_RECORD))
return fail("expected priority RECORD");
prio = V4L2_PRIORITY_INTERACTIVE;
- if (!doioctl(node2, VIDIOC_S_PRIORITY, &prio, "VIDIOC_S_PRIORITY"))
+ if (!doioctl(node2, VIDIOC_S_PRIORITY, &prio))
return fail("Can lower prio on second filehandle\n");
prio = V4L2_PRIORITY_INTERACTIVE;
- if (doioctl(node, VIDIOC_S_PRIORITY, &prio, "VIDIOC_S_PRIORITY"))
+ if (doioctl(node, VIDIOC_S_PRIORITY, &prio))
return fail("Could not lower prio\n");
if (check_prio(node, node2, V4L2_PRIORITY_INTERACTIVE))
return fail("expected priority INTERACTIVE");
memset(&chip, 0, sizeof(chip));
chip.match.type = V4L2_CHIP_MATCH_HOST;
chip.match.addr = 0;
- ret = doioctl(node, VIDIOC_DBG_G_CHIP_IDENT, &chip, "VIDIOC_DBG_G_CHIP_IDENT");
+ ret = doioctl(node, VIDIOC_DBG_G_CHIP_IDENT, &chip);
// Must return either 0 (OK) or EINVAL (not supported)
if (ret == 0) {
struct v4l2_dbg_chip_ident orig;
chip.ident = 0xdeadbeef;
chip.revision = 0xdeadbeef;
orig = chip;
- ret = doioctl(node, VIDIOC_DBG_G_CHIP_IDENT, &chip, "VIDIOC_DBG_G_CHIP_IDENT");
+ ret = doioctl(node, VIDIOC_DBG_G_CHIP_IDENT, &chip);
if (ret != EINVAL)
return fail("Invalid match_type accepted\n");
if (memcmp(&orig, &chip, sizeof(chip)))
reg.match.type = V4L2_CHIP_MATCH_HOST;
reg.match.addr = 0;
reg.reg = 0;
- ret = doioctl(node, VIDIOC_DBG_G_REGISTER, ®, "VIDIOC_DBG_G_REGISTER");
+ ret = doioctl(node, VIDIOC_DBG_G_REGISTER, ®);
if (ret == EINVAL)
return -ENOSYS;
if (uid && ret != EPERM)
return fail("Not allowed to call VIDIOC_DBG_G_REGISTER even though we are root\n");
chip.match.type = V4L2_CHIP_MATCH_HOST;
chip.match.addr = 0;
- if (doioctl(node, VIDIOC_DBG_G_CHIP_IDENT, &chip, "VIDIOC_DBG_G_CHIP_IDENT"))
+ if (doioctl(node, VIDIOC_DBG_G_CHIP_IDENT, &chip))
return fail("Must support VIDIOC_DBG_G_CHIP_IDENT\n");
if (uid) {
// Don't test S_REGISTER as root, don't want to risk
// messing with registers in the compliance test.
reg.reg = reg.val = 0;
- ret = doioctl(node, VIDIOC_DBG_S_REGISTER, ®, "VIDIOC_DBG_S_REGISTER");
+ ret = doioctl(node, VIDIOC_DBG_S_REGISTER, ®);
if (ret != EINVAL && ret != EPERM)
return fail("Invalid error calling VIDIOC_DBG_S_REGISTER as non-root\n");
}
int testLogStatus(struct node *node)
{
- int ret = doioctl(node, VIDIOC_LOG_STATUS, NULL, "VIDIOC_LOG_STATUS");
+ int ret = doioctl(node, VIDIOC_LOG_STATUS, NULL);
return (ret == EINVAL) ? -ENOSYS : ret;
}
struct v4l2_audio audio;
int cur_input = MAGIC;
int input;
- int ret = doioctl(node, VIDIOC_G_INPUT, &cur_input, "VIDIOC_G_INPUT");
+ int ret = doioctl(node, VIDIOC_G_INPUT, &cur_input);
int i = 0;
unsigned a;
for (;;) {
memset(&descr, 0xff, sizeof(descr));
descr.index = i;
- ret = doioctl(node, VIDIOC_ENUMINPUT, &descr, "VIDIOC_ENUMINPUT");
+ ret = doioctl(node, VIDIOC_ENUMINPUT, &descr);
if (ret == EINVAL)
break;
if (ret)
return fail("could not enumerate input %d\n", i);
input = i;
- if (doioctl(node, VIDIOC_S_INPUT, &input, "VIDIOC_S_INPUT"))
+ if (doioctl(node, VIDIOC_S_INPUT, &input))
return fail("could not set input to %d\n", i);
if (input != i)
return fail("input set to %d, but becomes %d?!\n", i, input);
for (a = 0; a <= node->audio_inputs; a++) {
memset(&audio, 0, sizeof(audio));
audio.index = a;
- ret = doioctl(node, VIDIOC_S_AUDIO, &audio, "VIDIOC_S_AUDIO");
+ ret = doioctl(node, VIDIOC_S_AUDIO, &audio);
if (ret && (descr.audioset & (1 << a)))
return fail("could not set audio input to %d for video input %d\n", a, i);
if (ret != EINVAL && !(descr.audioset & (1 << a)))
i++;
}
input = i;
- if (doioctl(node, VIDIOC_S_INPUT, &input, "VIDIOC_S_INPUT") != EINVAL)
+ if (doioctl(node, VIDIOC_S_INPUT, &input) != EINVAL)
return fail("could set input to invalid input %d\n", i);
- if (doioctl(node, VIDIOC_S_INPUT, &cur_input, "VIDIOC_S_INPUT"))
+ if (doioctl(node, VIDIOC_S_INPUT, &cur_input))
return fail("couldn't set input to the original input %d\n", cur_input);
return 0;
}
memset(&input, 0xff, sizeof(input));
input.index = i;
- ret = doioctl(node, VIDIOC_ENUMAUDIO, &input, "VIDIOC_ENUMAUDIO");
+ ret = doioctl(node, VIDIOC_ENUMAUDIO, &input);
if (i == 0 && ret == EINVAL)
return -ENOSYS;
if (ret == EINVAL)
memset(input.reserved, 0, sizeof(input.reserved));
input.index = i;
input.mode = 0;
- if (doioctl(node, VIDIOC_S_AUDIO, &input, "VIDIOC_S_AUDIO") != EINVAL)
+ if (doioctl(node, VIDIOC_S_AUDIO, &input) != EINVAL)
return fail("can set invalid audio input\n");
memset(&input, 0xff, sizeof(input));
- ret = doioctl(node, VIDIOC_G_AUDIO, &input, "VIDIOC_G_AUDIO");
+ ret = doioctl(node, VIDIOC_G_AUDIO, &input);
if (i == 0) {
if (ret != EINVAL)
return fail("can get current audio input, but no inputs enumerated\n");
struct v4l2_audioout audio;
int cur_output = MAGIC;
int output;
- int ret = doioctl(node, VIDIOC_G_OUTPUT, &cur_output, "VIDIOC_G_OUTPUT");
+ int ret = doioctl(node, VIDIOC_G_OUTPUT, &cur_output);
int o = 0;
unsigned a;
for (;;) {
memset(&descr, 0xff, sizeof(descr));
descr.index = o;
- ret = doioctl(node, VIDIOC_ENUMOUTPUT, &descr, "VIDIOC_ENUMOUTPUT");
+ ret = doioctl(node, VIDIOC_ENUMOUTPUT, &descr);
if (ret)
break;
output = o;
- if (doioctl(node, VIDIOC_S_OUTPUT, &output, "VIDIOC_S_OUTPUT"))
+ if (doioctl(node, VIDIOC_S_OUTPUT, &output))
return fail("could not set output to %d\n", o);
if (output != o)
return fail("output set to %d, but becomes %d?!\n", o, output);
for (a = 0; a <= node->audio_outputs; a++) {
memset(&audio, 0, sizeof(audio));
audio.index = a;
- ret = doioctl(node, VIDIOC_S_AUDOUT, &audio, "VIDIOC_S_AUDOUT");
+ ret = doioctl(node, VIDIOC_S_AUDOUT, &audio);
if (ret && (descr.audioset & (1 << a)))
return fail("could not set audio output to %d for video output %d\n", a, o);
if (ret != EINVAL && !(descr.audioset & (1 << a)))
o++;
}
output = o;
- if (doioctl(node, VIDIOC_S_OUTPUT, &output, "VIDIOC_S_OUTPUT") != EINVAL)
+ if (doioctl(node, VIDIOC_S_OUTPUT, &output) != EINVAL)
return fail("could set output to invalid output %d\n", o);
- if (doioctl(node, VIDIOC_S_OUTPUT, &cur_output, "VIDIOC_S_OUTPUT"))
+ if (doioctl(node, VIDIOC_S_OUTPUT, &cur_output))
return fail("couldn't set output to the original output %d\n", cur_output);
return 0;
}
memset(&output, 0xff, sizeof(output));
output.index = o;
- ret = doioctl(node, VIDIOC_ENUMAUDOUT, &output, "VIDIOC_ENUMAUDOUT");
+ ret = doioctl(node, VIDIOC_ENUMAUDOUT, &output);
if (o == 0 && ret == EINVAL)
return -ENOSYS;
if (ret == EINVAL)
memset(output.reserved, 0, sizeof(output.reserved));
output.index = o;
output.mode = 0;
- if (doioctl(node, VIDIOC_S_AUDOUT, &output, "VIDIOC_S_AUDOUT") != EINVAL)
+ if (doioctl(node, VIDIOC_S_AUDOUT, &output) != EINVAL)
return fail("can set invalid audio output\n");
memset(&output, 0xff, sizeof(output));
- ret = doioctl(node, VIDIOC_G_AUDOUT, &output, "VIDIOC_G_AUDOUT");
+ ret = doioctl(node, VIDIOC_G_AUDOUT, &output);
if (o == 0) {
if (ret != EINVAL)
return fail("can get current audio output, but no outputs enumerated\n");