media: uvcvideo:Create input device for all uvc devices with status endpoints.
Subsystems (3)
PATCH 1/1 media: uvcvideo:Create input device for all uvc devices with status endpoints.
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.
--- drivers/media/usb/uvc/uvc_status.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/media/usb/uvc/uvc_status.c +6 -7
@@ -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);
base-commit: ff7afaeca1a15fbeaa2c4795ee806c0667bd77b2
Signature · 1 line
2.25.1
kernel test robot
build botFYI: kernel test robot notices the stable kernel rule is not satisfied.
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#option-1
Rule: add the tag "Cc: [email protected]" 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.
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Laurent Pinchart
maintainerHello,
Quoted 3 lines · chenchangcheng
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.
As Mauro previously mentioned, this seems to be an application issue, not a kernel issue. You should fix the application.
Quoted 43 lines
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 <[email protected]>--- drivers/media/usb/uvc/uvc_status.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)drivers/media/usb/uvc/uvc_status.c +6
-7@@ -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);base-commit:
ff7afaeca1a15fbeaa2c4795ee806c0667bd77b2
Signature · 3 lines
Regards, Laurent Pinchart