linux icon indicating copy to clipboard operation
linux copied to clipboard

Fixes for Quanta Acer HD User Facing Web camera(original code from @Giuliano69)

Open Emtyffx opened this issue 1 year ago • 4 comments

There is a problem that I and some other users encounted while not being able to turn on camera on linux. After searching for some time I have found fix created by @Giuliano69, thanking him a lot for this fix.

It will be good to merge this code into official uvc driver for not so experienced users, because they can't find the fix themselves(i also have spent some time finding the fix and applying it). And also the fix that require changing some kernel code can scare newbies.

Emtyffx avatar Apr 20 '24 16:04 Emtyffx

@gooroodev review

admsev avatar May 25 '24 14:05 admsev

1. Summary of Changes

The pull request introduces support for two models of Quanta Acer HD User Facing webcams in the uvc_driver.c file. Specifically:

  • Added support for the Quanta ACER HD User Facing camera with idProduct 0x4035.
  • Added support for the Quanta ACER HD User Facing camera with idProduct 0x4033.
  • Both entries include specific USB device information related to the camera's interface class, subclass, and protocol.

2. Issues, Bugs, or Typos

Issue 1: Comment Formatting

The comments added for the fixes are slightly inconsistent and could be more concise. Additionally, the comment block uses an unusual format with leading asterisks.

Proposed Improvement:

-	/**
-	   * Fix for the problem with cameras on Acer Nitro 5 Series.
-	   * 
-	   * Fix required for the camera here
-	   * Thanks for @Giuliano69 for providing the fix
-	  */
+	/*
+	 * Fix for the problem with cameras on Acer Nitro 5 Series.
+	 * Thanks to @Giuliano69 for providing the fix.
+	 */

Issue 2: Redundant Comment

The comment /* Fix end here */ is redundant and unnecessary.

Proposed Improvement:

-	/* Fix end here */

3. General Review of the Code Quality and Style

  • Code Quality: The code changes are straightforward and correctly add the necessary device IDs and related information for the two Quanta Acer HD User Facing cameras. The syntax and structure follow the conventions used in the surrounding code.
  • Code Style: The style is mostly consistent with the rest of the file, except for the minor comment formatting issues mentioned above.
  • Documentation: The comments provide context but could be more concise. The use of comments is appropriate to explain why these specific changes were made.
  • Maintainability: The changes are easy to understand and maintain. The added device IDs and their associated information are well-structured.

Final Code After Improvements:

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index bbd90123a4e76d..6d5e353b6135bb 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -2463,6 +2463,38 @@ static const struct usb_device_id uvc_ids[] = {
 	  .bInterfaceSubClass	= 1,
 	  .bInterfaceProtocol	= 0,
 	  .driver_info		= (kernel_ulong_t)&uvc_quirk_probe_minmax },
+
+	/*
+	 * Fix for the problem with cameras on Acer Nitro 5 Series.
+	 * Thanks to @Giuliano69 for providing the fix.
+	 */
+	/* Quanta ACER HD User Facing  0x4035 - Experimental */
+	{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
+			 USB_DEVICE_ID_MATCH_INT_INFO,
+	  .idVendor = 0x0408,
+	  .idProduct = 0x4035,
+	  .bInterfaceClass = USB_CLASS_VIDEO,
+	  .bInterfaceSubClass = 1,
+	  .bInterfaceProtocol = UVC_PC_PROTOCOL_15,
+	  .driver_info = (kernel_ulong_t) &
+			 (const struct uvc_device_info){
+				 .uvc_version = 0x010a,
+			 } },
+
+	/* Quanta ACER HD User Facing 4033 - Experimental !! */
+	{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
+			 USB_DEVICE_ID_MATCH_INT_INFO,
+	  .idVendor = 0x0408,
+	  .idProduct = 0x4033,
+	  .bInterfaceClass = USB_CLASS_VIDEO,
+	  .bInterfaceSubClass = 1,
+	  .bInterfaceProtocol = UVC_PC_PROTOCOL_15,
+	  .driver_info = (kernel_ulong_t) &
+			 (const struct uvc_device_info){
+				 .uvc_version = 0x010a,
+			 } },
+
 	/* Genius eFace 2025 */
 	{ .match_flags		= USB_DEVICE_ID_MATCH_DEVICE
 				| USB_DEVICE_ID_MATCH_INT_INFO,

This review ensures the code is clean, maintainable, and follows the project's coding standards.

Yours, Gooroo.dev. To receive reviews automatically, install Github App

gooroodev avatar May 25 '24 14:05 gooroodev

Shouldn't this go through the kernel mailing list?

leomonta avatar Jun 06 '24 20:06 leomonta