Skip to contentSkip to conversation

Webcam LED control regression

PATCH In review Poncho 4 participants 12 messages Jun 5, 2023 – Jun 24, 2023

Subsystems (3)
lore
Share & tools
lore

Poncho

author
#0 lore raw

With kernel 6.3, the LED of my C922 Pro Stream Webcam is no longer controllable.

With kernel 6.1 v4l2-ctl --all returns:

Quoted 5 lines

led1_mode 0x0a046d05 (menu) : min=0 max=3 default=0 value=0 (Off)

	0: Off
	1: On
	2: Blink
	3: Auto

but with kernel 6.3 I get:

Quoted 2 lines

led1_mode 0x0a046d05 (menu) : min=4 max=4 default=0 value=0

	4:

Full output bellow:

Quoted 85 lines

Driver Info:

	Driver name      : uvcvideo
	Card type        : C922 Pro Stream Webcam
	Bus info         : usb-0000:00:14.0-9
	Driver version   : 6.3.5
	Capabilities     : 0x84a00001

Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:

	Driver name      : uvcvideo
	Model            : C922 Pro Stream Webcam
	Serial           : 6E8DF1BF
	Bus info         : usb-0000:00:14.0-9
	Media version    : 6.3.5
	Hardware revision: 0x00000016 (22)
	Driver version   : 6.3.5
Interface Info:
	ID               : 0x03000002
	Type             : V4L Video
Entity Info:
	ID               : 0x00000001 (1)
	Name             : C922 Pro Stream Webcam
	Function         : V4L2 I/O
	Flags            : default
	Pad 0x01000007   : 0: Sink
	  Link 0x0200001f: from remote pad 0x100000a of entity 'Processing 3' (Video Pixel Formatter): Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
	Width/Height      : 160/90
	Pixel Format      : 'YUYV' (YUYV 4:2:2)
	Field             : None
	Bytes per Line    : 320
	Size Image        : 28800
	Colorspace        : sRGB

Transfer Function : Rec. 709
YCbCr/HSV Encoding: ITU-R 601
Quantization : Default (maps to Limited Range)
Flags :
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 160, Height 90
Default : Left 0, Top 0, Width 160, Height 90
Pixel Aspect: 1/1
Selection Video Capture: crop_default, Left 0, Top 0, Width 160, Height 90, Flags: Selection Video Capture: crop_bounds, Left 0, Top 0, Width 160, Height 90, Flags: Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 30.000 (30/1)
Read buffers : 0

User Controls

                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=128
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=128 value=128
                     saturation 0x00980902 (int)    : min=0 max=255 step=1 default=128 value=128
        white_balance_automatic 0x0098090c (bool)   : default=1 value=1
                           gain 0x00980913 (int)    : min=0 max=255 step=1 default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=2 value=2 (60 Hz)
				0: Disabled
				1: 50 Hz
				2: 60 Hz
      white_balance_temperature 0x0098091a (int)    : min=2000 max=6500 step=1 default=4000 value=4000 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=255 step=1 default=128 value=128
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=0 value=0

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=3 value=3 (Aperture Priority Mode)
				1: Manual Mode
				3: Aperture Priority Mode
         exposure_time_absolute 0x009a0902 (int)    : min=3 max=2047 step=1 default=250 value=250 flags=inactive
     exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=1
                   pan_absolute 0x009a0908 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                  tilt_absolute 0x009a0909 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                 focus_absolute 0x009a090a (int)    : min=0 max=250 step=5 default=0 value=0 flags=inactive
     focus_automatic_continuous 0x009a090c (bool)   : default=1 value=1
                  zoom_absolute 0x009a090d (int)    : min=100 max=500 step=1 default=100 value=100
                      led1_mode 0x0a046d05 (menu)   : min=4 max=4 default=0 value=0
				4: 
                 led1_frequency 0x0a046d06 (int)    : min=0 max=255 step=1 default=0 value=255
#1 lore raw

CCing a few people and lists that should be aware of this and might be able to help.

Quoted 13 lines · Poncho

With kernel 6.3, the LED of my C922 Pro Stream Webcam is no longer controllable.

With kernel 6.1 v4l2-ctl --all returns:

Quoted 5 lines

led1_mode 0x0a046d05 (menu)   : min=0 max=3 default=0 value=0 (Off) 0: Off
    1: On
    2: Blink
    3: Auto

