uvc: add support for the Kaiweets KTI-W02 infrared camera
Checks
Commit Message
- adds support for the D3DFMT_R5G6B5 bitmap format (just RGBP but with
a different GUID)
- adds a quirk for the Kaiweets camera which uses it
The camera uses an NXP chipset (product ID 0x1fc9), but I can't find
any references to a device with vendor ID 0x009b. It may be specific
to the Kaiweets camera.
Comments
HI David
Can you add the output of lsusb -v -d 1fc9 ?
Also, the patch should be implemented of top of
https://git.linuxtv.org/media_stage.git/log/
Could you rebase your patch and send as v2?
https://patchwork.linuxtv.org/project/linux-media/patch/CALgV52gHPWrcBBv2m6fAAyF_i_8T7cRTtBRS+FKe4TgfRVG0DA@mail.gmail.com/
Thanks!
On Sun, 15 Sept 2024 at 21:32, David Given <dg@cowlark.com> wrote:
>
> - adds support for the D3DFMT_R5G6B5 bitmap format (just RGBP but with
> a different GUID)
> - adds a quirk for the Kaiweets camera which uses it
>
> The camera uses an NXP chipset (product ID 0x1fc9), but I can't find
> any references to a device with vendor ID 0x009b. It may be specific
> to the Kaiweets camera.
>
> diff --git a/drivers/media/common/uvc.c b/drivers/media/common/uvc.c
> index c54c2268f..c12d58932 100644
> --- a/drivers/media/common/uvc.c
> +++ b/drivers/media/common/uvc.c
> @@ -96,6 +96,10 @@ static const struct uvc_format_desc uvc_fmts[] = {
> .guid = UVC_GUID_FORMAT_RGBP,
> .fcc = V4L2_PIX_FMT_RGB565,
> },
> + {
> + .guid = UVC_GUID_FORMAT_D3DFMT_R5G6B5,
> + .fcc = V4L2_PIX_FMT_RGB565,
> + },
> {
> .guid = UVC_GUID_FORMAT_BGR3,
> .fcc = V4L2_PIX_FMT_BGR24,
> diff --git a/drivers/media/usb/uvc/uvc_driver.c
> b/drivers/media/usb/uvc/uvc_driver.c
> index f0febdc08..5a29f6970 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -3072,6 +3072,15 @@ static const struct usb_device_id uvc_ids[] = {
> .bInterfaceSubClass = 1,
> .bInterfaceProtocol = 0,
> .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) },
> + /* NXP Semiconductors IR VIDEO */
> + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
> + | USB_DEVICE_ID_MATCH_INT_INFO,
The quirks are sorted by idVendor:IdProduct
> + .idVendor = 0x1fc9,
> + .idProduct = 0x009b,
> + .bInterfaceClass = USB_CLASS_VIDEO,
> + .bInterfaceSubClass = 1,
> + .bInterfaceProtocol = 0,
> + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
> /* Generic USB Video Class */
> { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) },
> { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) },
> diff --git a/include/linux/usb/uvc.h b/include/linux/usb/uvc.h
> index 88d96095b..01c3b2f45 100644
> --- a/include/linux/usb/uvc.h
> +++ b/include/linux/usb/uvc.h
> @@ -140,6 +140,9 @@
> #define UVC_GUID_FORMAT_D3DFMT_L8 \
> {0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, \
> 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
> +#define UVC_GUID_FORMAT_D3DFMT_R5G6B5 \
> + {0x7b, 0xeb, 0x36, 0xe4, 0x4f, 0x52, 0xce, 0x11, \
> + 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}
> #define UVC_GUID_FORMAT_KSMEDIA_L8_IR \
> {0x32, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, \
> 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
>
On Mon, Sep 16, 2024 at 01:55:15PM +0200, Ricardo Ribalda wrote:
> HI David
>
> Can you add the output of lsusb -v -d 1fc9 ?
>
> Also, the patch should be implemented of top of
> https://git.linuxtv.org/media_stage.git/log/
>
> Could you rebase your patch and send as v2?
> https://patchwork.linuxtv.org/project/linux-media/patch/CALgV52gHPWrcBBv2m6fAAyF_i_8T7cRTtBRS+FKe4TgfRVG0DA@mail.gmail.com/
The patch should also be split in two, one patch to add the new format
to drivers/media/common/uvc.c and include/linux/usb/uvc.c, and a second
patch to add the device quirk to drivers/media/usb/uvc/uvc_driver.c.
This follows the "one change, one patch" principle of the kernel, and
eases review as well as backporting.
Indentation looks wrong in the patch, did you format it with
git-format-patch and send it with git-send-email ?
> On Sun, 15 Sept 2024 at 21:32, David Given <dg@cowlark.com> wrote:
> >
> > - adds support for the D3DFMT_R5G6B5 bitmap format (just RGBP but with
> > a different GUID)
> > - adds a quirk for the Kaiweets camera which uses it
> >
> > The camera uses an NXP chipset (product ID 0x1fc9), but I can't find
> > any references to a device with vendor ID 0x009b. It may be specific
> > to the Kaiweets camera.
> >
> > diff --git a/drivers/media/common/uvc.c b/drivers/media/common/uvc.c
> > index c54c2268f..c12d58932 100644
> > --- a/drivers/media/common/uvc.c
> > +++ b/drivers/media/common/uvc.c
> > @@ -96,6 +96,10 @@ static const struct uvc_format_desc uvc_fmts[] = {
> > .guid = UVC_GUID_FORMAT_RGBP,
> > .fcc = V4L2_PIX_FMT_RGB565,
> > },
> > + {
> > + .guid = UVC_GUID_FORMAT_D3DFMT_R5G6B5,
> > + .fcc = V4L2_PIX_FMT_RGB565,
> > + },
> > {
> > .guid = UVC_GUID_FORMAT_BGR3,
> > .fcc = V4L2_PIX_FMT_BGR24,
> > diff --git a/drivers/media/usb/uvc/uvc_driver.c
> > b/drivers/media/usb/uvc/uvc_driver.c
> > index f0febdc08..5a29f6970 100644
> > --- a/drivers/media/usb/uvc/uvc_driver.c
> > +++ b/drivers/media/usb/uvc/uvc_driver.c
> > @@ -3072,6 +3072,15 @@ static const struct usb_device_id uvc_ids[] = {
> > .bInterfaceSubClass = 1,
> > .bInterfaceProtocol = 0,
> > .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) },
> > + /* NXP Semiconductors IR VIDEO */
> > + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
> > + | USB_DEVICE_ID_MATCH_INT_INFO,
>
> The quirks are sorted by idVendor:IdProduct
>
> > + .idVendor = 0x1fc9,
> > + .idProduct = 0x009b,
> > + .bInterfaceClass = USB_CLASS_VIDEO,
> > + .bInterfaceSubClass = 1,
> > + .bInterfaceProtocol = 0,
> > + .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
> > /* Generic USB Video Class */
> > { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) },
> > { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) },
> > diff --git a/include/linux/usb/uvc.h b/include/linux/usb/uvc.h
> > index 88d96095b..01c3b2f45 100644
> > --- a/include/linux/usb/uvc.h
> > +++ b/include/linux/usb/uvc.h
> > @@ -140,6 +140,9 @@
> > #define UVC_GUID_FORMAT_D3DFMT_L8 \
> > {0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, \
> > 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
> > +#define UVC_GUID_FORMAT_D3DFMT_R5G6B5 \
> > + {0x7b, 0xeb, 0x36, 0xe4, 0x4f, 0x52, 0xce, 0x11, \
> > + 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}
> > #define UVC_GUID_FORMAT_KSMEDIA_L8_IR \
> > {0x32, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, \
> > 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
On Mon, 16 Sept 2024 at 14:03, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
[...]
> The patch should also be split in two, one patch to add the new format
> to drivers/media/common/uvc.c and include/linux/usb/uvc.c, and a second
> patch to add the device quirk to drivers/media/usb/uvc/uvc_driver.c.
> This follows the "one change, one patch" principle of the kernel, and
> eases review as well as backporting.
Done.
> Indentation looks wrong in the patch, did you format it with
> git-format-patch and send it with git-send-email ?
Turns out gmail expands tabs to spaces when you paste into it --- who
knew. I figured out git send-email and have used that.
https://patchwork.kernel.org/bundle/dg/kaiweets/
@@ -96,6 +96,10 @@ static const struct uvc_format_desc uvc_fmts[] = {
.guid = UVC_GUID_FORMAT_RGBP,
.fcc = V4L2_PIX_FMT_RGB565,
},
+ {
+ .guid = UVC_GUID_FORMAT_D3DFMT_R5G6B5,
+ .fcc = V4L2_PIX_FMT_RGB565,
+ },
{
.guid = UVC_GUID_FORMAT_BGR3,
.fcc = V4L2_PIX_FMT_BGR24,
b/drivers/media/usb/uvc/uvc_driver.c
@@ -3072,6 +3072,15 @@ static const struct usb_device_id uvc_ids[] = {
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) },
+ /* NXP Semiconductors IR VIDEO */
+ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
+ | USB_DEVICE_ID_MATCH_INT_INFO,
+ .idVendor = 0x1fc9,
+ .idProduct = 0x009b,
+ .bInterfaceClass = USB_CLASS_VIDEO,
+ .bInterfaceSubClass = 1,
+ .bInterfaceProtocol = 0,
+ .driver_info = (kernel_ulong_t)&uvc_quirk_probe_minmax },
/* Generic USB Video Class */
{ USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) },
{ USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) },
@@ -140,6 +140,9 @@
#define UVC_GUID_FORMAT_D3DFMT_L8 \
{0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, \
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_D3DFMT_R5G6B5 \
+ {0x7b, 0xeb, 0x36, 0xe4, 0x4f, 0x52, 0xce, 0x11, \
+ 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}
#define UVC_GUID_FORMAT_KSMEDIA_L8_IR \
{0x32, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, \
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}