{"id":75867,"date":"2026-02-13T11:25:48","date_gmt":"2026-02-13T03:25:48","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/75867.html"},"modified":"2026-02-13T11:25:48","modified_gmt":"2026-02-13T03:25:48","slug":"%e3%80%90v4l2%e3%80%911-video_device-%e5%87%bd%e6%95%b0%e5%92%8c%e6%95%b0%e6%8d%ae%e7%bb%93%e6%9e%84","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/75867.html","title":{"rendered":"\u3010V4L2\u30111.video_device \u51fd\u6570\u548c\u6570\u636e\u7ed3\u6784"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"1.1.%20%E6%9E%9A%E4%B8%BE%20vfl_devnode_type-toc\" style=\"margin-left:80px\">1.1. \u679a\u4e3e vfl_devnode_type<\/p>\n<p id=\"1.2.%20%E6%9E%9A%E4%B8%BE%20vfl_devnode_direction-toc\" style=\"margin-left:80px\">1.2. \u679a\u4e3e vfl_devnode_direction<\/p>\n<p id=\"1.3.%20%E6%9E%9A%E4%B8%BE%20v4l2_video_device_flags-toc\" style=\"margin-left:80px\">1.3. \u679a\u4e3e v4l2_video_device_flags<\/p>\n<p id=\"1.4.%20%E7%BB%93%E6%9E%84%E4%BD%93%20v4l2_prio_state-toc\" style=\"margin-left:80px\">1.4. \u7ed3\u6784\u4f53 v4l2_prio_state<\/p>\n<p id=\"1.5.%20v4l2_prio_init-toc\" style=\"margin-left:80px\">1.5. v4l2_prio_init<\/p>\n<p id=\"1.6.%20v4l2_prio_change-toc\" style=\"margin-left:80px\">1.6. v4l2_prio_change<\/p>\n<p id=\"1.7.%20v4l2_prio_open-toc\" style=\"margin-left:80px\">1.7. v4l2_prio_open<\/p>\n<p id=\"1.8.%20v4l2_prio_close-toc\" style=\"margin-left:80px\">1.8. v4l2_prio_close<\/p>\n<p id=\"1.9.%20v4l2_prio_max-toc\" style=\"margin-left:80px\">1.9. v4l2_prio_max<\/p>\n<p id=\"1.10.%20v4l2_prio_check-toc\" style=\"margin-left:80px\">1.10. v4l2_prio_check<\/p>\n<p id=\"1.11.%20%E7%BB%93%E6%9E%84%E4%BD%93%20v4l2_file_operations-toc\" style=\"margin-left:80px\">1.11. \u7ed3\u6784\u4f53 v4l2_file_operations<\/p>\n<p id=\"1.12.%20%E7%BB%93%E6%9E%84%E4%BD%93%20video_device-toc\" style=\"margin-left:80px\">1.12. \u7ed3\u6784\u4f53 video_device<\/p>\n<p id=\"1.13.%20media_entity_to_video_device-toc\" style=\"margin-left:80px\">1.13. media_entity_to_video_device<\/p>\n<p id=\"1.14.%20to_video_device-toc\" style=\"margin-left:80px\">1.14. to_video_device<\/p>\n<p id=\"1.15.%20__video_register_device-toc\" style=\"margin-left:80px\">1.15. __video_register_device<\/p>\n<p id=\"1.16.%20video_register_device-toc\" style=\"margin-left:80px\">1.16. video_register_device<\/p>\n<p id=\"1.17.%20video_register_device_no_warn-toc\" style=\"margin-left:80px\">1.17. video_register_device_no_warn<\/p>\n<p id=\"1.18.%20video_unregister_device-toc\" style=\"margin-left:80px\">1.18. video_unregister_device<\/p>\n<p id=\"1.19.%20%C2%A0video_device_alloc-toc\" style=\"margin-left:80px\">1.19. \u00a0video_device_alloc<\/p>\n<p id=\"1.20.%20video_device_release-toc\" style=\"margin-left:80px\">1.20. video_device_release<\/p>\n<p id=\"1.21.%20video_device_release_empty-toc\" style=\"margin-left:80px\">1.21. video_device_release_empty<\/p>\n<p id=\"1.22.%20v4l2_disable_ioctl-toc\" style=\"margin-left:80px\">1.22. v4l2_disable_ioctl<\/p>\n<p id=\"1.23.%20video_get_drvdata-toc\" style=\"margin-left:80px\">1.23. video_get_drvdata<\/p>\n<p id=\"1.24.%20video_set_drvdata-toc\" style=\"margin-left:80px\">1.24. video_set_drvdata<\/p>\n<p id=\"1.25.%20video_devdata-toc\" style=\"margin-left:80px\">1.25. video_devdata<\/p>\n<p id=\"1.26.%20video_drvdata-toc\" style=\"margin-left:80px\">1.26. video_drvdata<\/p>\n<p id=\"1.27.%20video_device_node_name-toc\" style=\"margin-left:80px\">1.27. video_device_node_name<\/p>\n<p id=\"1.28.%20video_is_registered-toc\" style=\"margin-left:80px\">1.28. video_is_registered<\/p>\n<hr id=\"hr-toc\" \/>\n<h4 id=\"1.1.%20%E6%9E%9A%E4%B8%BE%20vfl_devnode_type\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.1. \u679a\u4e3e vfl_devnode_type<\/span><\/span><\/h4>\n<p>\u679a\u4e3evfl_devnode_type <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">V4L2\u8bbe\u5907\u8282\u70b9\u7684\u7c7b\u578b<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5e38\u91cf<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">VFL_TYPE_VIDEO<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u7528\u4e8e\u89c6\u9891\u8f93\u5165\/\u8f93\u51fa\u8bbe\u5907<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">VFL_TYPE_VBI<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u7528\u4e8e\u5782\u76f4\u6d88\u9690\u6570\u636e&#xff08;\u5373\u9690\u85cf\u5f0f\u5b57\u5e55\u3001\u56fe\u6587\u7535\u89c6&#xff09;<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">VFL_TYPE_RADIO<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u7528\u4e8e\u65e0\u7ebf\u7535\u8c03\u8c10\u5668<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">VFL_TYPE_SUBDEV<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u7528\u4e8eV4L2\u5b50\u8bbe\u5907<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">VFL_TYPE_SDR<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u7528\u4e8e\u8f6f\u4ef6\u5b9a\u4e49\u65e0\u7ebf\u7535\u8c03\u8c10\u5668<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">VFL_TYPE_TOUCH<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u7528\u4e8e\u89e6\u6478\u4f20\u611f\u5668<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">VFL_TYPE_MAX<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">VFL\u7c7b\u578b\u7684\u6570\u91cf&#xff0c;\u5fc5\u987b\u59cb\u7ec8\u4f4d\u4e8e\u679a\u4e3e\u7684\u6700\u540e<\/p>\n<\/li>\n<\/ul>\n<h4 id=\"1.2.%20%E6%9E%9A%E4%B8%BE%20vfl_devnode_direction\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.2. \u679a\u4e3e vfl_devnode_direction<\/span><\/span><\/h4>\n<p>\u679a\u4e3evfl_devnode_direction <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u786e\u5b9astruct video_device\u662f\u5bf9\u5e94\u63a5\u6536\u5668\u3001\u53d1\u5c04\u5668\u8fd8\u662f\u5185\u5b58\u5230\u5185\u5b58\u8bbe\u5907\u3002<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5e38\u91cf<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">VFL_DIR_RX<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8bbe\u5907\u662f\u63a5\u6536\u5668\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">VFL_DIR_TX<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8bbe\u5907\u662f\u53d1\u5c04\u5668\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">VFL_DIR_M2M<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8be5\u8bbe\u5907\u662f\u4e00\u79cd\u5185\u5b58\u5230\u5185\u5b58\u7684\u8bbe\u5907\u3002<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8:\u00a0<\/span><\/span><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5982\u679cenum vfl_devnode_type\u4e3aVFL_TYPE_SUBDEV&#xff0c;\u5219\u5ffd\u7565\u3002<\/span><\/span><\/p>\n<h4 id=\"1.3.%20%E6%9E%9A%E4%B8%BE%20v4l2_video_device_flags\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.3. \u679a\u4e3e v4l2_video_device_flags<\/span><\/span><\/h4>\n<p>\u679a\u4e3ev4l2_video_device_flags <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">struct video_device \u6240\u4f7f\u7528\u7684\u6807\u5fd7<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5e38\u91cf<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">V4L2_FL_REGISTERED<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8868\u793a\u5df2\u6ce8\u518c\u4e00\u4e2astruct video_device\u3002\u9a71\u52a8\u7a0b\u5e8f\u5982\u679c\u60f3\u963b\u6b62\u6240\u6709\u672a\u6765\u7684\u8bbe\u5907\u8bbf\u95ee&#xff0c;\u53ef\u4ee5\u6e05\u9664\u6b64\u6807\u5fd7\u3002\u8be5\u6807\u5fd7\u4f1a\u88abvideo_unregister_device\u6e05\u9664\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">V4L2_FL_USES_V4L2_FH<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8868\u793a file-&gt;private_data \u6307\u5411 struct v4l2_fh\u3002\u8c03\u7528 v4l2_fh_init() \u65f6&#xff0c;\u5185\u6838\u4f1a\u8bbe\u7f6e\u6b64\u6807\u5fd7\u3002\u6240\u6709\u65b0\u9a71\u52a8\u7a0b\u5e8f\u90fd\u5e94\u4f7f\u7528\u5b83\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">V4L2_FL_QUIRK_INVERTED_CROP<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u4e00\u4e9b\u65e7\u7684M2M\u9a71\u52a8\u7a0b\u5e8f\u9519\u8bef\u5730\u4f7f\u7528\u4e86g\/s_crop\/cropcap&#xff1a;\u88c1\u526a\u548c\u5408\u6210\u88ab\u4ea4\u6362\u4e86\u3002\u5982\u679c\u8bbe\u7f6e\u4e86\u6b64\u6807\u5fd7&#xff0c;\u5219v4l2-ioctl.c\u4e2d\u7684g\/s_crop\/cropcap\u51fd\u6570\u4f1a\u4ea4\u6362\u9009\u62e9\u76ee\u6807\u3002\u8fd9\u4f7f\u5f97\u8fd9\u4e9b\u9a71\u52a8\u7a0b\u5e8f\u80fd\u591f\u6b63\u786e\u5b9e\u73b0\u9009\u62e9API&#xff0c;\u800c\u65e7\u7684\u88c1\u526aAPI\u4ecd\u4f1a\u6309\u9884\u671f\u5de5\u4f5c&#xff0c;\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002\u5207\u52ff\u4e3a\u65b0\u9a71\u52a8\u7a0b\u5e8f\u8bbe\u7f6e\u6b64\u6807\u5fd7\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">V4L2_FL_SUBDEV_RO_DEVNODE<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8868\u793a\u89c6\u9891\u8bbe\u5907\u8282\u70b9\u662f\u4ee5\u53ea\u8bfb\u6a21\u5f0f\u6ce8\u518c\u7684\u3002\u8be5\u6807\u5fd7\u4ec5\u9002\u7528\u4e8e\u4e3a\u5b50\u8bbe\u5907\u6ce8\u518c\u7684\u8bbe\u5907\u8282\u70b9&#xff0c;\u5f53\u4f7f\u7528v4l2_device_register_ro_subdev_nodes()\u6ce8\u518c\u5b50\u8bbe\u5907\u7684\u8bbe\u5907\u8282\u70b9\u65f6&#xff0c;\u7531\u5185\u6838\u8fdb\u884c\u8bbe\u7f6e&#xff0c;\u5e76\u88ab\u5b50\u8bbe\u5907ioctl\u5904\u7406\u7a0b\u5e8f\u7528\u4e8e\u9650\u5236\u5bf9\u67d0\u4e9bioctl\u8c03\u7528\u7684\u8bbf\u95ee\u3002<\/p>\n<\/li>\n<\/ul>\n<h4 id=\"1.4.%20%E7%BB%93%E6%9E%84%E4%BD%93%20v4l2_prio_state\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.4. \u7ed3\u6784\u4f53 v4l2_prio_state<\/span><\/span><\/h4>\n<p>struct v4l2_prio_state \u7ed3\u6784\u4f53 <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5b58\u50a8\u4f18\u5148\u7ea7\u72b6\u6001<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5b9a\u4e49<\/span><\/span><\/p>\n<p>        struct v4l2_prio_state {<br \/>\n  atomic_t prios[4];<br \/>\n}; <\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6210\u5458<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">prios<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u7528\u4e8e\u5b58\u50a8\u6570\u7ec4\u4f18\u5148\u7ea7\u7684\u5143\u7d20\u6570\u7ec4<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8:\u00a0<\/span><\/span><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">prios\u6570\u7ec4\u7684\u5927\u5c0f\u4e0e\u679a\u4e3ev4l2_priority\u5b9a\u4e49\u7684\u4f18\u5148\u7ea7\u7c7b\u578b\u6570\u91cf\u76f8\u5339\u914d\u3002<\/span><\/span><\/p>\n<h4 id=\"1.5.%20v4l2_prio_init\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.5. v4l2_prio_init<\/span><\/span><\/h4>\n<p>void v4l2_prio_init(struct v4l2_prio_state *global) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u521d\u59cb\u5316\u4e00\u4e2a struct v4l2_prio_state<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct v4l2_prio_state *global<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411 struct v4l2_prio_state \u7684\u6307\u9488<\/p>\n<\/li>\n<\/ul>\n<h4 id=\"1.6.%20v4l2_prio_change\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.6. v4l2_prio_change<\/span><\/span><\/h4>\n<p>int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, enum v4l2_priority new) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u66f4\u6539v4l2\u6587\u4ef6\u53e5\u67c4\u4f18\u5148\u7ea7<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct v4l2_prio_state *global<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411\u8bbe\u5907\u8282\u70b9\u7684struct v4l2_prio_state\u7684\u6307\u9488\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">enum v4l2_priority *local<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411\u6240\u9700\u4f18\u5148\u7ea7\u7684\u6307\u9488&#xff0c;\u7531\u679a\u4e3ev4l2_priority\u5b9a\u4e49<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">enum v4l2_priority new<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8bf7\u6c42\u7684\u4f18\u5148\u7ea7\u7c7b\u578b&#xff0c;\u7531\u679a\u4e3ev4l2_priority\u5b9a\u4e49\u3002<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8:\u00a0<\/span><\/span><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6b64\u51fd\u6570\u4ec5\u5e94\u7531V4L2\u6838\u5fc3\u4f7f\u7528\u3002<\/span><\/span><\/p>\n<h4 id=\"1.7.%20v4l2_prio_open\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.7. v4l2_prio_open<\/span><\/span><\/h4>\n<p>void v4l2_prio_open(struct v4l2_prio_state *global&#xff0c;enum v4l2_priority *local) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5b9e\u73b0\u6587\u4ef6\u5904\u7406\u5668\u6253\u5f00\u7684\u4f18\u5148\u7ea7\u903b\u8f91<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct v4l2_prio_state *global<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411\u8bbe\u5907\u8282\u70b9\u7684struct v4l2_prio_state\u7684\u6307\u9488\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">enum v4l2_priority *local<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411\u6240\u9700\u4f18\u5148\u7ea7\u7684\u6307\u9488&#xff0c;\u7531\u679a\u4e3ev4l2_priority\u5b9a\u4e49<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8:\u00a0<\/span><\/span><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6b64\u51fd\u6570\u4ec5\u5e94\u7531V4L2\u6838\u5fc3\u4f7f\u7528\u3002<\/span><\/span><\/p>\n<h4 id=\"1.8.%20v4l2_prio_close\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.8. v4l2_prio_close<\/span><\/span><\/h4>\n<p>void v4l2_prio_close&#xff08;struct v4l2_prio_state *global&#xff0c;enum v4l2_priority local&#xff09; <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5b9e\u73b0\u6587\u4ef6\u5904\u7406\u5668\u5173\u95ed\u7684\u4f18\u5148\u7ea7\u903b\u8f91<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct v4l2_prio_state *global<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411\u8bbe\u5907\u8282\u70b9\u7684struct v4l2_prio_state\u7684\u6307\u9488\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">enum v4l2_priority local<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u7531\u679a\u4e3ev4l2_priority\u5b9a\u4e49\u7684\u5f85\u91ca\u653e\u4f18\u5148\u7ea7<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8:\u00a0<\/span><\/span><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6b64\u51fd\u6570\u4ec5\u5e94\u7531V4L2\u6838\u5fc3\u4f7f\u7528\u3002<\/span><\/span><\/p>\n<h4 id=\"1.9.%20v4l2_prio_max\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.9. v4l2_prio_max<\/span><\/span><\/h4>\n<p>enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8fd4\u56de\u5b58\u50a8\u5728global\u6570\u7ec4\u4e2d\u7684\u6700\u5927\u4f18\u5148\u7ea7\u3002<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct v4l2_prio_state *global<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411\u8bbe\u5907\u8282\u70b9\u7684struct v4l2_prio_state\u7684\u6307\u9488\u3002<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8:\u00a0<\/span><\/span><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6b64\u51fd\u6570\u4ec5\u5e94\u7531V4L2\u6838\u5fc3\u4f7f\u7528\u3002<\/span><\/span><\/p>\n<h4 id=\"1.10.%20v4l2_prio_check\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.10. v4l2_prio_check<\/span><\/span><\/h4>\n<p>int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5b9e\u73b0\u6587\u4ef6\u5904\u7406\u7a0b\u5e8f\u5173\u95ed\u7684\u4f18\u5148\u7ea7\u903b\u8f91<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct v4l2_prio_state *global<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411\u8bbe\u5907\u8282\u70b9\u7684struct v4l2_prio_state\u7684\u6307\u9488\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">enum v4l2_priority local<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6240\u9700\u4f18\u5148\u7ea7&#xff0c;\u7531\u679a\u4e3ev4l2_priority local\u5b9a\u4e49<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8:\u00a0<\/span><\/span><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6b64\u51fd\u6570\u4ec5\u5e94\u7531V4L2\u6838\u5fc3\u4f7f\u7528\u3002<\/span><\/span><\/p>\n<h4 id=\"1.11.%20%E7%BB%93%E6%9E%84%E4%BD%93%20v4l2_file_operations\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.11. \u7ed3\u6784\u4f53 v4l2_file_operations<\/span><\/span><\/h4>\n<p>struct v4l2_file_operations <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">V4L2\u8bbe\u5907\u4f7f\u7528\u7684\u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5b9a\u4e49<\/span><\/span><\/p>\n<p>        struct v4l2_file_operations {<br \/>\n  struct module *owner;<br \/>\n  ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);<br \/>\n  ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);<br \/>\n  __poll_t (*poll) (struct file *, struct poll_table_struct *);<br \/>\n  long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);<br \/>\n#ifdef CONFIG_COMPAT;<br \/>\n  long (*compat_ioctl32) (struct file *, unsigned int, unsigned long);<br \/>\n#endif;<br \/>\n  unsigned long (*get_unmapped_area) (struct file *, unsigned long, unsigned long, unsigned long, unsigned long);<br \/>\n  int (*mmap) (struct file *, struct vm_area_struct *);<br \/>\n  int (*open) (struct file *);<br \/>\n  int (*release) (struct file *);<br \/>\n}; <\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6210\u5458<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">owner<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411\u7ed3\u6784\u4f53\u6a21\u5757\u7684\u6307\u9488<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">read<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5b9e\u73b0read()\u7cfb\u7edf\u8c03\u7528\u6240\u9700\u7684\u64cd\u4f5c<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">write<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5b9e\u73b0write()\u7cfb\u7edf\u8c03\u7528\u6240\u9700\u7684\u64cd\u4f5c<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">poll<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5b9e\u73b0poll()\u7cfb\u7edf\u8c03\u7528\u6240\u9700\u7684\u64cd\u4f5c<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">unlocked_ioctl<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5b9e\u73b0ioctl()\u7cfb\u7edf\u8c03\u7528\u6240\u9700\u7684\u64cd\u4f5c<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">compat_ioctl32<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5728\u5185\u6838\u4f7f\u752864\u4f4d\u6307\u4ee4\u800c\u7528\u6237\u7a7a\u95f4\u4f7f\u752832\u4f4d\u7684\u7279\u6b8a\u60c5\u51b5\u4e0b&#xff0c;\u5b9e\u73b0ioctl()\u7cfb\u7edf\u8c03\u7528\u6240\u9700\u7684\u64cd\u4f5c\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">get_unmapped_area<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u7531mmap()\u7cfb\u7edf\u8c03\u7528\u8c03\u7528&#xff0c;\u5728%!CONFIG_MMU\u65f6\u4f7f\u7528<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">mmap<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5b9e\u73b0mmap()\u7cfb\u7edf\u8c03\u7528\u6240\u9700\u7684\u64cd\u4f5c<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">open<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5b9e\u73b0open()\u7cfb\u7edf\u8c03\u7528\u6240\u9700\u7684\u64cd\u4f5c<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">release<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5b9e\u73b0release()\u7cfb\u7edf\u8c03\u7528\u6240\u9700\u7684\u64cd\u4f5c<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8&#xff1a;<\/span><\/span><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u8fd9\u4e9b\u64cd\u4f5c\u7528\u4e8e\u5728V4L2\u9a71\u52a8\u7a0b\u5e8f\u4e2d\u5b9e\u73b0fs\u7ed3\u6784\u4f53file_operations\u3002V4L2\u6838\u5fc3\u4f1a\u7528\u5b50\u7cfb\u7edf\u6240\u9700\u7684\u4e00\u4e9b\u989d\u5916\u903b\u8f91\u8986\u76d6\u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\">\n<h4 id=\"1.12.%20%E7%BB%93%E6%9E%84%E4%BD%93%20video_device\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.12. \u7ed3\u6784\u4f53 video_device<\/span><\/span><\/h4>\n<p>struct video_device <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u7528\u4e8e\u521b\u5efa\u548c\u7ba1\u7406V4L2\u8bbe\u5907\u8282\u70b9\u7684\u7ed3\u6784\u3002<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5b9a\u4e49<\/span><\/span><\/p>\n<p>        struct video_device {<br \/>\n#if defined(CONFIG_MEDIA_CONTROLLER);<br \/>\n  struct media_entity entity;<br \/>\n  struct media_intf_devnode *intf_devnode;<br \/>\n  struct media_pipeline pipe;<br \/>\n#endif;<br \/>\n  const struct v4l2_file_operations *fops;<br \/>\n  u32 device_caps;<br \/>\n  struct device dev;<br \/>\n  struct cdev *cdev;<br \/>\n  struct v4l2_device *v4l2_dev;<br \/>\n  struct device *dev_parent;<br \/>\n  struct v4l2_ctrl_handler *ctrl_handler;<br \/>\n  struct vb2_queue *queue;<br \/>\n  struct v4l2_prio_state *prio;<br \/>\n  char name[32];<br \/>\n  enum vfl_devnode_type vfl_type;<br \/>\n  enum vfl_devnode_direction vfl_dir;<br \/>\n  int minor;<br \/>\n  u16 num;<br \/>\n  unsigned long flags;<br \/>\n  int index;<br \/>\n  spinlock_t fh_lock;<br \/>\n  struct list_head        fh_list;<br \/>\n  int dev_debug;<br \/>\n  v4l2_std_id tvnorms;<br \/>\n  void (*release)(struct video_device *vdev);<br \/>\n  const struct v4l2_ioctl_ops *ioctl_ops;<br \/>\n  unsigned long valid_ioctls[BITS_TO_LONGS(BASE_VIDIOC_PRIVATE)];<br \/>\n  struct mutex *lock;<br \/>\n}; <\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6210\u5458<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">entity<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">struct media_entity <\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">intf_devnode<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411 struct media_intf_devnode \u7684\u6307\u9488<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">pipe<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">struct media_pipeline <\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">fops<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411\u89c6\u9891\u8bbe\u5907\u7684struct v4l2_file_operations\u7684\u6307\u9488<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">device_caps<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">v4l2_capabilities\u4e2d\u4f7f\u7528\u7684\u8bbe\u5907\u529f\u80fd<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">dev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">struct device&#xff08;\u7528\u4e8e\u89c6\u9891\u8bbe\u5907&#xff09;<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">cdev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5b57\u7b26\u8bbe\u5907<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">v4l2_dev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411 struct v4l2_device \u7236\u8bbe\u5907\u7684\u6307\u9488<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">dev_parent<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411struct device\u7684\u6307\u9488 parent<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">ctrl_handler<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u4e0e\u6b64\u8bbe\u5907\u8282\u70b9\u76f8\u5173\u8054\u7684\u63a7\u5236\u5904\u7406\u5668\u3002\u53ef\u80fd\u4e3aNULL\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">queue<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u4e0e\u8be5\u8bbe\u5907\u8282\u70b9\u76f8\u5173\u8054\u7684struct vb2_queue\u3002\u53ef\u80fd\u4e3aNULL\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">prio<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411struct v4l2_prio_state\u7684\u6307\u9488&#xff0c;\u5305\u542b\u8bbe\u5907\u7684\u4f18\u5148\u7ea7\u72b6\u6001\u3002\u5982\u679c\u4e3aNULL&#xff0c;\u5219\u5c06\u4f7f\u7528v4l2_dev-&gt;prio\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">name<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u89c6\u9891\u8bbe\u5907\u540d\u79f0<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">vfl_type<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">V4L\u8bbe\u5907\u7c7b\u578b&#xff0c;\u7531enum vfl_devnode_type\u5b9a\u4e49<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">vfl_dir<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">V4L\u63a5\u6536\u5668\u3001\u53d1\u5c04\u5668\u6216m2m<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">minor<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8bbe\u5907\u8282\u70b9\u201c\u6b21\u8bbe\u5907\u53f7\u201d\u3002\u5982\u679c\u6ce8\u518c\u5931\u8d25&#xff0c;\u5b83\u4f1a\u88ab\u8bbe\u4e3a-1\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">num<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u89c6\u9891\u8bbe\u5907\u8282\u70b9\u7f16\u53f7<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">flags<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u89c6\u9891\u8bbe\u5907\u6807\u5fd7\u3002\u4f7f\u7528\u4f4d\u64cd\u4f5c\u6765\u8bbe\u7f6e\/\u6e05\u9664\/\u6d4b\u8bd5\u6807\u5fd7\u3002\u5305\u542b\u4e00\u7ec4enum v4l2_video_device_flags\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">index<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u7528\u4e8e\u533a\u5206\u540c\u4e00\u7269\u7406\u8bbe\u5907\u4e0a\u591a\u4e2a\u7d22\u5f15\u7684\u5c5e\u6027<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">fh_lock<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6240\u6709v4l2_fhs\u7684\u9501<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">fh_list<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">struct v4l2_fh\u5217\u8868<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">dev_debug<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8bbe\u5907\u5185\u90e8\u8c03\u8bd5\u6807\u5fd7&#xff0c;\u4e0d\u4f9b\u9a71\u52a8\u7a0b\u5e8f\u4f7f\u7528<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">tvnorms<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u652f\u6301\u7684\u7535\u89c6\u5236\u5f0f<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">release<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u89c6\u9891\u8bbe\u5907release()\u56de\u8c03\u51fd\u6570<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">ioctl_ops<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411\u5e26\u6709ioctl\u56de\u8c03\u7684struct v4l2_ioctl_ops\u7684\u6307\u9488<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">valid_ioctls<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6b64\u8bbe\u5907\u7684\u6709\u6548ioctl\u7684\u4f4d\u56fe<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">lock<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411struct mutex\u5e8f\u5217\u5316\u9501\u7684\u6307\u9488<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8:\u00a0<\/span><\/span><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53ea\u6709\u5728\u65e0\u6cd5\u4ecev4l2_dev\u4e2d\u63a8\u5bfc\u51fa\u6765\u65f6&#xff0c;\u624d\u8bbe\u7f6edev_parent\u3002<\/span><\/span><\/p>\n<h4 id=\"1.13.%20media_entity_to_video_device\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.13. <\/span><\/span>media_entity_to_video_device<\/h4>\n<p>        media_entity_to_video_device (__entity) <\/p>\n<p style=\"margin-left:0;margin-right:0\">\u4ece\u5d4c\u5165\u7684struct media_entity\u8fd4\u56de\u4e00\u4e2astruct video_device\u3002<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">__entity<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411struct media_entity\u7684\u6307\u9488<\/p>\n<\/li>\n<\/ul>\n<h4 id=\"1.14.%20to_video_device\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.14. <\/span><\/span>to_video_device<\/h4>\n<p>        to_video_device (cd) <\/p>\n<p style=\"margin-left:0;margin-right:0\">\u4ece\u5d4c\u5165\u7684struct device\u8fd4\u56de\u4e00\u4e2astruct video_device\u3002<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">cd<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411struct device\u7684\u6307\u9488<\/p>\n<\/li>\n<\/ul>\n<h4 id=\"1.15.%20__video_register_device\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.15. __video_register_device<\/span><\/span><\/h4>\n<p>int __video_register_device(struct video_device *vdev, enum vfl_devnode_type type, int nr, int warn_if_nr_in_use, struct module *owner) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6ce8\u518cvideo4linux\u8bbe\u5907<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct video_device *vdev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8981\u6ce8\u518c\u7684struct video_device<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">enum vfl_devnode_type type<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8981\u6ce8\u518c\u7684\u8bbe\u5907\u7c7b\u578b&#xff0c;\u7531enum vfl_devnode_type\u5b9a\u4e49<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">int nr<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u671f\u671b\u7684\u8bbe\u5907\u8282\u70b9\u7f16\u53f7\u662f&#xff1a;&#xff08;0 &#061;&#061; \/dev\/video0&#xff0c;1 &#061;&#061; \/dev\/video1&#xff0c;\u2026\u2026&#xff0c;-1 &#061;&#061; \u7b2c\u4e00\u4e2a\u7a7a\u95f2\u8282\u70b9&#xff09;<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">int warn_if_nr_in_use<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5982\u679c\u6240\u9700\u7684\u8bbe\u5907\u8282\u70b9\u53f7\u5df2\u88ab\u4f7f\u7528\u4e14\u9009\u62e9\u4e86\u53e6\u4e00\u4e2a\u7f16\u53f7&#xff0c;\u5219\u53d1\u51fa\u8b66\u544a\u3002<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct module *owner<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u62e5\u6709\u89c6\u9891\u8bbe\u5907\u8282\u70b9\u7684\u6a21\u5757<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8\u518c\u4ee3\u7801\u6839\u636e\u8bf7\u6c42\u7684\u7c7b\u578b\u5206\u914d\u6b21\u7f16\u53f7\u548c\u8bbe\u5907\u8282\u70b9\u7f16\u53f7&#xff0c;\u5e76\u5411\u5185\u6838\u6ce8\u518c\u65b0\u7684\u8bbe\u5907\u8282\u70b9\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6b64\u51fd\u6570\u5047\u8bbestruct video_device\u5728\u5206\u914d\u65f6\u5df2\u6e05\u96f6&#xff0c;\u4e14\u4e0d\u5305\u542b\u4efb\u4f55\u9648\u65e7\u6570\u636e\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5982\u679c\u627e\u4e0d\u5230\u53ef\u7528\u7684\u6b21\u8981\u7f16\u53f7\u6216\u8bbe\u5907\u8282\u70b9\u7f16\u53f7&#xff0c;\u6216\u8005\u8bbe\u5907\u8282\u70b9\u6ce8\u518c\u5931\u8d25&#xff0c;\u5c06\u8fd4\u56de\u9519\u8bef\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6210\u529f\u65f6\u8fd4\u56de0\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8:\u00a0<\/span><\/span><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6b64\u51fd\u6570\u4ec5\u7528\u4e8eV4L2\u6838\u5fc3\u5185\u90e8\u3002\u9a71\u52a8\u7a0b\u5e8f\u5e94\u4f7f\u7528video_register_device()\u6216video_register_device_no_warn()\u3002<\/span><\/span><\/p>\n<h4 id=\"1.16.%20video_register_device\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.16. <\/span><\/span>video_register_device<\/h4>\n<p>int video_register_device(struct video_device *vdev, enum vfl_devnode_type type, int nr) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6ce8\u518cvideo4linux\u8bbe\u5907<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct video_device *vdev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8981\u6ce8\u518c\u7684struct video_device\u7ed3\u6784\u4f53<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">enum vfl_devnode_type type<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8981\u6ce8\u518c\u7684\u8bbe\u5907\u7c7b\u578b&#xff0c;\u7531enum vfl_devnode_type\u5b9a\u4e49<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">int nr<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6240\u9700\u7684\u8bbe\u5907\u8282\u70b9\u7f16\u53f7&#xff1a;&#xff08;0 &#061;&#061; \/dev\/video0&#xff0c;1 &#061;&#061; \/dev\/video1&#xff0c;\u2026\u2026&#xff0c;-1 &#061;&#061; \u7b2c\u4e00\u4e2a\u7a7a\u95f2&#xff09;<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5728\u5185\u90e8&#xff0c;\u5b83\u4f1a\u8c03\u7528__video_register_device()\u3002\u6709\u5173\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f&#xff0c;\u8bf7\u53c2\u9605\u5176\u6587\u6863\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5982\u679cvideo_register_device\u5931\u8d25&#xff0c;struct video_device\u7ed3\u6784\u4f53\u7684release()\u56de\u8c03\u51fd\u6570\u4e0d\u4f1a\u88ab\u8c03\u7528&#xff0c;\u56e0\u6b64\u8c03\u7528\u8005\u8d1f\u8d23\u91ca\u653e\u6240\u6709\u6570\u636e\u3002\u901a\u5e38\u8fd9\u610f\u5473\u7740\u5728\u5931\u8d25\u65f6\u5e94\u8be5\u8c03\u7528video_device_release()\u3002<\/span><\/span><\/p>\n<h4 id=\"1.17.%20video_register_device_no_warn\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.17. video_register_device_no_warn<\/span><\/span><\/h4>\n<p>int video_register_device_no_warn(struct video_device *vdev, enum vfl_devnode_type type, int nr) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6ce8\u518cvideo4linux\u8bbe\u5907<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct video_device *vdev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8981\u6ce8\u518c\u7684struct video_device\u7ed3\u6784\u4f53<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">enum vfl_devnode_type type<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8981\u6ce8\u518c\u7684\u8bbe\u5907\u7c7b\u578b&#xff0c;\u7531enum vfl_devnode_type\u5b9a\u4e49<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">int nr<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6240\u9700\u7684\u8bbe\u5907\u8282\u70b9\u53f7&#xff1a;&#xff08;0 &#061;&#061; \/dev\/video0&#xff0c;1 &#061;&#061; \/dev\/video1&#xff0c;\u2026\u2026&#xff0c;-1 &#061;&#061; \u7b2c\u4e00\u4e2a\u7a7a\u95f2\u8282\u70b9&#xff09;<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6b64\u51fd\u6570\u4e0evideo_register_device()\u76f8\u540c&#xff0c;\u4e0d\u540c\u4e4b\u5904\u5728\u4e8e&#xff0c;\u5982\u679c\u6240\u9700\u7684\u8bbe\u5907\u8282\u70b9\u53f7\u5df2\u5728\u4f7f\u7528\u4e2d&#xff0c;\u4e0d\u4f1a\u53d1\u51fa\u8b66\u544a\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5728\u5185\u90e8&#xff0c;\u5b83\u4f1a\u8c03\u7528__video_register_device()\u3002\u6709\u5173\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f&#xff0c;\u8bf7\u53c2\u9605\u5176\u6587\u6863\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8<\/span><\/span><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5982\u679cvideo_register_device\u5931\u8d25&#xff0c;struct video_device\u7ed3\u6784\u4f53\u7684release()\u56de\u8c03\u51fd\u6570\u4e0d\u4f1a\u88ab\u8c03\u7528&#xff0c;\u56e0\u6b64\u8c03\u7528\u8005\u8d1f\u8d23\u91ca\u653e\u6240\u6709\u6570\u636e\u3002\u901a\u5e38\u8fd9\u610f\u5473\u7740\u5728\u5931\u8d25\u65f6\u5e94\u8be5\u8c03\u7528video_device_release()\u3002<\/span><\/span><\/p>\n<h4 id=\"1.18.%20video_unregister_device\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.18. video_unregister_device<\/span><\/span><\/h4>\n<p>void video_unregister_device(struct video_device *vdev) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6ce8\u9500\u89c6\u9891\u8bbe\u5907\u3002<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct video_device *vdev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">struct video_device \u7528\u4e8e\u6ce8\u518c<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5982\u679cvdev &#061;&#061; NULL\u6216\u8005video_is_registered()\u8fd4\u56defalse&#xff0c;\u5219\u4e0d\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002<\/span><\/span><\/p>\n<h4 id=\"1.19.%20%C2%A0video_device_alloc\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.19. <\/span><\/span>\u00a0video_device_alloc<\/h4>\n<p>struct video_device *video_device_alloc(void) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u7528\u4e8e\u5206\u914dstruct video_device\u7684\u8f85\u52a9\u51fd\u6570<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">void<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u65e0\u53c2\u6570<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5982\u679c\u4e3a-ENOMEM&#xff0c;\u5219\u8fd4\u56deNULL&#xff1b;\u6210\u529f\u65f6\u8fd4\u56destruct video_device\u3002<\/span><\/span><\/p>\n<h4 id=\"1.20.%20video_device_release\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.20. video_device_release<\/span><\/span><\/h4>\n<p>void video_device_release(struct video_device *vdev) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u91ca\u653estruct video_device\u7684\u8f85\u52a9\u51fd\u6570<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct video_device *vdev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411 struct video_device \u7684\u6307\u9488<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u4e5f\u53ef\u7528\u4e8evideo_device-&gt;release()\u3002<\/span><\/span><\/p>\n<h4 id=\"1.21.%20video_device_release_empty\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.21. video_device_release_empty<\/span><\/span><\/h4>\n<p>void video_device_release_empty(struct video_device *vdev) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u7528\u4e8e\u5b9e\u73b0video_device-&gt;release()\u56de\u8c03\u7684\u8f85\u52a9\u51fd\u6570\u3002<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct video_device *vdev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411 struct video_device \u7684\u6307\u9488<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6b64\u91ca\u653e\u51fd\u6570\u4e0d\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u5f53video_device\u662f\u9759\u6001\u5168\u5c40\u7ed3\u6784\u4f53\u65f6&#xff0c;\u5e94\u4f7f\u7528\u6b64\u51fd\u6570\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8:\u00a0<\/span><\/span><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u62e5\u6709\u9759\u6001\u7684video_device\u5f80\u597d\u91cc\u8bf4\u4e5f\u662f\u4e00\u79cd\u53ef\u7591\u7684\u6784\u9020\u3002<\/span><\/span><\/p>\n<h4 id=\"1.22.%20v4l2_disable_ioctl\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.22. v4l2_disable_ioctl<\/span><\/span><\/h4>\n<p>void v4l2_disable_ioctl(struct video_device *vdev, unsigned int cmd) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6807\u8bb0\u7ed9\u5b9a\u547d\u4ee4\u672a\u5b9e\u73b0\u3002\u4e0d\u5e94\u4f7f\u7528\u6838\u5fc3\u9501\u5b9a<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct video_device *vdev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411 struct video_device \u7684\u6307\u9488<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">unsigned int cmd<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">ioctl\u547d\u4ee4<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6b64\u51fd\u6570\u5141\u8bb8\u9a71\u52a8\u7a0b\u5e8f\u4ec5\u63d0\u4f9b\u4e00\u4e2av4l2_ioctl_ops\u7ed3\u6784\u4f53&#xff0c;\u4f46\u4f1a\u6839\u636e\u5b9e\u9645\u68c0\u6d4b\u5230\u7684\u7279\u5b9a\u5361\u6765\u7981\u7528ioctl\u64cd\u4f5c\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u6ce8:\u00a0<\/span><\/span><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u8fd9\u5fc5\u987b\u5728 video_register_device \u4e4b\u524d\u8c03\u7528\u3002\u53e6\u8bf7\u53c2\u89c1 determine_valid_ioctls() \u7684\u6ce8\u91ca\u3002<\/span><\/span><\/p>\n<h4 id=\"1.23.%20video_get_drvdata\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.23. video_get_drvdata<\/span><\/span><\/h4>\n<p>void *video_get_drvdata(struct video_device *vdev) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u4ecestruct video_device\u83b7\u53d6\u79c1\u6709\u6570\u636e\u3002<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct video_device *vdev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411struct video_device\u7684\u6307\u9488<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u8fd4\u56de\u6307\u5411\u79c1\u6709\u6570\u636e\u7684\u6307\u9488<\/span><\/span><\/p>\n<h4 id=\"1.24.%20video_set_drvdata\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.24. video_set_drvdata<\/span><\/span><\/h4>\n<p>void video_set_drvdata(struct video_device *vdev, void *data) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8bbe\u7f6e\u6765\u81eastruct video_device\u7684\u79c1\u6709\u6570\u636e\u3002<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct video_device *vdev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411struct video_device\u7684\u6307\u9488<\/p>\n<\/li>\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">void *data<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u79c1\u6709\u6570\u636e\u6307\u9488<\/p>\n<\/li>\n<\/ul>\n<h4 id=\"1.25.%20video_devdata\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.25. <\/span><\/span>video_devdata<\/h4>\n<p>struct video_device *video_devdata(struct file *file) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u4ecestruct file\u83b7\u53d6struct video_device\u3002<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct file *file<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411struct file\u7684\u6307\u9488<\/p>\n<\/li>\n<\/ul>\n<h4 id=\"1.26.%20video_drvdata\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.26. video_drvdata<\/span><\/span><\/h4>\n<p>void *video_drvdata(struct file *file) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u4f7f\u7528struct file\u4ecestruct video_device\u83b7\u53d6\u79c1\u6709\u6570\u636e\u3002<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct file *file<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411struct file\u7684\u6307\u9488<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u8fd9\u4e2a\u51fd\u6570\u7ed3\u5408\u4e86video_get_drvdata()\u548cvideo_devdata()&#xff0c;\u56e0\u4e3a\u8fd9\u4e24\u4e2a\u51fd\u6570\u7684\u7ec4\u5408\u4f7f\u7528\u975e\u5e38\u9891\u7e41\u3002<\/span><\/span><\/p>\n<h4 id=\"1.27.%20video_device_node_name\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.27. <\/span><\/span>video_device_node_name<\/h4>\n<p>const char *video_device_node_name(struct video_device *vdev) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u8fd4\u56de\u89c6\u9891\u8bbe\u5907\u540d\u79f0<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct video_device *vdev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411 struct video_device \u7684\u6307\u9488<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u8fd4\u56de\u8bbe\u5907\u540d\u79f0\u5b57\u7b26\u4e32<\/span><\/span><\/p>\n<h4 id=\"1.28.%20video_is_registered\" style=\"text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">1.28. <\/span><\/span>video_is_registered<\/h4>\n<p>int video_is_registered(struct video_device *vdev) <\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u5982\u679c struct video_device \u5df2\u6ce8\u518c&#xff0c;\u5219\u8fd4\u56de true\u3002<\/p>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u53c2\u6570<\/span><\/span><\/p>\n<ul style=\"margin-left:.8em;margin-right:.8em\">\n<li>\n<p style=\"margin-left:.5rem;margin-right:0\">struct video_device *vdev<\/p>\n<p style=\"margin-left:.5rem;margin-right:.5rem\">\u6307\u5411 struct video_device \u7684\u6307\u9488<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-left:.8em;margin-right:.8em;text-align:start\"><span style=\"color:#333333\"><span style=\"background-color:#ffffff\">\u63cf\u8ff0<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55<br \/>\n1.1. \u679a\u4e3e vfl_devnode_type<br \/>\n1.2. \u679a\u4e3e vfl_devnode_direction<br \/>\n1.3. \u679a\u4e3e v4l2_video_device_flags<br \/>\n1.4. \u7ed3\u6784\u4f53 v4l2_prio_state<br \/>\n1.5. v4l2_prio_init<br \/>\n1.6. v4l2_prio_change<br \/>\n1.7. v4l2_prio_open<br \/>\n1.8. v4l2_prio_close<br \/>\n1.9. v4l2_prio_max<br \/>\n1.10. v4l2_pr<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8100,8101,58],"topic":[],"class_list":["post-75867","post","type-post","status-publish","format-standard","hentry","category-server","tag-v4l2","tag-8101","tag-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010V4L2\u30111.video_device \u51fd\u6570\u548c\u6570\u636e\u7ed3\u6784 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/75867.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010V4L2\u30111.video_device \u51fd\u6570\u548c\u6570\u636e\u7ed3\u6784 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u76ee\u5f55 1.1. \u679a\u4e3e vfl_devnode_type 1.2. \u679a\u4e3e vfl_devnode_direction 1.3. \u679a\u4e3e v4l2_video_device_flags 1.4. \u7ed3\u6784\u4f53 v4l2_prio_state 1.5. v4l2_prio_init 1.6. v4l2_prio_change 1.7. v4l2_prio_open 1.8. v4l2_prio_close 1.9. v4l2_prio_max 1.10. v4l2_pr\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/75867.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-13T03:25:48+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/75867.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/75867.html\",\"name\":\"\u3010V4L2\u30111.video_device \u51fd\u6570\u548c\u6570\u636e\u7ed3\u6784 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-13T03:25:48+00:00\",\"dateModified\":\"2026-02-13T03:25:48+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/75867.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/75867.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/75867.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010V4L2\u30111.video_device \u51fd\u6570\u548c\u6570\u636e\u7ed3\u6784\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010V4L2\u30111.video_device \u51fd\u6570\u548c\u6570\u636e\u7ed3\u6784 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/75867.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010V4L2\u30111.video_device \u51fd\u6570\u548c\u6570\u636e\u7ed3\u6784 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u76ee\u5f55 1.1. \u679a\u4e3e vfl_devnode_type 1.2. \u679a\u4e3e vfl_devnode_direction 1.3. \u679a\u4e3e v4l2_video_device_flags 1.4. \u7ed3\u6784\u4f53 v4l2_prio_state 1.5. v4l2_prio_init 1.6. v4l2_prio_change 1.7. v4l2_prio_open 1.8. v4l2_prio_close 1.9. v4l2_prio_max 1.10. v4l2_pr","og_url":"https:\/\/www.wsisp.com\/helps\/75867.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-13T03:25:48+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/75867.html","url":"https:\/\/www.wsisp.com\/helps\/75867.html","name":"\u3010V4L2\u30111.video_device \u51fd\u6570\u548c\u6570\u636e\u7ed3\u6784 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-13T03:25:48+00:00","dateModified":"2026-02-13T03:25:48+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/75867.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/75867.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/75867.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010V4L2\u30111.video_device \u51fd\u6570\u548c\u6570\u636e\u7ed3\u6784"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/75867","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=75867"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/75867\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=75867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=75867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=75867"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=75867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}