aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-06-09 11:54:02 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-06 16:19:20 -0400
commitefbceecd4522a41b8442c6b4f68b4508d57d1ccf (patch)
tree836f47cbb552abfe2a40dbe8b3511ec130652d52 /drivers
parenteb3728edf156c094385dc662d208ab95a305d20a (diff)
[media] v4l2-ioctl.c: use the new table for control ioctls
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/v4l2-ioctl.c395
1 files changed, 198 insertions, 197 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 1f75a6c127ee..798ee42d4e1a 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -512,6 +512,49 @@ static void v4l_print_streamparm(const void *arg, bool write_only)
512 } 512 }
513} 513}
514 514
515static void v4l_print_queryctrl(const void *arg, bool write_only)
516{
517 const struct v4l2_queryctrl *p = arg;
518
519 pr_cont("id=0x%x, type=%d, name=%s, min/max=%d/%d, "
520 "step=%d, default=%d, flags=0x%08x\n",
521 p->id, p->type, p->name,
522 p->minimum, p->maximum,
523 p->step, p->default_value, p->flags);
524}
525
526static void v4l_print_querymenu(const void *arg, bool write_only)
527{
528 const struct v4l2_querymenu *p = arg;
529
530 pr_cont("id=0x%x, index=%d\n", p->id, p->index);
531}
532
533static void v4l_print_control(const void *arg, bool write_only)
534{
535 const struct v4l2_control *p = arg;
536
537 pr_cont("id=0x%x, value=%d\n", p->id, p->value);
538}
539
540static void v4l_print_ext_controls(const void *arg, bool write_only)
541{
542 const struct v4l2_ext_controls *p = arg;
543 int i;
544
545 pr_cont("class=0x%x, count=%d, error_idx=%d",
546 p->ctrl_class, p->count, p->error_idx);
547 for (i = 0; i < p->count; i++) {
548 if (p->controls[i].size)
549 pr_cont(", id/val=0x%x/0x%x",
550 p->controls[i].id, p->controls[i].value);
551 else
552 pr_cont(", id/size=0x%x/%u",
553 p->controls[i].id, p->controls[i].size);
554 }
555 pr_cont("\n");
556}
557
515static void v4l_print_u32(const void *arg, bool write_only) 558static void v4l_print_u32(const void *arg, bool write_only)
516{ 559{
517 pr_cont("value=%u\n", *(const u32 *)arg); 560 pr_cont("value=%u\n", *(const u32 *)arg);
@@ -552,27 +595,7 @@ static void dbgtimings(struct video_device *vfd,
552 } 595 }
553} 596}
554 597
555static inline void v4l_print_ext_ctrls(unsigned int cmd, 598static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv)
556 struct video_device *vfd, struct v4l2_ext_controls *c, int show_vals)
557{
558 __u32 i;
559
560 if (!(vfd->debug & V4L2_DEBUG_IOCTL_ARG))
561 return;
562 dbgarg(cmd, "");
563 printk(KERN_CONT "class=0x%x", c->ctrl_class);
564 for (i = 0; i < c->count; i++) {
565 if (show_vals && !c->controls[i].size)
566 printk(KERN_CONT " id/val=0x%x/0x%x",
567 c->controls[i].id, c->controls[i].value);
568 else
569 printk(KERN_CONT " id=0x%x,size=%u",
570 c->controls[i].id, c->controls[i].size);
571 }
572 printk(KERN_CONT "\n");
573};
574
575static inline int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv)
576{ 599{
577 __u32 i; 600 __u32 i;
578 601
@@ -1213,6 +1236,153 @@ static int v4l_s_parm(const struct v4l2_ioctl_ops *ops,
1213 return ret ? ret : ops->vidioc_s_parm(file, fh, p); 1236 return ret ? ret : ops->vidioc_s_parm(file, fh, p);
1214} 1237}
1215 1238
1239static int v4l_queryctrl(const struct v4l2_ioctl_ops *ops,
1240 struct file *file, void *fh, void *arg)
1241{
1242 struct video_device *vfd = video_devdata(file);
1243 struct v4l2_queryctrl *p = arg;
1244 struct v4l2_fh *vfh = fh;
1245
1246 if (vfh && vfh->ctrl_handler)
1247 return v4l2_queryctrl(vfh->ctrl_handler, p);
1248 if (vfd->ctrl_handler)
1249 return v4l2_queryctrl(vfd->ctrl_handler, p);
1250 if (ops->vidioc_queryctrl)
1251 return ops->vidioc_queryctrl(file, fh, p);
1252 return -ENOTTY;
1253}
1254
1255static int v4l_querymenu(const struct v4l2_ioctl_ops *ops,
1256 struct file *file, void *fh, void *arg)
1257{
1258 struct video_device *vfd = video_devdata(file);
1259 struct v4l2_querymenu *p = arg;
1260 struct v4l2_fh *vfh = fh;
1261
1262 if (vfh && vfh->ctrl_handler)
1263 return v4l2_querymenu(vfh->ctrl_handler, p);
1264 if (vfd->ctrl_handler)
1265 return v4l2_querymenu(vfd->ctrl_handler, p);
1266 if (ops->vidioc_querymenu)
1267 return ops->vidioc_querymenu(file, fh, p);
1268 return -ENOTTY;
1269}
1270
1271static int v4l_g_ctrl(const struct v4l2_ioctl_ops *ops,
1272 struct file *file, void *fh, void *arg)
1273{
1274 struct video_device *vfd = video_devdata(file);
1275 struct v4l2_control *p = arg;
1276 struct v4l2_fh *vfh = fh;
1277 struct v4l2_ext_controls ctrls;
1278 struct v4l2_ext_control ctrl;
1279
1280 if (vfh && vfh->ctrl_handler)
1281 return v4l2_g_ctrl(vfh->ctrl_handler, p);
1282 if (vfd->ctrl_handler)
1283 return v4l2_g_ctrl(vfd->ctrl_handler, p);
1284 if (ops->vidioc_g_ctrl)
1285 return ops->vidioc_g_ctrl(file, fh, p);
1286 if (ops->vidioc_g_ext_ctrls == NULL)
1287 return -ENOTTY;
1288
1289 ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id);
1290 ctrls.count = 1;
1291 ctrls.controls = &ctrl;
1292 ctrl.id = p->id;
1293 ctrl.value = p->value;
1294 if (check_ext_ctrls(&ctrls, 1)) {
1295 int ret = ops->vidioc_g_ext_ctrls(file, fh, &ctrls);
1296
1297 if (ret == 0)
1298 p->value = ctrl.value;
1299 return ret;
1300 }
1301 return -EINVAL;
1302}
1303
1304static int v4l_s_ctrl(const struct v4l2_ioctl_ops *ops,
1305 struct file *file, void *fh, void *arg)
1306{
1307 struct video_device *vfd = video_devdata(file);
1308 struct v4l2_control *p = arg;
1309 struct v4l2_fh *vfh = fh;
1310 struct v4l2_ext_controls ctrls;
1311 struct v4l2_ext_control ctrl;
1312
1313 if (vfh && vfh->ctrl_handler)
1314 return v4l2_s_ctrl(vfh, vfh->ctrl_handler, p);
1315 if (vfd->ctrl_handler)
1316 return v4l2_s_ctrl(NULL, vfd->ctrl_handler, p);
1317 if (ops->vidioc_s_ctrl)
1318 return ops->vidioc_s_ctrl(file, fh, p);
1319 if (ops->vidioc_s_ext_ctrls == NULL)
1320 return -ENOTTY;
1321
1322 ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id);
1323 ctrls.count = 1;
1324 ctrls.controls = &ctrl;
1325 ctrl.id = p->id;
1326 ctrl.value = p->value;
1327 if (check_ext_ctrls(&ctrls, 1))
1328 return ops->vidioc_s_ext_ctrls(file, fh, &ctrls);
1329 return -EINVAL;
1330}
1331
1332static int v4l_g_ext_ctrls(const struct v4l2_ioctl_ops *ops,
1333 struct file *file, void *fh, void *arg)
1334{
1335 struct video_device *vfd = video_devdata(file);
1336 struct v4l2_ext_controls *p = arg;
1337 struct v4l2_fh *vfh = fh;
1338
1339 p->error_idx = p->count;
1340 if (vfh && vfh->ctrl_handler)
1341 return v4l2_g_ext_ctrls(vfh->ctrl_handler, p);
1342 if (vfd->ctrl_handler)
1343 return v4l2_g_ext_ctrls(vfd->ctrl_handler, p);
1344 if (ops->vidioc_g_ext_ctrls == NULL)
1345 return -ENOTTY;
1346 return check_ext_ctrls(p, 0) ? ops->vidioc_g_ext_ctrls(file, fh, p) :
1347 -EINVAL;
1348}
1349
1350static int v4l_s_ext_ctrls(const struct v4l2_ioctl_ops *ops,
1351 struct file *file, void *fh, void *arg)
1352{
1353 struct video_device *vfd = video_devdata(file);
1354 struct v4l2_ext_controls *p = arg;
1355 struct v4l2_fh *vfh = fh;
1356
1357 p->error_idx = p->count;
1358 if (vfh && vfh->ctrl_handler)
1359 return v4l2_s_ext_ctrls(vfh, vfh->ctrl_handler, p);
1360 if (vfd->ctrl_handler)
1361 return v4l2_s_ext_ctrls(NULL, vfd->ctrl_handler, p);
1362 if (ops->vidioc_s_ext_ctrls == NULL)
1363 return -ENOTTY;
1364 return check_ext_ctrls(p, 0) ? ops->vidioc_s_ext_ctrls(file, fh, p) :
1365 -EINVAL;
1366}
1367
1368static int v4l_try_ext_ctrls(const struct v4l2_ioctl_ops *ops,
1369 struct file *file, void *fh, void *arg)
1370{
1371 struct video_device *vfd = video_devdata(file);
1372 struct v4l2_ext_controls *p = arg;
1373 struct v4l2_fh *vfh = fh;
1374
1375 p->error_idx = p->count;
1376 if (vfh && vfh->ctrl_handler)
1377 return v4l2_try_ext_ctrls(vfh->ctrl_handler, p);
1378 if (vfd->ctrl_handler)
1379 return v4l2_try_ext_ctrls(vfd->ctrl_handler, p);
1380 if (ops->vidioc_try_ext_ctrls == NULL)
1381 return -ENOTTY;
1382 return check_ext_ctrls(p, 0) ? ops->vidioc_try_ext_ctrls(file, fh, p) :
1383 -EINVAL;
1384}
1385
1216struct v4l2_ioctl_info { 1386struct v4l2_ioctl_info {
1217 unsigned int ioctl; 1387 unsigned int ioctl;
1218 u32 flags; 1388 u32 flags;
@@ -1283,14 +1453,14 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
1283 IOCTL_INFO_FNC(VIDIOC_S_STD, v4l_s_std, v4l_print_std, INFO_FL_PRIO), 1453 IOCTL_INFO_FNC(VIDIOC_S_STD, v4l_s_std, v4l_print_std, INFO_FL_PRIO),
1284 IOCTL_INFO_FNC(VIDIOC_ENUMSTD, v4l_enumstd, v4l_print_standard, INFO_FL_CLEAR(v4l2_standard, index)), 1454 IOCTL_INFO_FNC(VIDIOC_ENUMSTD, v4l_enumstd, v4l_print_standard, INFO_FL_CLEAR(v4l2_standard, index)),
1285 IOCTL_INFO_FNC(VIDIOC_ENUMINPUT, v4l_enuminput, v4l_print_enuminput, INFO_FL_CLEAR(v4l2_input, index)), 1455 IOCTL_INFO_FNC(VIDIOC_ENUMINPUT, v4l_enuminput, v4l_print_enuminput, INFO_FL_CLEAR(v4l2_input, index)),
1286 IOCTL_INFO(VIDIOC_G_CTRL, INFO_FL_CTRL), 1456 IOCTL_INFO_FNC(VIDIOC_G_CTRL, v4l_g_ctrl, v4l_print_control, INFO_FL_CTRL | INFO_FL_CLEAR(v4l2_control, id)),
1287 IOCTL_INFO(VIDIOC_S_CTRL, INFO_FL_PRIO | INFO_FL_CTRL), 1457 IOCTL_INFO_FNC(VIDIOC_S_CTRL, v4l_s_ctrl, v4l_print_control, INFO_FL_PRIO | INFO_FL_CTRL),
1288 IOCTL_INFO_FNC(VIDIOC_G_TUNER, v4l_g_tuner, v4l_print_tuner, INFO_FL_CLEAR(v4l2_tuner, index)), 1458 IOCTL_INFO_FNC(VIDIOC_G_TUNER, v4l_g_tuner, v4l_print_tuner, INFO_FL_CLEAR(v4l2_tuner, index)),
1289 IOCTL_INFO_FNC(VIDIOC_S_TUNER, v4l_s_tuner, v4l_print_tuner, INFO_FL_PRIO), 1459 IOCTL_INFO_FNC(VIDIOC_S_TUNER, v4l_s_tuner, v4l_print_tuner, INFO_FL_PRIO),
1290 IOCTL_INFO_STD(VIDIOC_G_AUDIO, vidioc_g_audio, v4l_print_audio, 0), 1460 IOCTL_INFO_STD(VIDIOC_G_AUDIO, vidioc_g_audio, v4l_print_audio, 0),
1291 IOCTL_INFO_STD(VIDIOC_S_AUDIO, vidioc_s_audio, v4l_print_audio, INFO_FL_PRIO), 1461 IOCTL_INFO_STD(VIDIOC_S_AUDIO, vidioc_s_audio, v4l_print_audio, INFO_FL_PRIO),
1292 IOCTL_INFO(VIDIOC_QUERYCTRL, INFO_FL_CTRL | INFO_FL_CLEAR(v4l2_queryctrl, id)), 1462 IOCTL_INFO_FNC(VIDIOC_QUERYCTRL, v4l_queryctrl, v4l_print_queryctrl, INFO_FL_CTRL | INFO_FL_CLEAR(v4l2_queryctrl, id)),
1293 IOCTL_INFO(VIDIOC_QUERYMENU, INFO_FL_CTRL | INFO_FL_CLEAR(v4l2_querymenu, index)), 1463 IOCTL_INFO_FNC(VIDIOC_QUERYMENU, v4l_querymenu, v4l_print_querymenu, INFO_FL_CTRL | INFO_FL_CLEAR(v4l2_querymenu, index)),
1294 IOCTL_INFO_STD(VIDIOC_G_INPUT, vidioc_g_input, v4l_print_u32, 0), 1464 IOCTL_INFO_STD(VIDIOC_G_INPUT, vidioc_g_input, v4l_print_u32, 0),
1295 IOCTL_INFO_FNC(VIDIOC_S_INPUT, v4l_s_input, v4l_print_u32, INFO_FL_PRIO), 1465 IOCTL_INFO_FNC(VIDIOC_S_INPUT, v4l_s_input, v4l_print_u32, INFO_FL_PRIO),
1296 IOCTL_INFO_STD(VIDIOC_G_OUTPUT, vidioc_g_output, v4l_print_u32, 0), 1466 IOCTL_INFO_STD(VIDIOC_G_OUTPUT, vidioc_g_output, v4l_print_u32, 0),
@@ -1317,9 +1487,9 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
1317 IOCTL_INFO_FNC(VIDIOC_S_PRIORITY, v4l_s_priority, v4l_print_u32, INFO_FL_PRIO), 1487 IOCTL_INFO_FNC(VIDIOC_S_PRIORITY, v4l_s_priority, v4l_print_u32, INFO_FL_PRIO),
1318 IOCTL_INFO(VIDIOC_G_SLICED_VBI_CAP, INFO_FL_CLEAR(v4l2_sliced_vbi_cap, type)), 1488 IOCTL_INFO(VIDIOC_G_SLICED_VBI_CAP, INFO_FL_CLEAR(v4l2_sliced_vbi_cap, type)),
1319 IOCTL_INFO(VIDIOC_LOG_STATUS, 0), 1489 IOCTL_INFO(VIDIOC_LOG_STATUS, 0),
1320 IOCTL_INFO(VIDIOC_G_EXT_CTRLS, INFO_FL_CTRL), 1490 IOCTL_INFO_FNC(VIDIOC_G_EXT_CTRLS, v4l_g_ext_ctrls, v4l_print_ext_controls, INFO_FL_CTRL),
1321 IOCTL_INFO(VIDIOC_S_EXT_CTRLS, INFO_FL_PRIO | INFO_FL_CTRL), 1491 IOCTL_INFO_FNC(VIDIOC_S_EXT_CTRLS, v4l_s_ext_ctrls, v4l_print_ext_controls, INFO_FL_PRIO | INFO_FL_CTRL),
1322 IOCTL_INFO(VIDIOC_TRY_EXT_CTRLS, 0), 1492 IOCTL_INFO_FNC(VIDIOC_TRY_EXT_CTRLS, v4l_try_ext_ctrls, v4l_print_ext_controls, 0),
1323 IOCTL_INFO(VIDIOC_ENUM_FRAMESIZES, INFO_FL_CLEAR(v4l2_frmsizeenum, pixel_format)), 1493 IOCTL_INFO(VIDIOC_ENUM_FRAMESIZES, INFO_FL_CLEAR(v4l2_frmsizeenum, pixel_format)),
1324 IOCTL_INFO(VIDIOC_ENUM_FRAMEINTERVALS, INFO_FL_CLEAR(v4l2_frmivalenum, height)), 1494 IOCTL_INFO(VIDIOC_ENUM_FRAMEINTERVALS, INFO_FL_CLEAR(v4l2_frmivalenum, height)),
1325 IOCTL_INFO(VIDIOC_G_ENC_INDEX, 0), 1495 IOCTL_INFO(VIDIOC_G_ENC_INDEX, 0),
@@ -1451,175 +1621,6 @@ static long __video_do_ioctl(struct file *file,
1451 } 1621 }
1452 1622
1453 switch (cmd) { 1623 switch (cmd) {
1454 /* --- controls ---------------------------------------------- */
1455 case VIDIOC_QUERYCTRL:
1456 {
1457 struct v4l2_queryctrl *p = arg;
1458
1459 if (vfh && vfh->ctrl_handler)
1460 ret = v4l2_queryctrl(vfh->ctrl_handler, p);
1461 else if (vfd->ctrl_handler)
1462 ret = v4l2_queryctrl(vfd->ctrl_handler, p);
1463 else if (ops->vidioc_queryctrl)
1464 ret = ops->vidioc_queryctrl(file, fh, p);
1465 else
1466 break;
1467 if (!ret)
1468 dbgarg(cmd, "id=0x%x, type=%d, name=%s, min/max=%d/%d, "
1469 "step=%d, default=%d, flags=0x%08x\n",
1470 p->id, p->type, p->name,
1471 p->minimum, p->maximum,
1472 p->step, p->default_value, p->flags);
1473 else
1474 dbgarg(cmd, "id=0x%x\n", p->id);
1475 break;
1476 }
1477 case VIDIOC_G_CTRL:
1478 {
1479 struct v4l2_control *p = arg;
1480
1481 if (vfh && vfh->ctrl_handler)
1482 ret = v4l2_g_ctrl(vfh->ctrl_handler, p);
1483 else if (vfd->ctrl_handler)
1484 ret = v4l2_g_ctrl(vfd->ctrl_handler, p);
1485 else if (ops->vidioc_g_ctrl)
1486 ret = ops->vidioc_g_ctrl(file, fh, p);
1487 else if (ops->vidioc_g_ext_ctrls) {
1488 struct v4l2_ext_controls ctrls;
1489 struct v4l2_ext_control ctrl;
1490
1491 ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id);
1492 ctrls.count = 1;
1493 ctrls.controls = &ctrl;
1494 ctrl.id = p->id;
1495 ctrl.value = p->value;
1496 if (check_ext_ctrls(&ctrls, 1)) {
1497 ret = ops->vidioc_g_ext_ctrls(file, fh, &ctrls);
1498 if (ret == 0)
1499 p->value = ctrl.value;
1500 }
1501 } else
1502 break;
1503 if (!ret)
1504 dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
1505 else
1506 dbgarg(cmd, "id=0x%x\n", p->id);
1507 break;
1508 }
1509 case VIDIOC_S_CTRL:
1510 {
1511 struct v4l2_control *p = arg;
1512 struct v4l2_ext_controls ctrls;
1513 struct v4l2_ext_control ctrl;
1514
1515 if (!(vfh && vfh->ctrl_handler) && !vfd->ctrl_handler &&
1516 !ops->vidioc_s_ctrl && !ops->vidioc_s_ext_ctrls)
1517 break;
1518
1519 dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
1520
1521 if (vfh && vfh->ctrl_handler) {
1522 ret = v4l2_s_ctrl(vfh, vfh->ctrl_handler, p);
1523 break;
1524 }
1525 if (vfd->ctrl_handler) {
1526 ret = v4l2_s_ctrl(NULL, vfd->ctrl_handler, p);
1527 break;
1528 }
1529 if (ops->vidioc_s_ctrl) {
1530 ret = ops->vidioc_s_ctrl(file, fh, p);
1531 break;
1532 }
1533 if (!ops->vidioc_s_ext_ctrls)
1534 break;
1535
1536 ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id);
1537 ctrls.count = 1;
1538 ctrls.controls = &ctrl;
1539 ctrl.id = p->id;
1540 ctrl.value = p->value;
1541 if (check_ext_ctrls(&ctrls, 1))
1542 ret = ops->vidioc_s_ext_ctrls(file, fh, &ctrls);
1543 else
1544 ret = -EINVAL;
1545 break;
1546 }
1547 case VIDIOC_G_EXT_CTRLS:
1548 {
1549 struct v4l2_ext_controls *p = arg;
1550
1551 p->error_idx = p->count;
1552 if (vfh && vfh->ctrl_handler)
1553 ret = v4l2_g_ext_ctrls(vfh->ctrl_handler, p);
1554 else if (vfd->ctrl_handler)
1555 ret = v4l2_g_ext_ctrls(vfd->ctrl_handler, p);
1556 else if (ops->vidioc_g_ext_ctrls)
1557 ret = check_ext_ctrls(p, 0) ?
1558 ops->vidioc_g_ext_ctrls(file, fh, p) :
1559 -EINVAL;
1560 else
1561 break;
1562 v4l_print_ext_ctrls(cmd, vfd, p, !ret);
1563 break;
1564 }
1565 case VIDIOC_S_EXT_CTRLS:
1566 {
1567 struct v4l2_ext_controls *p = arg;
1568
1569 p->error_idx = p->count;
1570 if (!(vfh && vfh->ctrl_handler) && !vfd->ctrl_handler &&
1571 !ops->vidioc_s_ext_ctrls)
1572 break;
1573 v4l_print_ext_ctrls(cmd, vfd, p, 1);
1574 if (vfh && vfh->ctrl_handler)
1575 ret = v4l2_s_ext_ctrls(vfh, vfh->ctrl_handler, p);
1576 else if (vfd->ctrl_handler)
1577 ret = v4l2_s_ext_ctrls(NULL, vfd->ctrl_handler, p);
1578 else if (check_ext_ctrls(p, 0))
1579 ret = ops->vidioc_s_ext_ctrls(file, fh, p);
1580 else
1581 ret = -EINVAL;
1582 break;
1583 }
1584 case VIDIOC_TRY_EXT_CTRLS:
1585 {
1586 struct v4l2_ext_controls *p = arg;
1587
1588 p->error_idx = p->count;
1589 if (!(vfh && vfh->ctrl_handler) && !vfd->ctrl_handler &&
1590 !ops->vidioc_try_ext_ctrls)
1591 break;
1592 v4l_print_ext_ctrls(cmd, vfd, p, 1);
1593 if (vfh && vfh->ctrl_handler)
1594 ret = v4l2_try_ext_ctrls(vfh->ctrl_handler, p);
1595 else if (vfd->ctrl_handler)
1596 ret = v4l2_try_ext_ctrls(vfd->ctrl_handler, p);
1597 else if (check_ext_ctrls(p, 0))
1598 ret = ops->vidioc_try_ext_ctrls(file, fh, p);
1599 else
1600 ret = -EINVAL;
1601 break;
1602 }
1603 case VIDIOC_QUERYMENU:
1604 {
1605 struct v4l2_querymenu *p = arg;
1606
1607 if (vfh && vfh->ctrl_handler)
1608 ret = v4l2_querymenu(vfh->ctrl_handler, p);
1609 else if (vfd->ctrl_handler)
1610 ret = v4l2_querymenu(vfd->ctrl_handler, p);
1611 else if (ops->vidioc_querymenu)
1612 ret = ops->vidioc_querymenu(file, fh, p);
1613 else
1614 break;
1615 if (!ret)
1616 dbgarg(cmd, "id=0x%x, index=%d, name=%s\n",
1617 p->id, p->index, p->name);
1618 else
1619 dbgarg(cmd, "id=0x%x, index=%d\n",
1620 p->id, p->index);
1621 break;
1622 }
1623 case VIDIOC_G_CROP: 1624 case VIDIOC_G_CROP:
1624 { 1625 {
1625 struct v4l2_crop *p = arg; 1626 struct v4l2_crop *p = arg;