Some applications need to check if there is an input device on the camera before proceeding to the next step. When there is no input device, the application will report an error. Create input device for all uvc devices with status endpoints. and only when bTriggerSupport and bTriggerUsage are one are allowed to report camera button.
Fixes: 3bc22dc66a4f ("media: uvcvideo: Only create input devs if hw supports it") Signed-off-by: chenchangcheng ccc194101@163.com --- drivers/media/usb/uvc/uvc_status.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c index a78a88c710e2..177640c6a813 100644 --- a/drivers/media/usb/uvc/uvc_status.c +++ b/drivers/media/usb/uvc/uvc_status.c @@ -44,9 +44,6 @@ static int uvc_input_init(struct uvc_device *dev) struct input_dev *input; int ret;
- if (!uvc_input_has_button(dev)) - return 0; - input = input_allocate_device(); if (input == NULL) return -ENOMEM; @@ -110,10 +107,12 @@ static void uvc_event_streaming(struct uvc_device *dev, if (len <= offsetof(struct uvc_status, streaming)) return;
- uvc_dbg(dev, STATUS, "Button (intf %u) %s len %d\n", - status->bOriginator, - status->streaming.button ? "pressed" : "released", len); - uvc_input_report_key(dev, KEY_CAMERA, status->streaming.button); + if (uvc_input_has_button(dev)) { + uvc_dbg(dev, STATUS, "Button (intf %u) %s len %d\n", + status->bOriginator, + status->streaming.button ? "pressed" : "released", len); + uvc_input_report_key(dev, KEY_CAMERA, status->streaming.button); + } } else { uvc_dbg(dev, STATUS, "Stream %u error event %02x len %d\n", status->bOriginator, status->bEvent, len);
Hi,
Thanks for your patch.
FYI: kernel test robot notices the stable kernel rule is not satisfied.
The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#opti...
Rule: add the tag "Cc: stable@vger.kernel.org" in the sign-off area to have the patch automatically included in the stable tree. Subject: [PATCH] media: uvcvideo:Create input device for all uvc devices with status endpoints. Link: https://lore.kernel.org/stable/20241104023947.826707-1-ccc194101%40163.com
Hi chenchangcheng,
kernel test robot noticed the following build errors:
[auto build test ERROR on linuxtv-media-stage/master] [also build test ERROR on linus/master media-tree/master v6.12-rc6 next-20241101] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/chenchangcheng/media-uvcvideo... base: https://git.linuxtv.org/media_stage.git master patch link: https://lore.kernel.org/r/20241104023947.826707-1-ccc194101%40163.com patch subject: [PATCH] media: uvcvideo:Create input device for all uvc devices with status endpoints. config: i386-buildonly-randconfig-003-20241104 (https://download.01.org/0day-ci/archive/20241104/202411041600.0u4Yj3kT-lkp@i...) compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241104/202411041600.0u4Yj3kT-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202411041600.0u4Yj3kT-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/media/usb/uvc/uvc_status.c:16: In file included from drivers/media/usb/uvc/uvcvideo.h:17: In file included from include/media/media-device.h:16: In file included from include/linux/pci.h:1650: In file included from include/linux/dmapool.h:14: In file included from include/linux/scatterlist.h:8: In file included from include/linux/mm.h:2213: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~
drivers/media/usb/uvc/uvc_status.c:110:7: error: call to undeclared function 'uvc_input_has_button'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
110 | if (uvc_input_has_button(dev)) { | ^ 1 warning and 1 error generated.
Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for MODVERSIONS Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y] Selected by [y]: - RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=y] || GCC_PLUGINS [=n]) && MODULES [=y]
vim +/uvc_input_has_button +110 drivers/media/usb/uvc/uvc_status.c
93 94 /* -------------------------------------------------------------------------- 95 * Status interrupt endpoint 96 */ 97 static void uvc_event_streaming(struct uvc_device *dev, 98 struct uvc_status *status, int len) 99 { 100 if (len <= offsetof(struct uvc_status, bEvent)) { 101 uvc_dbg(dev, STATUS, 102 "Invalid streaming status event received\n"); 103 return; 104 } 105 106 if (status->bEvent == 0) { 107 if (len <= offsetof(struct uvc_status, streaming)) 108 return; 109
110 if (uvc_input_has_button(dev)) {
111 uvc_dbg(dev, STATUS, "Button (intf %u) %s len %d\n", 112 status->bOriginator, 113 status->streaming.button ? "pressed" : "released", len); 114 uvc_input_report_key(dev, KEY_CAMERA, status->streaming.button); 115 } 116 } else { 117 uvc_dbg(dev, STATUS, "Stream %u error event %02x len %d\n", 118 status->bOriginator, status->bEvent, len); 119 } 120 } 121
Em Mon, 4 Nov 2024 10:39:47 +0800 chenchangcheng ccc194101@163.com escreveu:
Some applications need to check if there is an input device on the camera before proceeding to the next step. When there is no input device, the application will report an error.
Nack.
It is not mandatory for V4L2 devices to create input devices.
It sounds to me that this is an application bug, not a Kernel one. What applications have such bug?
Create input device for all uvc devices with status endpoints. and only when bTriggerSupport and bTriggerUsage are one are allowed to report camera button.
Please fix the application instead.
Fixes: 3bc22dc66a4f ("media: uvcvideo: Only create input devs if hw supports it")
Regards, Mauro
Signed-off-by: chenchangcheng ccc194101@163.com
drivers/media/usb/uvc/uvc_status.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c index a78a88c710e2..177640c6a813 100644 --- a/drivers/media/usb/uvc/uvc_status.c +++ b/drivers/media/usb/uvc/uvc_status.c @@ -44,9 +44,6 @@ static int uvc_input_init(struct uvc_device *dev) struct input_dev *input; int ret;
- if (!uvc_input_has_button(dev))
return 0;
input = input_allocate_device(); if (input == NULL) return -ENOMEM; @@ -110,10 +107,12 @@ static void uvc_event_streaming(struct uvc_device *dev, if (len <= offsetof(struct uvc_status, streaming)) return;
uvc_dbg(dev, STATUS, "Button (intf %u) %s len %d\n",
status->bOriginator,
status->streaming.button ? "pressed" : "released", len);
uvc_input_report_key(dev, KEY_CAMERA, status->streaming.button);
if (uvc_input_has_button(dev)) {
uvc_dbg(dev, STATUS, "Button (intf %u) %s len %d\n",
status->bOriginator,
status->streaming.button ? "pressed" : "released", len);
uvc_input_report_key(dev, KEY_CAMERA, status->streaming.button);
} else { uvc_dbg(dev, STATUS, "Stream %u error event %02x len %d\n", status->bOriginator, status->bEvent, len);}
Thanks, Mauro
hi Mauro:
It sounds to me that this is an application bug, not a Kernel one.
What applications have such bug?
??? This is a testing application produced by a third-party company, and the modification is mainly aimed at improving compatibility.
??? And retaining nodes has no harm and is more suitable for application scenarios.
--------------
ccc194101@163.com
Em Mon,? 4 Nov 2024 10:39:47 +0800
chenchangcheng ccc194101@163.com escreveu:
Some applications need to check if there is an input device on the camera
before proceeding to the next step. When there is no input device,
the application will report an error.
Nack.
It is not mandatory for V4L2 devices to create input devices.
It sounds to me that this is an application bug, not a Kernel one.
What applications have such bug?
Create input device for all uvc devices with status endpoints.
and only when bTriggerSupport and bTriggerUsage are one are
allowed to report camera button.
Please fix the application instead.
Fixes: 3bc22dc66a4f ("media: uvcvideo: Only create input devs if hw supports it")
Regards,
Mauro
Signed-off-by: chenchangcheng ccc194101@163.com
? drivers/media/usb/uvc/uvc_status.c | 13 ++++++-------
? 1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c
index a78a88c710e2..177640c6a813 100644
--- a/drivers/media/usb/uvc/uvc_status.c
+++ b/drivers/media/usb/uvc/uvc_status.c
@@ -44,9 +44,6 @@ static int uvc_input_init(struct uvc_device *dev)
? struct input_dev *input;
? int ret;
?
- if (!uvc_input_has_button(dev))
return 0;
? input = input_allocate_device();
? if (input == NULL)
? return -ENOMEM;
@@ -110,10 +107,12 @@ static void uvc_event_streaming(struct uvc_device *dev,
? if (len <= offsetof(struct uvc_status, streaming))
? return;
?
uvc_dbg(dev, STATUS, "Button (intf %u) %s len %d\n",
status->bOriginator,
status->streaming.button ? "pressed" : "released", len);
uvc_input_report_key(dev, KEY_CAMERA, status->streaming.button);
if (uvc_input_has_button(dev)) {
uvc_dbg(dev, STATUS, "Button (intf %u) %s len %d\n",
status->bOriginator,
status->streaming.button ? "pressed" : "released", len);
uvc_input_report_key(dev, KEY_CAMERA, status->streaming.button);
}
? } else {
? uvc_dbg(dev, STATUS, "Stream %u error event %02x len %d\n",
? status->bOriginator, status->bEvent, len);
Thanks,
Mauro
Hi chenchangcheng,
kernel test robot noticed the following build errors:
[auto build test ERROR on linuxtv-media-stage/master] [also build test ERROR on linus/master v6.12-rc6 next-20241101] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/chenchangcheng/media-uvcvideo... base: https://git.linuxtv.org/media_stage.git master patch link: https://lore.kernel.org/r/20241104023947.826707-1-ccc194101%40163.com patch subject: [PATCH] media: uvcvideo:Create input device for all uvc devices with status endpoints. config: x86_64-buildonly-randconfig-001-20241104 (https://download.01.org/0day-ci/archive/20241104/202411041605.VSoO1uus-lkp@i...) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241104/202411041605.VSoO1uus-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202411041605.VSoO1uus-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/media/usb/uvc/uvc_status.c: In function 'uvc_event_streaming':
drivers/media/usb/uvc/uvc_status.c:110:21: error: implicit declaration of function 'uvc_input_has_button' [-Werror=implicit-function-declaration]
110 | if (uvc_input_has_button(dev)) { | ^~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors
vim +/uvc_input_has_button +110 drivers/media/usb/uvc/uvc_status.c
93 94 /* -------------------------------------------------------------------------- 95 * Status interrupt endpoint 96 */ 97 static void uvc_event_streaming(struct uvc_device *dev, 98 struct uvc_status *status, int len) 99 { 100 if (len <= offsetof(struct uvc_status, bEvent)) { 101 uvc_dbg(dev, STATUS, 102 "Invalid streaming status event received\n"); 103 return; 104 } 105 106 if (status->bEvent == 0) { 107 if (len <= offsetof(struct uvc_status, streaming)) 108 return; 109
110 if (uvc_input_has_button(dev)) {
111 uvc_dbg(dev, STATUS, "Button (intf %u) %s len %d\n", 112 status->bOriginator, 113 status->streaming.button ? "pressed" : "released", len); 114 uvc_input_report_key(dev, KEY_CAMERA, status->streaming.button); 115 } 116 } else { 117 uvc_dbg(dev, STATUS, "Stream %u error event %02x len %d\n", 118 status->bOriginator, status->bEvent, len); 119 } 120 } 121
linux-stable-mirror@lists.linaro.org