Quoted 4 lines

but with kernel 6.3 I get:

Quoted 2 lines

led1_mode 0x0a046d05 (menu)   : min=4 max=4 default=0 value=0 4:

Thanks for the report.

FWIW, maybe one of those people that I CCed has an idea what's wrong. If none of them brings one to the table withing the next two or three days, you likely have to perform a bisection to find the change that broke thing for you.

For the rest of this mail:

[TLDR: I'm adding this report to the list of tracked Linux kernel regressions; the text you find below is based on a few templates paragraphs you might have encountered already in similar form. See link in footer if these mails annoy you.]

Quoted 104 lines

Full output bellow:

Quoted 102 lines

Driver Info:
    Driver name      : uvcvideo
    Card type        : C922 Pro Stream Webcam
    Bus info         : usb-0000:00:14.0-9
    Driver version   : 6.3.5
    Capabilities     : 0x84a00001
        Video Capture
        Metadata Capture
        Streaming
        Extended Pix Format
        Device Capabilities
    Device Caps      : 0x04200001
        Video Capture
        Streaming
        Extended Pix Format
Media Driver Info:
    Driver name      : uvcvideo
    Model            : C922 Pro Stream Webcam
    Serial           : 6E8DF1BF
    Bus info         : usb-0000:00:14.0-9
    Media version    : 6.3.5
    Hardware revision: 0x00000016 (22)
    Driver version   : 6.3.5
Interface Info:
    ID               : 0x03000002
    Type             : V4L Video
Entity Info:
    ID               : 0x00000001 (1)
    Name             : C922 Pro Stream Webcam
    Function         : V4L2 I/O
    Flags            : default
    Pad 0x01000007   : 0: Sink
      Link 0x0200001f: from remote pad 0x100000a of entity 'Processing 3' (Video Pixel Formatter): Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
    Width/Height      : 160/90
    Pixel Format      : 'YUYV' (YUYV 4:2:2)
    Field             : None
    Bytes per Line    : 320
    Size Image        : 28800
    Colorspace        : sRGB
    Transfer Function : Rec. 709
    YCbCr/HSV Encoding: ITU-R 601
    Quantization      : Default (maps to Limited Range) Flags             : Crop Capability Video Capture:
    Bounds      : Left 0, Top 0, Width 160, Height 90 Default     : Left 0, Top 0, Width 160, Height 90
    Pixel Aspect: 1/1
Selection Video Capture: crop_default, Left 0, Top 0, Width 160, Height 90, Flags: Selection Video Capture: crop_bounds, Left 0, Top 0, Width 160, Height 90, Flags: Streaming Parameters Video Capture:
    Capabilities     : timeperframe
    Frames per second: 30.000 (30/1)
    Read buffers     : 0

User Controls

                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=128
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=128 value=128
                     saturation 0x00980902 (int)    : min=0 max=255 step=1 default=128 value=128
        white_balance_automatic 0x0098090c (bool)   : default=1 value=1 gain 0x00980913 (int)    : min=0 max=255 step=1 default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=2 value=2 (60 Hz)
                0: Disabled
                1: 50 Hz
                2: 60 Hz
      white_balance_temperature 0x0098091a (int)    : min=2000 max=6500 step=1 default=4000 value=4000 flags=inactive sharpness 0x0098091b (int)    : min=0 max=255 step=1 default=128 value=128
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=0 value=0

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=3 value=3 (Aperture Priority Mode)
                1: Manual Mode
                3: Aperture Priority Mode exposure_time_absolute 0x009a0902 (int)    : min=3 max=2047 step=1 default=250 value=250 flags=inactive exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=1 pan_absolute 0x009a0908 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                  tilt_absolute 0x009a0909 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                 focus_absolute 0x009a090a (int)    : min=0 max=250 step=5 default=0 value=0 flags=inactive focus_automatic_continuous 0x009a090c (bool)   : default=1 value=1 zoom_absolute 0x009a090d (int)    : min=100 max=500 step=1 default=100 value=100
                      led1_mode 0x0a046d05 (menu)   : min=4 max=4 default=0 value=0
                4:                  led1_frequency 0x0a046d06 (int) : min=0 max=255 step=1 default=0 value=255

To be sure the issue doesn't fall through the cracks unnoticed, I'm adding it to regzbot, the Linux kernel regression tracking bot:

#regzbot ^introduced v6.1..v6.3
#regzbot title media: uvcvideo: Webcam LED control regression #regzbot ignore-activity

This isn't a regression? This issue or a fix for it are already discussed somewhere else? It was fixed already? You want to clarify when the regression started to happen? Or point out I got the title or something else totally wrong? Then just reply and tell me -- ideally while also telling regzbot about it, as explained by the page listed in the footer of this mail.

Developers: When fixing the issue, remember to add 'Link:' tags pointing to the report (the parent of this mail). See page linked in footer for details.

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
That page also explains what to do if mails like this annoy you.

maintainer
#2 lore raw

Hello,

CC'ing Ricardo.

Quoted 22 lines · Linux regression tracking (Thorsten Leemhuis)

CCing a few people and lists that should be aware of this and might be able to help.

Quoted 13 lines · Poncho

With kernel 6.3, the LED of my C922 Pro Stream Webcam is no longer controllable.

With kernel 6.1 v4l2-ctl --all returns:

Quoted 5 lines

led1_mode 0x0a046d05 (menu)   : min=0 max=3 default=0 value=0 (Off) 0: Off
    1: On
    2: Blink
    3: Auto

Quoted 4 lines

but with kernel 6.3 I get:

Quoted 2 lines

led1_mode 0x0a046d05 (menu)   : min=4 max=4 default=0 value=0 4:

Quoted 6 lines

Thanks for the report.

FWIW, maybe one of those people that I CCed has an idea what's wrong. If none of them brings one to the table withing the next two or three days, you likely have to perform a bisection to find the change that broke thing for you.

I suspect commit 716c330433e3 ("media: uvcvideo: Use standard names for menus") to be the culprit. I'll post a (untested) candidate fix in reply to this e-mail.

Quoted 119 lines

For the rest of this mail:

[TLDR: I'm adding this report to the list of tracked Linux kernel regressions; the text you find below is based on a few templates paragraphs you might have encountered already in similar form. See link in footer if these mails annoy you.]

Quoted 88 lines

Full output bellow:

Quoted 86 lines

Driver Info:
    Driver name      : uvcvideo
    Card type        : C922 Pro Stream Webcam
    Bus info         : usb-0000:00:14.0-9
    Driver version   : 6.3.5
    Capabilities     : 0x84a00001
        Video Capture
        Metadata Capture
        Streaming
        Extended Pix Format
        Device Capabilities
    Device Caps      : 0x04200001
        Video Capture
        Streaming
        Extended Pix Format
Media Driver Info:
    Driver name      : uvcvideo
    Model            : C922 Pro Stream Webcam
    Serial           : 6E8DF1BF
    Bus info         : usb-0000:00:14.0-9
    Media version    : 6.3.5
    Hardware revision: 0x00000016 (22)
    Driver version   : 6.3.5
Interface Info:
    ID               : 0x03000002
    Type             : V4L Video
Entity Info:
    ID               : 0x00000001 (1)
    Name             : C922 Pro Stream Webcam
    Function         : V4L2 I/O
    Flags            : default
    Pad 0x01000007   : 0: Sink
      Link 0x0200001f: from remote pad 0x100000a of entity 'Processing 3' (Video Pixel Formatter): Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
    Width/Height      : 160/90
    Pixel Format      : 'YUYV' (YUYV 4:2:2)
    Field             : None
    Bytes per Line    : 320
    Size Image        : 28800
    Colorspace        : sRGB
    Transfer Function : Rec. 709
    YCbCr/HSV Encoding: ITU-R 601
    Quantization      : Default (maps to Limited Range)
    Flags             : Crop Capability Video Capture:
    Bounds      : Left 0, Top 0, Width 160, Height 90
    Default     : Left 0, Top 0, Width 160, Height 90
    Pixel Aspect: 1/1
Selection Video Capture: crop_default, Left 0, Top 0, Width 160,
Height 90, Flags: Selection Video Capture: crop_bounds, Left 0, Top 0,
Width 160, Height 90, Flags: Streaming Parameters Video Capture:
    Capabilities     : timeperframe
    Frames per second: 30.000 (30/1)
    Read buffers     : 0

User Controls

                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=128 contrast 0x00980901 (int)    : min=0 max=255 step=1 default=128 value=128 saturation 0x00980902 (int)    : min=0 max=255 step=1 default=128 value=128 white_balance_automatic 0x0098090c (bool)   : default=1 value=1
                           gain 0x00980913 (int)    : min=0 max=255 step=1 default=0 value=0 power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=2 value=2 (60 Hz)
                0: Disabled
                1: 50 Hz
                2: 60 Hz
      white_balance_temperature 0x0098091a (int)    : min=2000 max=6500 step=1 default=4000 value=4000 flags=inactive sharpness 0x0098091b (int)    : min=0 max=255 step=1 default=128 value=128 backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=0 value=0

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=3 value=3 (Aperture Priority Mode) 1: Manual Mode
                3: Aperture Priority Mode
         exposure_time_absolute 0x009a0902 (int)    : min=3 max=2047 step=1 default=250 value=250 flags=inactive exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=1
                   pan_absolute 0x009a0908 (int)    : min=-36000 max=36000 step=3600 default=0 value=0 tilt_absolute 0x009a0909 (int)    : min=-36000 max=36000 step=3600 default=0 value=0 focus_absolute 0x009a090a (int)    : min=0 max=250 step=5 default=0 value=0 flags=inactive focus_automatic_continuous 0x009a090c (bool)   : default=1 value=1
                  zoom_absolute 0x009a090d (int)    : min=100 max=500 step=1 default=100 value=100 led1_mode 0x0a046d05 (menu)   : min=4 max=4 default=0 value=0
                4:                  led1_frequency 0x0a046d06 (int)
: min=0 max=255 step=1 default=0 value=255

To be sure the issue doesn't fall through the cracks unnoticed, I'm adding it to regzbot, the Linux kernel regression tracking bot:

#regzbot ^introduced v6.1..v6.3
#regzbot title media: uvcvideo: Webcam LED control regression #regzbot ignore-activity

This isn't a regression? This issue or a fix for it are already discussed somewhere else? It was fixed already? You want to clarify when the regression started to happen? Or point out I got the title or something else totally wrong? Then just reply and tell me -- ideally while also telling regzbot about it, as explained by the page listed in the footer of this mail.

Developers: When fixing the issue, remember to add 'Link:' tags pointing to the report (the parent of this mail). See page linked in footer for details.

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
That page also explains what to do if mails like this annoy you.

Signature · 3 lines
Regards,

Laurent Pinchart
maintainer
#3 lore raw

PATCH 1/1 media: uvcvideo: Fix menu count handling for userspace XU mappings

When commit 716c330433e3 ("media: uvcvideo: Use standard names for menus") reworked the handling of menu controls, it inadvertently replaced a GENMASK(n - 1, 0) with a BIT_MASK(n). The latter isn't equivalent to the former, which broke adding XU mappings from userspace. Fix it.

Fixes 716c330433e3 ("media: uvcvideo: Use standard names for menus")

---
This is untested. Poncho, would you be able to test this patch to see if it fixes your issue ?

---
 drivers/media/usb/uvc/uvc_v4l2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_v4l2.c +1 -1
index 5ac2a424b13d..f4988f03640a 100644
@@ -45,7 +45,7 @@ static int uvc_control_add_xu_mapping(struct uvc_video_chain *chain,
 	map->menu_names = NULL;
 	map->menu_mapping = NULL;
 
-	map->menu_mask = BIT_MASK(xmap->menu_count);
+	map->menu_mask = GENMASK(xmap->menu_count - 1, 0);
 
 	size = xmap->menu_count * sizeof(*map->menu_mapping);
 	map->menu_mapping = kzalloc(size, GFP_KERNEL);
Signature · 3 lines
Regards,

Laurent Pinchart
author
#4 lore raw

Re: [PATCH] media: uvcvideo: Fix menu count handling for userspace XU mappings

Quoted 2 lines · Laurent Pinchart

This is untested. Poncho, would you be able to test this patch to see if it fixes your issue ?

Yes, your patch on top of 6.3.6 does fix my issue.

Reviewed-by on v1 1/1
#5 lore raw

Re: [PATCH] media: uvcvideo: Fix menu count handling for userspace XU mappings

In reply to Laurent Pinchart

Hi Laurent

Quoted 6 lines · Laurent Pinchart

When commit 716c330433e3 ("media: uvcvideo: Use standard names for menus") reworked the handling of menu controls, it inadvertently replaced a GENMASK(n - 1, 0) with a BIT_MASK(n). The latter isn't equivalent to the former, which broke adding XU mappings from userspace. Fix it.

Ups, that was wrong :), sorry about that

Thanks for the quick fix.

Quoted 5 lines
Fixes 716c330433e3 ("media: uvcvideo: Use standard names for menus")
Quoted 25 lines

---
This is untested. Poncho, would you be able to test this patch to see if it fixes your issue ?

---
 drivers/media/usb/uvc/uvc_v4l2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_v4l2.c +1 -2
index 5ac2a424b13d..f4988f03640a 100644
@@ -45,7 +45,7 @@ static int uvc_control_add_xu_mapping(struct uvc_video_chain *chain,
        map->menu_names = NULL;
        map->menu_mapping = NULL;
 
-       map->menu_mask = BIT_MASK(xmap->menu_count);
+       map->menu_mask = GENMASK(xmap->menu_count - 1, 0);
 
        size = xmap->menu_count * sizeof(*map->menu_mapping);
        map->menu_mapping = kzalloc(size, GFP_KERNEL);
--

Regards,

Laurent Pinchart

Signature · 1 line
Ricardo Ribalda
#6 lore raw

Re: [PATCH] media: uvcvideo: Fix menu count handling for userspace XU mappings

In reply to Laurent Pinchart
Quoted 9 lines · Laurent Pinchart

When commit 716c330433e3 ("media: uvcvideo: Use standard names for menus") reworked the handling of menu controls, it inadvertently replaced a GENMASK(n - 1, 0) with a BIT_MASK(n). The latter isn't equivalent to the former, which broke adding XU mappings from userspace. Fix it.

Fixes 716c330433e3 ("media: uvcvideo: Use standard names for menus")

Many thx for looking into this. Please consider adding

to get this fixed in 6.3.y, as a fixes tag alone is not enough to guarantee a backport attempt by the stable team.

Ciao, Thorsten

Quoted 21 lines

---
This is untested. Poncho, would you be able to test this patch to see if it fixes your issue ?

---
 drivers/media/usb/uvc/uvc_v4l2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_v4l2.c +1 -1
index 5ac2a424b13d..f4988f03640a 100644
@@ -45,7 +45,7 @@ static int uvc_control_add_xu_mapping(struct uvc_video_chain *chain,
 	map->menu_names = NULL;
 	map->menu_mapping = NULL;
 
-	map->menu_mask = BIT_MASK(xmap->menu_count);
+	map->menu_mask = GENMASK(xmap->menu_count - 1, 0);
 
 	size = xmap->menu_count * sizeof(*map->menu_mapping);
 	map->menu_mapping = kzalloc(size, GFP_KERNEL);
author
#7 lore raw

Re: [PATCH] media: uvcvideo: Fix menu count handling for userspace XU mappings

In reply to Laurent Pinchart

Hi Laurent

Friendly ping. I think this patch was forgotten.

Best regards,
Poncho

Quoted 30 lines · Laurent Pinchart

When commit 716c330433e3 ("media: uvcvideo: Use standard names for menus") reworked the handling of menu controls, it inadvertently replaced a GENMASK(n - 1, 0) with a BIT_MASK(n). The latter isn't equivalent to the former, which broke adding XU mappings from userspace. Fix it.

Fixes 716c330433e3 ("media: uvcvideo: Use standard names for menus")

---
This is untested. Poncho, would you be able to test this patch to see if it fixes your issue ?

---
  drivers/media/usb/uvc/uvc_v4l2.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_v4l2.c +1 -1
index 5ac2a424b13d..f4988f03640a 100644
@@ -45,7 +45,7 @@ static int uvc_control_add_xu_mapping(struct uvc_video_chain *chain,
  	map->menu_names = NULL;
  	map->menu_mapping = NULL;
 
-	map->menu_mask = BIT_MASK(xmap->menu_count);
+	map->menu_mask = GENMASK(xmap->menu_count - 1, 0);
 
  	size = xmap->menu_count * sizeof(*map->menu_mapping);
  	map->menu_mapping = kzalloc(size, GFP_KERNEL);
maintainer
#8 lore raw

Re: [PATCH] media: uvcvideo: Fix menu count handling for userspace XU mappings

Hello,

Quoted 3 lines · Poncho

Hi Laurent

Friendly ping. I think this patch was forgotten.

Thanks for the reminder. I'll send a pull request for v6.6.

Quoted 31 lines · Laurent Pinchart
Quoted 30 lines

When commit 716c330433e3 ("media: uvcvideo: Use standard names for menus") reworked the handling of menu controls, it inadvertently replaced a GENMASK(n - 1, 0) with a BIT_MASK(n). The latter isn't equivalent to the former, which broke adding XU mappings from userspace. Fix it.

Fixes 716c330433e3 ("media: uvcvideo: Use standard names for menus")

---
This is untested. Poncho, would you be able to test this patch to see if it fixes your issue ?

---
  drivers/media/usb/uvc/uvc_v4l2.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_v4l2.c +1 -1
index 5ac2a424b13d..f4988f03640a 100644
@@ -45,7 +45,7 @@ static int uvc_control_add_xu_mapping(struct uvc_video_chain *chain,
  	map->menu_names = NULL;
  	map->menu_mapping = NULL;
 
-	map->menu_mask = BIT_MASK(xmap->menu_count);
+	map->menu_mask = GENMASK(xmap->menu_count - 1, 0);
 
  	size = xmap->menu_count * sizeof(*map->menu_mapping);
  	map->menu_mapping = kzalloc(size, GFP_KERNEL);
Signature · 3 lines
Regards,

Laurent Pinchart
#9 lore raw

Re: [PATCH] media: uvcvideo: Fix menu count handling for userspace XU mappings

Quoted 6 lines · Laurent Pinchart
Quoted 3 lines · Poncho

Hi Laurent

Friendly ping. I think this patch was forgotten.

Thanks for the reminder. I'll send a pull request for v6.6.

Why 6.6? If this would be a feature I'd fully understand. But this afaics fixes a regression and thus should be handled as one, even if it's a regression from a earlier release. For details see this recent mail from Linus:

https://lore.kernel.org/all/CAHk-=wis_qQy4oDNynNKi5b7Qhosmxtoj1jxo5wmB6SRUwQUBQ@mail.gmail.com/

Side note: as it's a regression it would be good if this commit had a "CC: <stable..." tag as well.

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

Quoted 32 lines
Quoted 31 lines · Laurent Pinchart
Quoted 30 lines

When commit 716c330433e3 ("media: uvcvideo: Use standard names for menus") reworked the handling of menu controls, it inadvertently replaced a GENMASK(n - 1, 0) with a BIT_MASK(n). The latter isn't equivalent to the former, which broke adding XU mappings from userspace. Fix it.

Fixes 716c330433e3 ("media: uvcvideo: Use standard names for menus")

---
This is untested. Poncho, would you be able to test this patch to see if it fixes your issue ?

---
  drivers/media/usb/uvc/uvc_v4l2.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_v4l2.c +1 -1
index 5ac2a424b13d..f4988f03640a 100644
@@ -45,7 +45,7 @@ static int uvc_control_add_xu_mapping(struct uvc_video_chain *chain,
  	map->menu_names = NULL;
  	map->menu_mapping = NULL;
 
-	map->menu_mask = BIT_MASK(xmap->menu_count);
+	map->menu_mask = GENMASK(xmap->menu_count - 1, 0);
 
  	size = xmap->menu_count * sizeof(*map->menu_mapping);
  	map->menu_mapping = kzalloc(size, GFP_KERNEL);
maintainer
#10 lore raw

Re: [PATCH] media: uvcvideo: Fix menu count handling for userspace XU mappings

Hi Thorsten,

Quoted 5 lines · Thorsten Leemhuis
Quoted 4 lines · Laurent Pinchart
Quoted 3 lines · Poncho

Hi Laurent

Friendly ping. I think this patch was forgotten.

Quoted 8 lines
Quoted 1 line

Thanks for the reminder. I'll send a pull request for v6.6.

Why 6.6? If this would be a feature I'd fully understand. But this afaics fixes a regression and thus should be handled as one, even if it's a regression from a earlier release. For details see this recent mail from Linus:

https://lore.kernel.org/all/CAHk-=wis_qQy4oDNynNKi5b7Qhosmxtoj1jxo5wmB6SRUwQUBQ@mail.gmail.com/

Linus has decided to not pull from the media tree for the next kernel release due to a set of mishaps, see
https://lore.kernel.org/linux-media/CAHk-=wgzU8_dGn0Yg+DyX7ammTkDUCyEJ4C=NvnHRhxKWC7Wpw@mail.gmail.com/.
Re-reading the mail, fixes should be fine even if the issue has been there for several releases. I'll send send a pull request for v6.5.

Quoted 2 lines

Side note: as it's a regression it would be good if this commit had a "CC: <stable..." tag as well.

I've already added that to my tree.

Quoted 37 lines

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

Quoted 31 lines
Quoted 31 lines · Laurent Pinchart
Quoted 30 lines

When commit 716c330433e3 ("media: uvcvideo: Use standard names for menus") reworked the handling of menu controls, it inadvertently replaced a GENMASK(n - 1, 0) with a BIT_MASK(n). The latter isn't equivalent to the former, which broke adding XU mappings from userspace. Fix it.

Fixes 716c330433e3 ("media: uvcvideo: Use standard names for menus")

---
This is untested. Poncho, would you be able to test this patch to see if it fixes your issue ?

---
  drivers/media/usb/uvc/uvc_v4l2.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_v4l2.c +1 -1
index 5ac2a424b13d..f4988f03640a 100644
@@ -45,7 +45,7 @@ static int uvc_control_add_xu_mapping(struct uvc_video_chain *chain,
  	map->menu_names = NULL;
  	map->menu_mapping = NULL;
 
-	map->menu_mask = BIT_MASK(xmap->menu_count);
+	map->menu_mask = GENMASK(xmap->menu_count - 1, 0);
 
  	size = xmap->menu_count * sizeof(*map->menu_mapping);
  	map->menu_mapping = kzalloc(size, GFP_KERNEL);
Signature · 3 lines
Regards,

Laurent Pinchart
#11 lore raw

Re: [PATCH] media: uvcvideo: Fix menu count handling for userspace XU mappings

Quoted 11 lines · Laurent Pinchart
Quoted 10 lines · Thorsten Leemhuis
Quoted 3 lines · Laurent Pinchart
Quoted 1 line · Poncho

Friendly ping. I think this patch was forgotten.

Thanks for the reminder. I'll send a pull request for v6.6.

Why 6.6? If this would be a feature I'd fully understand. But this afaics fixes a regression and thus should be handled as one, even if it's a regression from a earlier release. For details see this recent mail from Linus:

Quoted 5 lines
Quoted 1 line

https://lore.kernel.org/all/CAHk-=wis_qQy4oDNynNKi5b7Qhosmxtoj1jxo5wmB6SRUwQUBQ@mail.gmail.com/

Linus has decided to not pull from the media tree for the next kernel release due to a set of mishaps, see
https://lore.kernel.org/linux-media/CAHk-=wgzU8_dGn0Yg+DyX7ammTkDUCyEJ4C=NvnHRhxKWC7Wpw@mail.gmail.com/.

Yeah, I remember.

Quoted 1 line

Re-reading the mail, fixes should be fine

Yup, he even pulled some fixes during this cycle.

Quoted 2 lines

even if the issue has been
there for several releases. I'll send send a pull request for v6.5.

Great, thx!

Quoted 3 lines
Quoted 2 lines

Side note: as it's a regression it would be good if this commit had a "CC: <stable..." tag as well.

I've already added that to my tree.

Thx, too!

Ciao, Thorsten

Quoted 38 lines
Quoted 37 lines

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

Quoted 31 lines
Quoted 31 lines · Laurent Pinchart
Quoted 30 lines

When commit 716c330433e3 ("media: uvcvideo: Use standard names for menus") reworked the handling of menu controls, it inadvertently replaced a GENMASK(n - 1, 0) with a BIT_MASK(n). The latter isn't equivalent to the former, which broke adding XU mappings from userspace. Fix it.

Fixes 716c330433e3 ("media: uvcvideo: Use standard names for menus")

---
This is untested. Poncho, would you be able to test this patch to see if it fixes your issue ?

---
  drivers/media/usb/uvc/uvc_v4l2.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_v4l2.c +1 -1
index 5ac2a424b13d..f4988f03640a 100644
@@ -45,7 +45,7 @@ static int uvc_control_add_xu_mapping(struct uvc_video_chain *chain,
  	map->menu_names = NULL;
  	map->menu_mapping = NULL;
 
-	map->menu_mask = BIT_MASK(xmap->menu_count);
+	map->menu_mask = GENMASK(xmap->menu_count - 1, 0);
 
  	size = xmap->menu_count * sizeof(*map->menu_mapping);
  	map->menu_mapping = kzalloc(size, GFP_KERNEL);